Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Sep 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Warning: session_start() [function.session-start]:

    I'm getting this error. This is for my header.php

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/bibico5/public_html/mm2213/loginfail.php:107) in /home/bibico5/public_html/mm2213/includes/header.inc.php on line 1

    PHP Code:
    <?php require_once('../Connections/connAdmin.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function 
    GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
    {
      if (
    PHP_VERSION 6) {
        
    $theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      }

      
    $theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

      switch (
    $theType) {
        case 
    "text":
          
    $theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
          break;    
        case 
    "long":
        case 
    "int":
          
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case 
    "double":
          
    $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case 
    "date":
          
    $theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
          break;
        case 
    "defined":
          
    $theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
          break;
      }
      return 
    $theValue;
    }
    }
    ?>
    <?php
    // *** Validate request to login to this site.
    if (!isset($_SESSION)) {
    session_start();
    }

    $loginFormAction $_SERVER['PHP_SELF'];
    if (isset(
    $_GET['accesscheck'])) {
      
    $_SESSION['PrevUrl'] = $_GET['accesscheck'];
    }

    if (isset(
    $_POST['username'])) {
      
    $loginUsername=$_POST['username'];
      
    $password=$_POST['password'];
      
    $MM_fldUserAuthorization "";
      
    $MM_redirectLoginSuccess "../membersonly.php";
      
    $MM_redirectLoginFailed "../loginfail.php";
      
    $MM_redirecttoReferrer false;
      
    mysql_select_db($database_connAdmin$connAdmin);
      
      
    $LoginRS__query=sprintf("SELECT username, username FROM users WHERE username=%s AND username=%s",
        
    GetSQLValueString($loginUsername"text"), GetSQLValueString($password"text")); 
       
      
    $LoginRS mysql_query($LoginRS__query$connAdmin) or die(mysql_error());
      
    $loginFoundUser mysql_num_rows($LoginRS);
      if (
    $loginFoundUser) {
         
    $loginStrGroup "";
        
        
    //declare two session variables and assign them
        
    $_SESSION['MM_Username'] = $loginUsername;
        
    $_SESSION['MM_UserGroup'] = $loginStrGroup;          

        if (isset(
    $_SESSION['PrevUrl']) && false) {
          
    $MM_redirectLoginSuccess $_SESSION['PrevUrl'];    
        }
        
    header("Location: " $MM_redirectLoginSuccess );
      }
      else {
        
    header("Location: "$MM_redirectLoginFailed );
      }
    }

    if (isset(
    $_POST['pwd'])) { $_POST['pwd'] = sha1($_POST['pwd']); }
    ?>

  • #2
    Regular Coder FWDrew's Avatar
    Join Date
    Apr 2008
    Location
    Missouri
    Posts
    380
    Thanks
    38
    Thanked 45 Times in 43 Posts
    Remove:
    PHP Code:
    if (!isset($_SESSION)) {
    session_start();

    And start your sessions with
    PHP Code:
     session_start(); 
    before doing anything else, I'm assuming in header.inc.php.
    Dev-Tips.com || Employee at the Envato Network || My Portfolio

  • #3
    New to the CF scene
    Join Date
    Sep 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So i put this in the very beginning of my header.inc.php?
    PHP Code:
     <?php session_start(); ?>

  • #4
    Regular Coder FWDrew's Avatar
    Join Date
    Apr 2008
    Location
    Missouri
    Posts
    380
    Thanks
    38
    Thanked 45 Times in 43 Posts
    Quote Originally Posted by bibi822 View Post
    So i put this in the very beginning of my header.inc.php?
    PHP Code:
     <?php session_start(); ?>
    Yes, call session_start before any other code or other file(s).

    Edit - See the answer to the FAQ here, this is a common issue.
    Last edited by FWDrew; 09-20-2009 at 09:18 AM. Reason: added link
    Dev-Tips.com || Employee at the Envato Network || My Portfolio

  • #5
    New to the CF scene
    Join Date
    Sep 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    it doesn't seem to work..
    it's wierd..
    after deleted
    PHP Code:
    if (!isset($_SESSION)) {
    session_start();

    then put session_start in the first line
    PHP Code:
     <?php session_start(); ?>
    and then this pops up
    "The Server Behavior panel cannot determine whether "log in user" or "log in user" is applied to your page. Please select edit server behavior and change one of the two behaviors to ensure that each is uniquely identifiable."

    and then 2 "log in user" appears on the behavior tab...


    This is the whole code on my header.inc.php right now

    PHP Code:
    <?php session_start(); ?>
    <?php 
    require_once('../Connections/connAdmin.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function 
    GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
    {
      if (
    PHP_VERSION 6) {
        
    $theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      }

      
    $theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

      switch (
    $theType) {
        case 
    "text":
          
    $theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
          break;    
        case 
    "long":
        case 
    "int":
          
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case 
    "double":
          
    $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case 
    "date":
          
    $theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
          break;
        case 
    "defined":
          
    $theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
          break;
      }
      return 
    $theValue;
    }
    }
    ?>
    <?php
    // *** Validate request to login to this site.
    $loginFormAction $_SERVER['PHP_SELF'];
    if (isset(
    $_GET['accesscheck'])) {
      
    $_SESSION['PrevUrl'] = $_GET['accesscheck'];
    }

    if (isset(
    $_POST['username'])) {
      
    $loginUsername=$_POST['username'];
      
    $password=$_POST['password'];
      
    $MM_fldUserAuthorization "";
      
    $MM_redirectLoginSuccess "../membersonly.php";
      
    $MM_redirectLoginFailed "../loginfail.php";
      
    $MM_redirecttoReferrer false;
      
    mysql_select_db($database_connAdmin$connAdmin);
      
      
    $LoginRS__query=sprintf("SELECT username, username FROM users WHERE username=%s AND username=%s",
        
    GetSQLValueString($loginUsername"text"), GetSQLValueString($password"text")); 
       
      
    $LoginRS mysql_query($LoginRS__query$connAdmin) or die(mysql_error());
      
    $loginFoundUser mysql_num_rows($LoginRS);
      if (
    $loginFoundUser) {
         
    $loginStrGroup "";
        
        
    //declare two session variables and assign them
        
    $_SESSION['MM_Username'] = $loginUsername;
        
    $_SESSION['MM_UserGroup'] = $loginStrGroup;          

        if (isset(
    $_SESSION['PrevUrl']) && false) {
          
    $MM_redirectLoginSuccess $_SESSION['PrevUrl'];    
        }
        
    header("Location: " $MM_redirectLoginSuccess );
      }
      else {
        
    header("Location: "$MM_redirectLoginFailed );
      }
    }

    if (isset(
    $_POST['pwd'])) { $_POST['pwd'] = sha1($_POST['pwd']); }
    ?>
    <div id="header">
    <div id="top"></div>
      <div id="login">
      <form ACTION="<?php echo $loginFormAction?>" id="form1" name="form1" method="POST">
        Username:
    <label>
      <input name="username" type="text" id="username" size="15" />
      </label>
      <br />
      Password: 
      <label>
      <input name="password" type="text" id="password" size="15" />
      </label>
      <br />
      Register Agent
    <label>
      <input name="login" type="submit" class="button" value="login" />
      </label>
      </form>
      </div>
    <div id="logo">
    <img src="images/logo1.jpg" width="401" height="67" />
      
    <br />
    </div>
      <div id="navcontainer">
    <ul id="navlist">
    <li id="active"><a href="#" id="current">ABOUT</a></li>
    <li><a href="#">NEWS</a></li>
    <li><a href="#">BUYER</a></li>
    <li><a href="#">SELLER</a></li>
    <li><a href="#">LISTING</a></li>
    <li><a href="#">CONTACT</a></li>
    </ul>
    </div>
    <div id="search"><div id="sb2">
      <div id="sb_head">Find a Home</div>
    <div id="find_t">
            <div id="left_f">
              <p class="contr">Cities:
                                            <select class="countr">
                                              <option value="Pasadena">Pasadena</option>
                                              <option value="Arcadia">Arcadia</option>
                                              <option value="San Marino">San Marino</option>
                                              <option value="Monrovia">Monrovia</option>
                                              <option value="San Gabriel">San Gabriel</option>
                </select></p>
              <p class="contr">Price:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;To:<br />
                <select name="select" class="countr1">
                  <option>max</option>
                  <option>max</option>
                </select>
                &nbsp;
                <select name="select2" class="countr1">
                  <option>min</option>
                  <option>min</option>
                </select>
              </p>
              <p class="contr">
                <input name="Search" type="button" value="Search" />
              </p>
                                            
            </div>
            <div id="right_f">
                                        <p class="bed">Beds:
                                        <select class="beds">
                                            <option>0</option>
                                            <option>1</option>
                                        </select></p>
              <p class="bed">Baths:
                                        <select class="beds">
                                            <option>0</option>
                                            <option>1</option>
              </select></p>
            </div>
          </div>
    </div></div>
    <div id="house">
      <object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="514" height="224">
        <param name="movie" value="flash/house.swf" />
        <param name="quality" value="high" />
        <param name="wmode" value="opaque" />
        <param name="swfversion" value="6.0.65.0" />
        <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
        <param name="expressinstall" value="Scripts/expressInstall.swf" />
        <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
        <!--[if !IE]>-->
        <object type="application/x-shockwave-flash" data="flash/house.swf" width="514" height="224">
          <!--<![endif]-->
          <param name="quality" value="high" />
          <param name="wmode" value="opaque" />
          <param name="swfversion" value="6.0.65.0" />
          <param name="expressinstall" value="Scripts/expressInstall.swf" />
          <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
          <div>
            <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
            <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
          </div>
          <!--[if !IE]>-->
        </object>
        <!--<![endif]-->
      </object>
    </div>
    </div>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •