Jump to content

Cookie Creation


cswells

Recommended Posts

$sql_check_e = "SELECT * FROM `tbl` WHERE `email`='".$email."'";
$res_check_e = mysql_query($sql_check_e) or die(mysql_error());

if(mysql_num_rows($res_check_e) == 0){
  echo "The email you supplied does not exist, please regiester <a>here</a>\n";
}else{
  $sql_password = "SELECT * FROM `tbl` WHERE `email`='".$email."' AND `password`='".md5($password)."'";
  $res_password = mysql_query($sql_password) or die(mysql_error());

  if(mysql_num_rows($res_password) == 0){
    echo "Email or password is invalid";
  }else {
    //at this point login is successful
    $user_data = mysql_fetch_array($res_check_e);  <says error is here
    $username = $userdata['username'];
    
    setcookie($username,$email,time()+3600); 

 

I have the user login with Email and Password, but i want the Cookie to store the Username, and email.

The error i get is "Notice: Undefined variable: userdata"

 

Any help would be key. I am probably making a mistake thats right in front of me and yet don't get it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.