# Help me out

**URL:** <https://forum.kirupa.com/t/help-me-out/53068>\
**Category:** Uncategorized\
**Created:** [May 30, 2004, 8:33pm UTC](https://forum.kirupa.com/t/help-me-out/53068 "2004-05-30T20:33:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![T\_O](https://avatars.discourse-cdn.com/v4/letter/t/cc9497/32.png) [@T\_O](https://forum.kirupa.com/u/T_O)\
**Post date:** [May 30, 2004, 8:33pm UTC](https://forum.kirupa.com/t/help-me-out/53068/1 "2004-05-30T20:33:51Z")

</div>

in the config there is an session\_start();  
and Var… $config[user] is correct.  
the db is selected…  
user and pass are the field that have been enterd.

```php
<? ob_start(); 
include("config.php");
// gather some .nfo
$user2 = $_POST['user'];
$pass2 = $_POST['pass'];
// true gethO scripting!
if($user2 != "" && $pass2 != "")
	{
		$select = "SELECT * FROM $config[user] WHERE user = \"$user2\" AND pass = \"$pass2\"";
		$query = mysql_query($select)or die(mysql_error());
		$stats = mysql_num_rows($query);
		if ($stats != "1") 
		{
			echo "There is no user with that pass go back";  
		}
		else
		{
			$select = "SELECT * FROM $config[user] WHERE user = \"$user2\" AND pass = \"$pass2\"";
			$query = mysql_query($select)or die(mysql_error());
			while( $row = mysql_fetch_object($query) )
			{
				$user = $row->user;
				$pass = $row->pass;
				$status = $row->status;
				// there is no logic to this script just leave :P
				setcookie("user", "$user", "$config[cookie]");
				setcookie("pass", "$pass", "$config[cookie]"
);
				
				session_register("user");
				session_register("status");
				
				$date = date('Y-m-d G:i:s');
				$update = "UPDATE $config[user] SET llogin = '$date' WHERE user = '$user2'";
				$query = mysql_query($update)or die(mysql_error());
				echo "You have logged in.<br>Click <a href=index.php>here</a> to go back";
			}
		}
}else{ 
		echo "fill in a username or password. ";
}
mysql_close($dbLink); 
?>

```

This is my log in script…

it returns;  
You have logged in.  
Click here to go back  
Warning: mysql\_fetch\_object(): supplied argument is not a valid MySQL result resource in /home/returnof/public\_html/inloggen.php on line 20

All the cookies are made and the sessions to. But it gives this failt… I really don’t know What I’m doing wrong here…  
You know if it didn’t make the cookies and sessions i might be the the MySQL string but… I don’t know… Please help.
