By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,224 Members | 1,233 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,224 IT Pros & Developers. It's quick & easy.

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

P: 21
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!
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. ob_start();
  3. session_start();
  4. include_once("connection.php");
  5.  if($_POST["login_x"]!="") ## Submit a login button
  6.       {
  7.  
  8.     $uname=$_REQUEST['uname'];
  9.     $password=$_REQUEST['password'];
  10.     $uname=trim($uname);
  11.     $password=trim($password);
  12. $sql=mysql_query("select * from tb_login where fld_uname='$uname' && fld_password='$password' && fld_status='Approved'");  
  13. $num=mysql_num_rows($sql);
  14. $ress=mysql_fetch_row($sql);
  15. $uidd=$ress[0];
  16.  
  17. if($num > 0)
  18.  
  19. {
  20.  $_SESSION['username']="$uname";
  21. $_SESSION['uid']="$uidd";
  22. header("location: my-medscout.php");
  23.  
  24.  }
  25. else
  26.  $msg="Invalid username / password ";
  27. }
  28. }
  29.    ?>
  30.  
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\htdocs\medscout\www\connection.php:1) in c:\apache\htdocs\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\htdocs\medscout\www\connection.php:1) in c:\apache\htdocs\medscout\www\logout.php on line 7


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

Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. include_once("connection.php");
  3. @session_start();
  4.  $_SESSION["username"]="";
  5. $_SESSION["uid"]="";
  6.  session_destroy();
  7. header("Location:index.php");
  8. ?>
  9.  
  10. Employer page coding is:-
  11.  
  12. <?php
  13.  include_once("connection.php");
  14. ob_start();
  15. @session_start();
  16.  
  17. if($_POST["login_x"]!="")
  18.      {
  19.    $emp_name=$_REQUEST['emp_name'];
  20. $emp_pass=$_REQUEST['emp_pass'];
  21. $emp_name=trim($emp_name);
  22. $emp_pass=trim($emp_pass);
  23. $sql1=mysql_query("select * from tb_emp where fld_ename='$emp_name' && fld_passs='$emp_pass' && fld_status='Approved'");
  24. $num1=mysql_num_rows($sql1);
  25. $ress1=mysql_fetch_row($sql1);
  26. $uidd1=$ress1[0];
  27.  
  28. if($num1 > 0)
  29.  {
  30. $_SESSION['empname']="$emp_name";
  31.                             $_SESSION['eid']="$uidd1";
  32. header("location: my-medscout-emp.php");
  33. }
  34. else
  35. {
  36. $msg1="Invalid user/password ";
  37. }
  38. }
  39.  
  40.  ?>
  41.  
PUT YOUR CODE BETWEEN code OR php TAGS!! It is absolutely unreadeable!

Tanks

Record
Anis Ahmad
Oct 6 '06 #1
Share this Question
Share on Google+
3 Replies


100+
P: 268
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
Oct 6 '06 #2

bevort
P: 53
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.
Oct 6 '06 #3

ronverdonk
Expert 2.5K+
P: 4,258
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:
Oct 6 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.