Killersites Community: mvc login oop - Killersites Community

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

mvc login oop

#1 User is offline   mehdi 

  • View blog
  • Group: New Members
  • Posts: 4
  • Joined: 09-November 11

Posted 09 November 2011 - 11:48 PM

Hi when i login in php_oop_login_projectfiles show this error
( ! ) Strict standards: Only variables should be passed by reference in D:\xampp\htdocs\php_oop_login_projectfiles\models\m_auth.php on line 31

my database char set is UTF8
please guid me
thanks
INDEED your site is best and it is very fast
I wish i had a site like http://www.killersites.com
0

#2 User is offline   Ben 

  • View blog
  • Group: Administrators
  • Posts: 5,409
  • Joined: 19-December 08
  • LocationChico, CA

Posted 10 November 2011 - 07:42 AM

Can you pust the code that you are using in m_auth.php? Where are you getting this error? In Dreamweaver/your coding application? In the browser itself?
Benjamin Falk | Falken Creative : Twitter : KillerSites Screencast Blog
Skills: Photoshop, Illustrator, HTML, CSS, jQuery, PHP and CodeIgniter
0

#3 User is offline   mehdi 

  • View blog
  • Group: New Members
  • Posts: 4
  • Joined: 09-November 11

Posted 10 November 2011 - 10:20 AM

Hi
thanks
when I login in my web site
show this error
<?php

/*
	Authorization Class
	Deal with auth tasks
*/

class Auth
{
	private $salt = 'j4H9?s0d';
	
	/*
		Constructor
	*/
	function __construct()
	{
	}
	
	/*
		Functions
	*/
	function validateLogin($user, $pass)
	{
		// access db
		global $Database;
		
		// create query
		if ($stmt = $Database->prepare("SELECT * FROM users WHERE username = ? AND password = ?"))
		{
			$stmt->bind_param("ss", $user, md5($pass . $this->salt));
			$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.");
		}
	}
	
	function checkLoginStatus()
	{
		if (isset($_SESSION['loggedin']))
		{
			return TRUE;
		}
		else
		{
			return FALSE;
		}
	}
	
	function logout()
	{
		session_destroy();
		session_start();
	}
}

my web browser Mozila firefox 8
Posted Image
0

#4 User is offline   Ben 

  • View blog
  • Group: Administrators
  • Posts: 5,409
  • Joined: 19-December 08
  • LocationChico, CA

Posted 10 November 2011 - 11:05 AM

I think you can fix that by changing:

if ($stmt = $Database->prepare("SELECT * FROM users WHERE username = ? AND password = ?"))

to

$stmt = $Database->prepare("SELECT * FROM users WHERE username = ? AND password = ?")
if ($stmt)

I'm not completely sure why you are getting that error, and I don't since we are working with the same code, but double check my fix and let me know if that takes care of things.
Benjamin Falk | Falken Creative : Twitter : KillerSites Screencast Blog
Skills: Photoshop, Illustrator, HTML, CSS, jQuery, PHP and CodeIgniter
0

#5 User is offline   mehdi 

  • View blog
  • Group: New Members
  • Posts: 4
  • Joined: 09-November 11

Posted 10 November 2011 - 12:50 PM

UNFORTUNATELY not solved my problem
i thinks this line is my problem
$stmt->bind_param("ss", $user, md5($pass . $this->salt));

thanks a lot
0

#6 User is offline   Ben 

  • View blog
  • Group: Administrators
  • Posts: 5,409
  • Joined: 19-December 08
  • LocationChico, CA

Posted 10 November 2011 - 02:10 PM

Instead of

$stmt->bind_param("ss", $user, md5($pass . $this->salt));

try

$pw = md5($pass . $this->salt);
$stmt->bind_param("ss", $user, $pw);
Benjamin Falk | Falken Creative : Twitter : KillerSites Screencast Blog
Skills: Photoshop, Illustrator, HTML, CSS, jQuery, PHP and CodeIgniter
0

#7 User is offline   mehdi 

  • View blog
  • Group: New Members
  • Posts: 4
  • Joined: 09-November 11

Posted 10 November 2011 - 02:53 PM

thanks a lot
Solved my problem.
:)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users