Jump to content

Help With Sessions, Missing Something Simple


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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...