Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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