validate login from external script

Your code modifications and patches you want to share with others.
Locked
nenasimoes
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Thu Jul 10, 2008 2:51 pm

validate login from external script

Post by nenasimoes » Fri Jun 05, 2009 4:00 pm

Hi,

I am trying to connect QuizShock with joomla 1.5.
Till now i get all the user from joomla to quiz, the problem is validate the login from quiz, let mje say that i am working based in a bridge that came with quiz but is for bbforum.
This is the code:

Code: Select all

	function validate()
	{
		global $db, $jos_users_table, $jos_session_table;

		// if we have the username (they are logging in)
		if( $this->username )
		{
			$result = $db->query("SELECT id,usertype,username 
						FROM $jos_users_table 
						WHERE username='$this->username' 
						AND password='$this->password' 
						AND block=0");
		}
		// else validate from id (cookie)
		elseif( $this->id )
		{		
			$result = $db->query("SELECT id,username,usertype  
						FROM $jos_users_table
						WHERE id='$this->id' 
						AND password='$this->password' 
						AND block=0");
		}
		else
		{
			return false;
		}

		if( $db->num_rows($result) )	
		{
			$row = $db->fetch_array($result);

			$this->validated	= 1;
			$this->id		= $row['id'];
			$this->username		= $row['username'];
			$this->level		= $row['usertype'];
Thanks for any help

 
 
Locked

Return to “Core Hacks and Patches”