Jump to content

Recommended Posts

Posted

Hey Killer Sites Community,

 

Pretty new to this level of programming wondering if someone knows how to fix this problem?

 

I've been following BEN's tutorial series (Building a CMS System video 23) line for line but getting errors that Ben is not getting.

I'm currently running the latest version of WAMP and PHP, My code still runs but getting this error as well....

find error screen shot in attachments

 

FIND BELOW THE ERROR AND CODE

 

post-44369-040675800 1345086173_thumb.jpg

 

Strict standards: Only variables should be passed by reference in C:\wamp\www\CMS\app\core\models\m_auth.php on line 34


 


function validateLogin($user, $pass)
{

	global $FP;


	// Calling the main Database from the main $FP flight path object
	if ($stmt = $FP->Database->prepare("SELECT * FROM users WHERE username = ? AND password = ?"))
	{
		$stmt->bind_param("ss", $user, md5($pass . $this->salt));     // LINE 34
		$stmt->execute();
		$stmt->store_result();

		// check for num rows
		if ($stmt->num_rows > 0)
		{
			// success
			$stmt->close();
			return TRUE;
		}
		else
		{
			// failure
			$stmt->close();
			return FALSE;
		}
	}
	else
	{
		die("ERROR: Could not prepare MySQLi statement.");
	}
}



Posted (edited)

I'm not sure about the nature of your error. Is $salt properly defined in the class? Also, is $Database properly defined? WAMP's 'PHP Strict' errors are unlikely to cause problems on a live site (I believe, anyways). You may find that there are no errors if you put this stuff online. WAMP server is pretty picky and will complain about an 'undefined index' for something like

$_POST[stuff]

instead of

$_POST['stuff']

, which live web host servers are fine with (as they should be..)

Edited by khanahk
Posted

The issue is due to this section: "md5($pass . $this->salt)". Take a look at the OOP section here for a fix:

 

http://www.killersites.com/community/index.php?/blog/5/entry-38-variables-should-be-passed-by-reference-php-login-course-error/

 

 

CHEERS BEN..... quite a easy fix....... WAMP really throws a tantrum when you have errors on strict....

 

Do you think this new error occurs because i'm using a newer version, than when you made the tutorials ????

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...