Hi,
Don't worry, we're here to help 🙂
if ((!$username)||(!$password))
Compare $username to an empty string in order to know if the field was filled in.
exit ();
exit is a function
username='$username' AND password= '$password'") or die
ALWAYS crypt your passwords with md5 before inserting them in the DB.
("$query_username". mysql_error());
$query_username is undefined. Where does it come from ?
if (mysql_num_rows($sql_login_check) == 0)
The ONLY valid value is 1, so compare it to 1... else echo and exit.
echo 'you are not'; exit;
You could use a die you know 🙂. It's equivalent to echo + exit
And shorter to write
$first_name = $users_array['first_name'];
Don't use temp variables, you only use them once!
setcookie("first_name", "$first_name");
I always set the expiration value for a cookie. This way I know when it's deleted from the client. I remember having troubles with cookies before I forgot to set it...
setcookie ("first_name", $users_array['first_name'], time()+3600); // expire in 1 hour
Then to get the cookie value, simply use: $_COOKIE ['firs_name']. And voilà 😃
Hope it helps,
JM