header problem...................

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anis2007
    New Member
    • Oct 2006
    • 21

    #1

    header problem...................

    Hi,

    following code run our server but this is not run client server:-
    index code is: PUT YOUR CODE BETWEEN code OR php TAGS!! It is absolutely unreadeable!
    Code:
    <?php
    ob_start();
    session_start();
    include_once("connection.php");
     if($_POST["login_x"]!="") ## Submit a login button
          {
           
    	$uname=$_REQUEST['uname'];
    	$password=$_REQUEST['password'];
    	$uname=trim($uname);
    	$password=trim($password);
    $sql=mysql_query("select * from tb_login where fld_uname='$uname' && fld_password='$password' && fld_status='Approved'");  
    $num=mysql_num_rows($sql);
    $ress=mysql_fetch_row($sql);
    $uidd=$ress[0];
    			   
    if($num > 0)
    		        
    {
     $_SESSION['username']="$uname";
    $_SESSION['uid']="$uidd";
    header("location: my-medscout.php");
    					        
     }
    else
     $msg="Invalid username / password ";
    }
    }
       ?>
    PUT YOUR CODE BETWEEN code OR php TAGS!! It is absolutely unreadeable!

    when we login through this page its go next page and show this type errors

    Warning: Cannot send session cache limiter - headers already sent (output started at c:\apache\htdoc s\medscout\www\ connection.php: 1) in c:\apache\htdoc s\medscout\www\ my-medscout.php on line 4

    but if we used @session_start( ); in the place of session_start() ; in the above page, above errors reduce, and problem those time occur when we register another page name is employer page and when we logout.then show following errors.

    Warning: Cannot add header information - headers already sent by (output started at c:\apache\htdoc s\medscout\www\ connection.php: 1) in c:\apache\htdoc s\medscout\www\ logout.php on line 7


    logout code is :- PUT YOUR CODE BETWEEN code OR php TAGS!! It is absolutely unreadeable!

    Code:
    <?php 
    include_once("connection.php");
    @session_start();
     $_SESSION["username"]="";
    $_SESSION["uid"]="";
     session_destroy();
    header("Location:index.php");
    ?>
    
    Employer page coding is:-
    
    <?php
     include_once("connection.php");
    ob_start();
    @session_start();
    			 
    if($_POST["login_x"]!="")
         {
       $emp_name=$_REQUEST['emp_name'];
    $emp_pass=$_REQUEST['emp_pass'];
    $emp_name=trim($emp_name);
    $emp_pass=trim($emp_pass);
    $sql1=mysql_query("select * from tb_emp where fld_ename='$emp_name' && fld_passs='$emp_pass' && fld_status='Approved'");
    $num1=mysql_num_rows($sql1);
    $ress1=mysql_fetch_row($sql1);
    $uidd1=$ress1[0];
    			   
    if($num1 > 0)
     {
    $_SESSION['empname']="$emp_name";
    						    $_SESSION['eid']="$uidd1";
    header("location: my-medscout-emp.php");
    }
    else
    {
    $msg1="Invalid user/password ";
    }
    }
    
     ?>
    PUT YOUR CODE BETWEEN code OR php TAGS!! It is absolutely unreadeable!

    Tanks

    Record
    Anis Ahmad
    Last edited by anis2007; Oct 6 '06, 09:54 AM. Reason: for right question
  • vssp
    Contributor
    • Jul 2006
    • 268

    #2
    There are two possibilites getting tis erroe
    1. Any html code include this code
    2.Php tag start are end with space please delet ethe space

    Thanks
    vssp

    Comment

    • bevort
      New Member
      • Jul 2006
      • 53

      #3
      Probably the error starts with the ob_start to prevent the output sending to the screen. This is in fact already a statement sending header information. For the session it does not matter if you buffer the output to the screen or not. So this command can come second without any problem.

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        Anis2007: it seems that you have a lot of header problems, You already have 3 threads in this forum with the same problem "Header problem". Don't you think it is time that (A) you'd follow the advice from your forum co-members regarding these header problems and (B) don't double-post in this forum or we have to remove the double threads!

        Ronald :cool:

        Comment

        Working...