Re: session/mysql problems
| From: | Tom Dangler | Date: | Fri, 02 Apr 2004 14:10:56 +0000 |
| Subject: | Re: session/mysql problems | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-182125@lists.php.net to get a copy of this message | ||
From php manual http://us3.php.net/variables.external
Note: Superglobal arrays, like $_POST and $_GET, became available in PHP 4.1.0
>>> "Andy B" <aborka1@wmis.net> 04/01/04 12:55PM >>>
hi
I created a login script and originally was using php4.3.3 to write the script with. Then I found
out that it had to be rewritten for php4.0.4pl1. I think when rewriting it for the older version it
got messed up somehow and cant quite spot the error/problem in it. can anybody help here??
the query runs right for some reason (i.e. connection works) and query when echoed on the screen is
right but for some reason the query comes back NULL?? even though there are valid users in the
usertable??
here is the whole login script code: i have the actuall lines commented out and echo/print_r lines
in place for debugging reasons:
[code]
<?php
session_start();
include("libs/conf.db");
//connection works since no errors are reported by mysql
mysql_connect($host, $mysqluser, $mysqlpwd)||die(mysql_error());
mysql_select_db($db);
$UserExists=mysql_query("select * from rnjresort_users where
username='$_POST[username]' and pwd=md5($_POST[password])");
//$UserExists returns no valid resource id so something is
//going wrong
if($UserExists) {
$_SESSION['username']=$_POST['username'];
print_r($_SESSION);
print_r($_POST);
echo $UserExists;
//header("location: deletepost.php");
}
else {
print_r($_SESSION);//is empty of course
//following query echoes exactly the way i want it to so no
//errors here that i can see
echo "select * from $UserTable where username='$_POST[username]' and
pwd=md5($_POST[password])";
//header("location: login.html");
}
?>
tnx...