Created
June 2, 2012 05:15
-
-
Save Samnan/2856708 to your computer and use it in GitHub Desktop.
Custom MyWebSQL auth driver for bangIDE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Custom MyWebSQL authentication driver for bangIDE | |
* | |
* @file: lib/auth/custom.php | |
* @author Samnan ur Rehman | |
* @copyright (c) 2008-2011 Samnan ur Rehman | |
* @web http://mywebsql.net | |
*/ | |
class MyWebSQL_Auth_Custom { | |
private $error; | |
public function authenticate($userid, $password, $server) { | |
$userid = Session::get('learninglamp', 'db_user'); | |
$password = Session::get('learninglamp', 'db_pass'); | |
// the following is required for proper functionality after authentication | |
Session::set('auth', 'valid', true); | |
Session::set('auth', 'server_name', $server[0], true); | |
Session::set('auth', 'host', $server[1]['host'], true); | |
Session::set('db', 'driver', $server[1]['driver']); | |
Session::set('auth', 'user', $userid, true); | |
Session::set('auth', 'pwd', $password, true); | |
header('Location: '.EXTERNAL_PATH); | |
return true; | |
} | |
public static function showServerList() { | |
return false; | |
} | |
/* this function should return the basic auth parameters if auth is successful */ | |
public function getParameters() { | |
$param = array( | |
'host' => Session::get('auth', 'host', true), | |
'driver' => Session::get('db', 'driver'), | |
'username' => Session::get('auth', 'user', true), | |
'password' => Session::get('auth', 'pwd', true) | |
); | |
return $param; | |
} | |
public function getError() { | |
return $this->error; | |
} | |
private function setError($str) { | |
$this->error = $str; | |
return false; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment