Jump to content

[SOLVED] Problems with my login system


Stickybomb

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/72935-solved-problems-with-my-login-system/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.