Re: Authenticate problem
| From: | Indioblanco | Date: | Tue, 27 Nov 2001 02:06:19 +0000 |
| Subject: | Re: Authenticate problem | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-14586@lists.php.net to get a copy of this message | ||
Also, not sure about your situation, I'm not sure your resource id can always be counted on to be == 1. The sort of syntax I would suggest:
if (!$conn=mysql_connect(SERVER,USER,PWD)) {
header("Location: http://.....notlogged.htm");
} else {
header("Location: http://.....logged.htm");
}
obviously, somewhere on your "notlogged" page you would display the error messages.
koelwebdesign wrote:
$strconnectionuser=mysql_connect("123.345.567.789","$USER");I think it should be:$strconnectionuser=mysql_connect("123.345.567.789","$USER","$PASSWORD");Leo Kuiper "Building a map in order to find what's not lost but left behind." - Beth Orton ----- Original Message ----- From: Harpreet <harpreet@crispincorp.com> To: <php-db@lists.php.net> Sent: Monday, November 26, 2001 4:19 PM Subject: RE: [PHP-DB] Authenticate problemI tried doing the following it still deosnt work <?php include('global1.inc'); $USER=($HTTP_POST_VARS["USER"]); $PASSWORD=($HTTP_POST_VARS["PASSWORD"]); $strconnectionuser=mysql_connect("123.345.567.789","$USER"); if ($strconnectionuser=="Resource id #1") { header("Location: http://123.345.567.789/frame_main.htm"); } else { header("Location: http://123.345.567.789/notlogged.htm"); } ?> How do i check for a valid connection?? He;p is appreciated, regards, Harpreet Kaur Software Developer Crispin Corporations Inc. -----Original Message----- From: Indioblanco [mailto:indioblanco@centralcoasthealing.net] Sent: Wednesday, November 21, 2001 9:59 PM To: harpreet@crispincorp.com Subject: Re: [PHP-DB] Authenticate problem Two things right off the top: 1. You won't execute the header functions if you exit (die) the script. 2. Your header functions won't work if you allow warnings to print.. Try testing for a valid connection, then passing the error string into the redirection url of a header call if it returns false and then exit. -ib -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net