akkad Posted August 11, 2007 Share Posted August 11, 2007 hi everybody ; this is what i am getting when loading the page traffic.html , in the frame body.php: Warning: Cannot modify header information - headers already sent by (output started at /opt/lampp/htdocs/xampp/thesis/admin/body.php:2) in /opt/lampp/htdocs/xampp/thesis/admin/body.php on line 64 Warning: Cannot modify header information - headers already sent by (output started at /opt/lampp/htdocs/xampp/thesis/admin/body.php:2) in /opt/lampp/htdocs/xampp/thesis/admin/body.php on line 65 Warning: Cannot modify header information - headers already sent by (output started at /opt/lampp/htdocs/xampp/thesis/admin/body.php:2) in /opt/lampp/htdocs/xampp/thesis/admin/body.php on line 66 Warning: Cannot modify header information - headers already sent by (output started at /opt/lampp/htdocs/xampp/thesis/admin/body.php:2) in /opt/lampp/htdocs/xampp/thesis/admin/body.php on line 67 Warning: Cannot modify header information - headers already sent by (output started at /opt/lampp/htdocs/xampp/thesis/admin/body.php:2) in /opt/lampp/htdocs/xampp/thesis/admin/body.php on line 68 though i am not ouputting anything before these lines . <code> if(($day == "- Day -") && ($month == "- Month -") && ($year != "- Year -")) { $date=$year; setcookie("day",$day); // line 64 setcookie("month",$month); // 65 setcookie("year",$year);//66 setcookie("first_param", $first_param);//67 setcookie("second_param", $second_param);//68 echo shell_exec("cat `bash ./cal $date` | grep $first_param | /usr/bin/perl /opt/lampp/htdocs/xampp/thesis/calamaris/calamaris -a -P 60 -T 0 -r 400 -d 500 -u -O -F html"); } </code> and when i am printing the cookies: <code> print_r($_COOKIE); </code> it is outputing : Array ( [phpSESSID] => 443d8ad87a1817c428b5ba4f86ffe92a ) i would like to mention that this page is called after authentication and using header function to call it in the auth.php page: <code> <?php session_start(); error_reporting(E_ALL); ini_set('display_errors', True); #echo $_POST['security_code']; $userid=$_POST['userid']; #echo $userid; $password=$_POST['password']; $server="10.2.0.12"; //change to ip address of ldap server $basedn="OU=EDU,DC=academic,DC=aua,DC=am"; //change to reflect the ou and domain that your users are in. #$script=$_SERVER['SCRIPT_NAME']; if ( ($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) && (isset($userid)) && (isset($password))) { $filter="CN=$userid"; #$filter="(&(|(!(displayname=Administrator*))(!(displayname=Admin*)))(cn=$username))"; //define an appropriate ldap search filter to find your users, and filter out accounts such as administrator(administrator should be renamed anyway!). $dn = "CN=$userid"; if (!($connect = ldap_connect($server))) { exit(0); } # echo" after second connect"; if (!($bind = @ldap_bind($connect,"$dn,"."$basedn",$password))) { header("Location:newlog.php"); exit(0); } #echo" after second bind"; $sr = ldap_search($connect, $basedn,$filter); $info = ldap_get_entries($connect, $sr); if(!$sr) { header("Location:newlog.php"); #print "<br>anonymous search failed"; exit(0); } if($info["count"] == 0) { header("Location:newlog.php"); #print "<br>User unknown"; exit(0); } if($info["count"] > 1) { header("Location:newlog.php"); #print "<br>More than one such user - report to CITS"; exit(0); } #$fullname=$info[0]["displayname"][0]; $fullname=$info[0]["givenname"][0]." ".$info[0]["sn"][0]; #echo $fullname; # $fqdn=$info[0]["dn"]; #echo $fqdn; #echo "<br>"; $id =$info[0]["telephonenumber"][0]; # echo $id; # echo "<br>"; $mail= $info[0]["userprincipalname"][0]; #echo $mail; # echo "<BR>"; #print_r($_SERVER[sERVER_ADDR]); $d=date("Y-m-d H:i:s"); #echo "<BR>"; #echo $d; #setcookie("user",$userid); #setcookie("token",$password); #setcookie("fullname",$mail); #setcookie("fqdn", $id); header("Location:traffic.html"); } else { #header('Refresh:1;newlog.php'); header("Location:newlog.php"); #die(); # echo "oops!"; } ?> </code> Link to comment https://forums.phpfreaks.com/topic/64410-warning-cannot-modify-header-information/ Share on other sites More sharing options...
hitman6003 Posted August 11, 2007 Share Posted August 11, 2007 When you have print statements that span multiple lines, such as: #print " User unknown"; you must comment out all of the associated lines...not just the line where the print command is. You can fix it one of two ways.... #print "User unknown"; or #print " #User unknown"; Link to comment https://forums.phpfreaks.com/topic/64410-warning-cannot-modify-header-information/#findComment-321133 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.