Re: redirection again.... sorry

From: Date: Fri, 14 Jul 2000 07:28:12 +0000
Subject: Re: redirection again.... sorry
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-6605@lists.php.net to get a copy of this message
subhro, adding an exit statement after each header() and before the break will force the script to stop, the output buffer to flush and the browser to redirect: case 1: header("location:../search/searchform.html"); exit; break; Also, make sure there is no white space outside of the <? ?> tags. The white space gets sent to the browser. Charles ----- Original Message ----- From: "Subhrajyoti Moitra" <subhra@iitk.ac.in> To: <php-general@lists.php.net> Sent: Friday, July 14, 2000 12:10 AM Subject: [PHP] redirection again.... sorry > hi list, > i am having a redirection problem again.... > heres the code.... > > <? > session_start(); > global $uid,$ID,$row,$passwd,$linkid; > require("config.php"); > if($ID==""){ > file://check login and show his profile > if(CheckLogin($uid,$passwd)==0){ > $ID=session_id(); > if(log_user()==1){ > switch($linkid){ > case 1: header("location:../search/searchform.html"); > break; > case 2:break; > case 3: header("location: news.html"); > break; > case 4: header("location: index.html"); > break; > case 5: header("location: world.html"); > break; > case 6: header("location: help.html"); > break; > case 7: displayUserPage($ID); > break; > case 8: header("location:coffeehouse.html"); > break; > default: echo "Something wrong<br>"; > } > > file://echo "success...<br>"; > } > else{ > echo "<br> not logged .. contact system admin"; > } > } > else { > displayErrorPage(); > } > } > else{ > > displayUserPage($ID); > } > > > ?> > > below is the config.php file.. > <? > $dbhost="localhost"; > $dbname="New"; > $dbuser="subhra"; > $dbpasswd="asdfg"; > $dbtable="NewData"; > $dbauthusertable="AUTH_USER"; > $dbmaster="NewMyData"; > $dblog="AUTH_USER" > ?> > > i am not echoing anything in Checklogin() or in log_user() > the warning is in line 12. > Warning: Cannot add header information - headers already sent by (output > started at config.php:12) in > /home/subhra/public_html/php/auth/show_profile.php > on line 12 > please i am stuck ... someone suggested to change META-EQUIV or something > .. i am not sure ... please advice... > thanx in advance.. subhro > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#6605) next »