Hey guys, i’m making a login system for my site.
The registration and login goes just fine, but the cookie isn’t being recognized, it is being saved (or so my browsers settings says) byt my code to check for it doesn’t work. I have followed a tutorial just so you know.
My code to check for the cookie: [php]<?php
$logged = false;
if ($_COOKIE[‘c_user’] && $_COOKIE[‘c_salt’]){
$cuser = mysql_real_escape_string($_COOKIE['c_user']);
$csalt = mysql_real_escape_string($_COOKIE['c_salt']);
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `Salt`='$csalt'"));
if ($user != null){
if(hash("sha512", $user['Username']) == $cuser){
$logged = true;
}
}
}
[/php]
My code that saves the cookie:
[php]
Thank you in advance!
Ofc, the X is replaced with the actual server credentials.
EDIT:
I now see that you can log in with any password at all, the username just has to exist. How to check the password?..