Jump to content

Help With Sessions, Missing Something Simple


dosterk

Recommended Posts

I'm working on setting sessions to log people in using their username and password. I'm just having a problem getting the variables and the query to agree with one another. Here's what I have so far:

<?phpsession_start();$dbc = @mysql_connect('localhost', 'studentx', 'xx') or die('Could not connect to MySQL: ' . mysql_error());mysql_select_db("student7", $dbc);$_SESSION['name']=$name;$_SESSION['password']=$password;$query="SELECT * FROM cusinfo WHERE email='$name' and password='$password'";$result=mysql_query($query);$count=mysql_num_rows($result);if($count==1){session_register("name");session_register("password"); header("location:index.php");}else {echo "Wrong Username or Password";}?>

Where in the input field name for username on the sign in page is "name" and the password input name is "password". When I hard code a dummy email and password into that code, it works. So it must be a problem with it grabbing the text that is entered on the sign in page, correct? Thanks for the help guys, hopefully i'm missing something simple.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...