Stickybomb Posted October 12, 2007 Share Posted October 12, 2007 ok I am having problems with my login system. basically i am getting the following Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/sticky/public_html/cms/inc/sentry.php on line 123 and the login does not process. this is the function i use to check mylogin <? // Log in, and either redirect to pass or fail depending on success function checkLogin($user = '',$pass = '',$group = 10,$remember = ''){ // Include database and validation classes, and create objects require_once('functions.php'); require_once('db.php'); $db = new Db(); $results = $db->query(selectByUser($user)); if ($results){ $user = mysql_fetch_array($results); $active = $db->query(getActive($user['user_id'])); //check if user has been activated if(!$avtive){ echo "<meta http-equiv='refresh' content='5;url=index.php?section=activate&userid=".$user['user_sid']."&".strip_tags(session_id()); } //hash the pass $pass = hashValue($pass); //create submitted check string $user_check = $pass.$user['user_sid']; //get stored check string $db_check = $user['user_pass'].$user['user_sid']; if($user_check==$db_check){ $sid = generateSid(); //update timestamp and generate new sid $db->query(updateonLogin(generateTimestamp(),$sid,$id)); // Existing user ok, continue echo "<meta http-equiv='refresh' content='5;url=index.php?section=cms'".strip_tags(session_id())." />"; return true; } }else{ // Login BAD $this->logout(); echo "<meta http-equiv='refresh' content='5;url=index.php?section=login'".strip_tags(session_id())." />"; return false; } } ?> any help or suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/72935-solved-problems-with-my-login-system/ Share on other sites More sharing options...
Aureole Posted October 12, 2007 Share Posted October 12, 2007 That error usually means there is an error in your query. Quote Link to comment https://forums.phpfreaks.com/topic/72935-solved-problems-with-my-login-system/#findComment-367847 Share on other sites More sharing options...
Stickybomb Posted October 12, 2007 Author Share Posted October 12, 2007 ok well this is the query i am running function selectByUser($user) { $sql = 'SELECT user_name,user_level,user_sid,user_id,user_pass FROM users WHERE user_name = "'.addslashes($name).'" LIMIT 1'; return $sql; Quote Link to comment https://forums.phpfreaks.com/topic/72935-solved-problems-with-my-login-system/#findComment-367850 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.