So I can't seem to wrap my head around this. It is pretty simple code yet won't work. The database works so that isn't the problem and the cookie matches exactly what I need it to retrieve. Any help would be appreciated.
if ( isset( $_COOKIE['EliteGen']) ) {
$login = $_COOKIE['EliteGen']['login'];
$auth = $_COOKIE['EliteGen']['auth'];
$sql = "SELECT * FROM `".T_USER."` WHERE `login` = '$login' AND `auth_key` = '$auth'";
$query = mysql_query($sql) or die('Could not connect to database or invalid query.');
if ( mysql_num_rows($query) ) {
$_SESSION['logged'] = 1;
}
}
Question
z3rodown
So I can't seem to wrap my head around this. It is pretty simple code yet won't work. The database works so that isn't the problem and the cookie matches exactly what I need it to retrieve. Any help would be appreciated.
if ( isset( $_COOKIE['EliteGen']) ) { $login = $_COOKIE['EliteGen']['login']; $auth = $_COOKIE['EliteGen']['auth']; $sql = "SELECT * FROM `".T_USER."` WHERE `login` = '$login' AND `auth_key` = '$auth'"; $query = mysql_query($sql) or die('Could not connect to database or invalid query.'); if ( mysql_num_rows($query) ) { $_SESSION['logged'] = 1; } }Link to comment
Share on other sites
3 answers to this question
Recommended Posts