Brian, Oh Brian, you wonderful person you...... thank you, i still have most of my hair ready for my next encounter with an annoying error. Thank you to all who helped, my weekend suddenly is looking much rosier :) Cheers, Brad > From: Brian White <[EMAIL PROTECTED]> > Date: Fri, 06 Jul 2001 14:39:05 +1000 > To: Brad Wright <[EMAIL PROTECTED]>, PHP General List > <[EMAIL PROTECTED]> > Subject: RE: [PHP] Re: changing to a different file in browser > > You didn't quite get what I meant - in login.php, you have two lumps > of PHP code ( lump being <?PHP ... ?> ) separated by a little bit of white > space. That little bit of white-space BETWEEN the lumps is what is causing > your problems. > > Reduce it down to one lump and try again. > > Ie: > > login.php: > <?PHP > session_start(); > > // "?> ... <?PHP" removed from here > > // Connect to the database > $db = mysql_connect("localhost", "user", "pass"); > if( !$db ) die ("Couldnt connect to server, try again soon. "); > > ( ... remainder of login.php ...) > > > > At 14:20 6/07/2001 +1000, Brad Wright wrote: > > >> i'm not sure which file you meant but i took out all whityespace , hence: >> >> >> login.php: >> *********************************** >> <?PHP session_start();?> >> <?PHP >> // Connect to the database >> $db = mysql_connect("localhost", "user", "pass"); >> if( !$db ) die ("Couldnt connect to server, try again soon.."); >> // Select Database >> mysql_select_db("LoginDB", $db) or die ("Couldn't connect to database"); >> // Query Database table >> $query = "select * from Admin_Login_TB where teamLogin = '$teamLogin' && >> teamPass = '$teamPass' " ; >> $result = mysql_query($query,$db); >> // LIst the matching row values >> list ($teamLogin, $teamPass, $teamNo)=mysql_fetch_row($result); >> // Test to see if a match was found >> // If not: the die >> // if match found then continue >> if (!mysql_numrows($result) ) { >> die ( "username/password not valid"); >> } >> else{ >> header("Location: adminMenu.php"); >> exit; } >> ?> >> ******************************************* >> >> menu.php: >> ****************************************** >> <?PHP session_start();?> >> ****************************************** >> >> I still get the same error...... >> >> >> >> any ideas??? >> >> >> cheers, >> brad >>> From: Brian White <[EMAIL PROTECTED]> >>> Date: Fri, 06 Jul 2001 13:59:45 +1000 >>> To: Brad Wright <[EMAIL PROTECTED]>, PHP General List >>> <[EMAIL PROTECTED]> >>> Subject: Re: [PHP] Re: changing to a different file in browser >>> >>> At 13:36 6/07/2001 +1000, Brad Wright wrote: >>>> I'm sure there is something REALLY simple Im missing here.... below is the >>>> ... >>> >>> OK. I think your problem is here. Between the first "?>" and the second >>> "<?PHP" >>> is a piece of white-space. This is treated by PHP as text, which >> triggers it >>> to >>> send the headers, before sending off the encountered text. >>> >>> Try making removing them and see what happens. >>> >>>> login.php: >>>> <?PHP >>>> session_start(); >>>> ?> >>>> <?PHP >>>> >>>> // Connect to the database >>>> $db = mysql_connect("localhost", "user", "pass"); >>>> if( !$db ) die ("Couldnt connect to server, try again soon. "); >>>> >>>> // Select Database >>>> >>>> mysql_select_db("LoginDB", $db) or die ("Couldn't connect to the >> database, >>>> sorry."); >>>> >>>> // Query Database table >>>> $query = "select * from Admin_Login_TB where teamLogin = '$teamLogin' && >>>> teamPass = '$teamPass' " ; >>>> $result = mysql_query($query,$db); >>>> >>>> // LIst the matching row values >>>> list ($teamLogin, $teamPass, $teamNo)=mysql_fetch_row($result); >>>> >>>> >>>> >>>> >>>> // Test to see if a match was found >>>> // If not: then die >>>> // if match found then continue >>>> >>>> if (!mysql_numrows($result) ) { >>>> die ( "username/password not valid"); >>>> } >>>> else{ >>>> header("Location: menu.php"); >>>> exit; } >>>> ?> >>>> >>>> >>>> ***************************************** >>>> >>>> menu.php >>>> <?PHP session_start(); >>>> ?> >>>> test >>>> **************************************** >>>> >>>> I hope you can see a glareingly obvious problem that i can't >>>> >>>> Cheers, >>>> Brad >>>> >>>>> From: "..s.c.o.t.t.." <[EMAIL PROTECTED]> >>>>> Date: Thu, 5 Jul 2001 23:13:09 -0700 >>>>> To: "Php-General" <[EMAIL PROTECTED]> >>>>> Subject: RE: [PHP] Re: changing to a different file in browser >>>>> >>>>> even a blank line at the end of a file that you're >>>>> include()ing will break header. >>>>> >>>>> you could use output buffering, but i dont think >>>>> you really want to go to all that trouble for a simple >>>>> redirect :) >>>>> >>>>>> -----Original Message----- >>>>>> From: Chris Anderson [mailto:[EMAIL PROTECTED]] >>>>>> Sent: Thursday, July 05, 2001 19:47 >>>>>> To: Brad Wright; PHP General List >>>>>> Subject: Re: [PHP] Re: changing to a different file in browser >>>>>> >>>>>> >>>>>> If you use Header after ANY page output, even a space, it will not work >>>>>> ----- Original Message ----- >>>>>> From: "Brad Wright" <[EMAIL PROTECTED]> >>>>>> To: "PHP General List" <[EMAIL PROTECTED]> >>>>>> Sent: Thursday, July 05, 2001 10:25 PM >>>>>> Subject: Re: [PHP] Re: changing to a different file in browser >>>>>> >>>>>> >>>>>> tried it, but it didn't work... still getting the same message in >> IE. Am I >>>>>> missing something? Can I actually use the headr() function to redirect >>>> to a >>>>>> different page while using sesions and session variables?? >>>>>> >>>>>>> From: "..s.c.o.t.t.." <[EMAIL PROTECTED]> >>>>>>> Date: Thu, 5 Jul 2001 22:32:22 -0700 >>>>>>> To: "Php-General" <[EMAIL PROTECTED]> >>>>>>> Subject: RE: [PHP] Re: changing to a different file in browser >>>>>>> >>>>>>> put "Location" before the URL: >>>>>>> >>>>>>> header("Location: http://server.com/file.php"); >>>>>>> or >>>>>>> header("Location: ./file.php"); >>>>>>> >>>>>>> >>>>>>>> -----Original Message----- >>>>>>>> From: Brad Wright [mailto:[EMAIL PROTECTED]] >>>>>>>> Sent: Thursday, July 05, 2001 18:54 >>>>>>>> To: PHP General List >>>>>>>> Subject: Re: [PHP] Re: changing to a different file in browser >>>>>>>> >>>>>>>> >>>>>>>> ihave tried the header() function as Julio suggested. But I get an >> error >>>>>>>> message in the browser. I am also using session variables in all these >>>>>> pages >>>>>>>> (only 2). >>>>>>>> >>>>>>>> My code : >>>>>>>> if (!mysql_numrows($result) ) { >>>>>>>> die ( "username/password not valid"); >>>>>>>> } >>>>>>>> else{ >>>>>>>> >>>>>>>> >>>>>>>> header("Menu.php"); >>>>>>>> } >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> the error message in IE: >>>>>>>> Warning: Cannot add header information - headers already sent by >> (output >>>>>>>> started at /home/e-smith/files/ibays/bigpool1/html/login.php:1) in >>>>>>>> /home/e-smith/files/ibays/bigpool1/html/login.php on line 1 >>>>>>>> >>>>>>>> >>>>>>>> Thanks in advance, >>>>>>>> brad >>>>>>>> >>>>>>>> >>>>>>>>> From: "Inércia Sensorial" <[EMAIL PROTECTED]> >>>>>>>>> Date: Thu, 5 Jul 2001 22:26:24 -0300 >>>>>>>>> To: [EMAIL PROTECTED] >>>>>>>>> Subject: [PHP] Re: changing to a different file in browser >>>>>>>>> >>>>>>>>> header ("http://www.example.com"); // Goes to example.com. >>>>>>>>> >>>>>>>>> -- >>>>>>>>> >>>>>>>>> >>>>>>>>> Julio Nobrega. >>>>>>>>> >>>>>>>>> A hora está chegando: >>>>>>>>> http://sourceforge.net/projects/toca >>>>>>>>> >>>>>>>>> "Brad Wright" <[EMAIL PROTECTED]> wrote in message >>>>>>>>> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >>>>>>>>>> Hi all, >>>>>>>>>> I know this is probably the most stupid question you'll see on this >>>>>> list >>>>>>>>> for >>>>>>>>>> a while, but anyway, >>>>>>>>>> In an 'if..else' statement, I want to (if a condition is met) >>>> change to >>>>>> a >>>>>>>>>> totally new php page in the browser window. I know this is >> simple (in >>>>>> fact >>>>>>>>> i >>>>>>>>>> had it working last night but have now forgotten how i did it). >>>>>>>>>> >>>>>>>>>> ie (no the following is NOT actual PHP....sheesh :) >>>>>>>>>> >>>>>>>>>> If a=1 >>>>>>>>>> go to required_page.php >>>>>>>>>> else >>>>>>>>>> do nothing >>>>>>>>>> >>>>>>>>>> Thanks in advance, >>>>>>>>>> Brad >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> PHP General Mailing List (http://www.php.net/) >>>>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>>>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>>>>>> To contact the list administrators, e-mail: >>>> [EMAIL PROTECTED] >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> PHP General Mailing List (http://www.php.net/) >>>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>>>>> To contact the list administrators, e-mail: >> [EMAIL PROTECTED] >>>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> PHP General Mailing List (http://www.php.net/) >>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>>>> To contact the list administrators, e-mail: >> [EMAIL PROTECTED] >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> PHP General Mailing List (http://www.php.net/) >>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>>> To contact the list administrators, e-mail: [EMAIL PROTECTED] >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> PHP General Mailing List (http://www.php.net/) >>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>>> To contact the list administrators, e-mail: [EMAIL PROTECTED] >>>>>> >>>>> >>>>> >>>>> -- >>>>> PHP General Mailing List (http://www.php.net/) >>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>> To contact the list administrators, e-mail: [EMAIL PROTECTED] >>>>> >>>> >>>> >>>> -- >>>> PHP General Mailing List (http://www.php.net/) >>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>> To contact the list administrators, e-mail: [EMAIL PROTECTED] >>> >>> ------------------------- >>> Brian White >>> Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy >>> Phone: +612-93197901 >>> Web: http://www.steptwo.com.au/ >>> Email: [EMAIL PROTECTED] >>> >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> To contact the list administrators, e-mail: [EMAIL PROTECTED] > > ------------------------- > Brian White > Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy > Phone: +612-93197901 > Web: http://www.steptwo.com.au/ > Email: [EMAIL PROTECTED] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]