Jump to content
Stef's Super Nerd Community
Sign in to follow this  
stephennoble

Strict standards: Only variables should be passed by reference in

Recommended Posts

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.");
	}
}



Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 ????

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...