本文整理汇总了PHP中authenticate函数的典型用法代码示例。如果您正苦于以下问题:PHP authenticate函数的具体用法?PHP authenticate怎么用?PHP authenticate使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了authenticate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
function validate($email, $pw)
{
require 'connect.php';
$q="select userid, password from user where emailid='$email'";
$r=mysql_query($q);
if(!$r)
header("Location:error.html");
else
{
$row=mysql_fetch_row($r);
$resusid=$row[0];
$respw=$row[1];
$flag=compare($respw, $pw);
}
if($flag)
{
//user is authenticated
authenticate($resusid);
}
else
{
header("Location:error.html");
}
}
示例2: __construct
function __construct()
{
parent::__construct();
authenticate();
$this->load->model('administrator_model');
$this->load->model('activity_model');
}
示例3: login_user
/**
* Login the user and delegate the setup if login is valid.
*
* @return array
*/
function login_user($dirty_user, $p_pass)
{
// Internal function due to it being insecure otherwise.
if (!function_exists('_login_user')) {
}
$success = false;
$login_error = 'That password/username combination was incorrect.';
// Just checks whether the username and password are correct.
$data = authenticate($dirty_user, $p_pass);
if (is_array($data)) {
if ((bool) $data['authenticated'] && (bool) $data['operational']) {
if ((bool) $data['confirmed']) {
_login_user($data['uname'], $data['player_id'], $data['account_id']);
// Block by ip list here, if necessary.
// *** Set return values ***
$success = true;
$login_error = null;
} else {
// *** Account was not activated yet ***
$success = false;
$login_error = "You must confirm your account before logging in, check your email. <a href='/account_issues.php'>You can request another confirmation email here.</a>";
}
}
// The LOGIN FAILURE case occurs here, and is the default.
}
// *** Return array of return values ***
return ['success' => $success, 'login_error' => $login_error];
}
示例4: __construct
function __construct()
{
parent::__construct();
authenticate();
only_super_administrator();
$this->load->model('configuration_model');
}
示例5: login_do_http_auth
function login_do_http_auth()
{
global $LOGIN_PASSWORD, $LOGIN_USERNAME;
global $_SERVER;
if ($_SERVER['REMOTE_USER']) {
is_logged_in(true);
return;
}
if (!$_SERVER['PHP_AUTH_USER']) {
is_logged_in(false);
return;
}
$status = authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
if (!succeeds($status)) {
is_logged_in(false);
if (!fatal($status)) {
if ($_SERVER['PHP_AUTH_USER']) {
http_401();
}
} else {
print "Error logging in: " . auth_error();
}
} else {
$LOGIN_USERNAME = $_SERVER['PHP_AUTH_USER'];
$LOGIN_PASSWORD = $_SERVER['PHP_AUTH_PW'];
is_logged_in(true);
}
}
示例6: ad_authenticate
/**
* given an owner_type and owner_id
* returns false if user cannot read or write to this workspace
* returns WORKSPACE_AUTH_READ if the user can read
* returns WORKSPACE_AUTH_WRITE if the user can write
*/
function ad_authenticate($owner_id)
{
if (authenticate(AT_PRIV_ASSIGNMENTS, AT_PRIV_RETURN)) {
// instructors have read only access to assignments
return true;
} else {
// students have read access to their own assignments
$sql = "SELECT COUNT(*) cnt FROM %sfiles\n\t\t WHERE owner_id = %d\n AND owner_type= %d\n AND member_id = %d";
$row = queryDB($sql, array(TABLE_PREFIX, $owner_id, WORKSPACE_ASSIGNMENT, $_SESSION['member_id']), TRUE);
if ($row['cnt'] > 0) {
return true;
}
// enrolled students can submit the assignments that assign to him/her
if ($_SESSION['member_id'] && $_SESSION['enroll']) {
// assignments that are assigned to all students
$sql = "SELECT count(*) cnt FROM %sassignments \n WHERE assignment_id = %d\n AND assign_to=0 \n AND course_id=%d";
$row = queryDB($sql, array(TABLE_PREFIX, $owner_id, $_SESSION['course_id']), TRUE);
if ($row['cnt'] > 0) {
return true;
}
// assignments that are assigned to a group,
// and this group has "file storage" tool available
// and the student is in this group
$groups_list = implode(',', $_SESSION['groups']);
// the groups that the student belongs to
$sql = "SELECT count(*) cnt\n\t\t FROM %sgroups_types gt, %sgroups g, %sassignments a\n\t\t WHERE g.group_id in (%s)\n\t\t AND g.group_id in (SELECT group_id FROM %sfile_storage_groups)\n\t\t AND g.type_id = gt.type_id\n\t\t AND gt.course_id = %d\n\t\t AND gt.type_id = a.assign_to\n\t\t AND a.assignment_id = %d";
$row = queryDB($sql, array(TABLE_PREFIX, TABLE_PREFIX, TABLE_PREFIX, $groups_list, TABLE_PREFIX, $_SESSION['course_id'], $owner_id), TRUE);
if ($row['cnt'] > 0) {
return true;
}
}
}
return false;
}
示例7: logIn
function logIn()
{
global $auth_realm;
if (!isset($_SESSION['username'])) {
if (!isset($_SESSION['login'])) {
$_SESSION['login'] = TRUE;
header('WWW-Authenticate: Basic realm="' . $auth_realm . '"');
header('HTTP/1.0 401 Unauthorized');
echo 'You must enter a valid login and password';
echo '<p><a href="?action=logOut">Try again</a></p>';
echo '<p><a href="index.html">Back to EnactusLeicester.co.uk</a></p>';
exit;
} else {
$user = isset($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : '';
$password = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : '';
$result = authenticate($user, $password);
if ($result == 0) {
$_SESSION['username'] = $user;
} else {
session_unset($_SESSION['login']);
errMes($result);
echo '<p><a href="">Try again</a></p>';
exit;
}
}
}
}
示例8: findDN
function findDN($id, $password)
{
// Finds the user's Distinguished Name - the key that uniquely identifies each entry in the directory
global $ldap_host;
// Connects to the LDAP server
$ds = ldap_connect($ldap_host) or die("LDAP connection failed. Please see installation notes on how to configure Apache to work with LDAP.");
if ($ds) {
// Connection was successful
// Performs anonymous bind to LDAP server
$r = ldap_bind($ds);
if ($r) {
// Binding to LDAP server was unsuccessful
// Determines whether the username provided is the uidNumber (which is numeric - 499908), or the uniqueID (which is alphanumeric - cam01329)
$filterString = is_numeric($id) ? "uidNumber={$id}" : "uniqueID={$id}";
// Performs search for the LDAP number
$searchResult = ldap_search($ds, "ou=LAN,o=PORT", $filterString);
// Gets entries for this search
$info = ldap_get_entries($ds, $searchResult);
// Retrieves the DN and givenname (e.g. Alasdair) for the user
$dn = $info[0]["dn"];
$givenname = $info[0]['givenname'][0];
// Calls the authenticate function
authenticate($dn, $password, $givenname);
} else {
// Binding to LDAP server was unsuccessful
echo "Unable to connect to LDAP server";
echo "<p>Click <a href='../../login.php'>here</a> to go back.</p>";
}
} else {
// Connection to LDAP server was unsuccessful
echo "Unable to connect to LDAP server";
echo "<p>Click <a href='../../login.php'>here</a> to go back.</p>";
}
}
示例9: newPost
function newPost($args)
{
global $table_blogs;
$blogid = $args[0];
$username = $args[1];
$password = $args[2];
$content = addslashes($args[3]);
$publish = $args[4];
if (authenticate($username, $password) == TRUE) {
$blog_name = addslashes($username . "'s blog");
preg_match('/<title>(.*?)<\\/title>/i', $title);
$title = $title[0];
$body = str_replace($title, "", $content);
$category = "XML";
$mood = "XML";
$listening = "XML";
$open = 0;
$q_newpost = mysql_query("INSERT INTO {$table_blogs} VALUES( '', '{$username}', '{$title}', '{$body}', '{$category}', '{$mood}', '{$listening}', NOW(), '{$blog_name}', {$open})");
$log_file = fopen("log.txt", w);
$f_content = $content[title];
fwrite($log_file, $f_content);
if ($q_newpost) {
$status = 344324234;
} else {
$status = new IXR_Error(-1, 'An error occured:' . mysql_error());
}
} else {
$status = new IXR_Error(-1, 'You did not provide the correct username and password');
}
return $status;
}
示例10: __construct
function __construct()
{
parent::__construct();
authenticate();
$this->load->model('event_model');
$this->load->model('task_model');
$this->load->model('activity_model');
}
示例11: __construct
function __construct()
{
parent::__construct();
authenticate();
//check admin login or not
$this->load->model('product_model');
$this->layout->set_layout("admin/layout/layout_manager");
}
示例12: TestCookies
public function TestCookies()
{
if (isset($_COOKIE['id_usuario']) && isset($_COOKIE['contrasena'])) {
if (!authenticate($_COOKIE['id_usuario'], $_COOKIE['contrasena'])) {
$this->killCookies();
}
$this->creaSession($record);
}
}
示例13: validate
function validate($username, $pass, $event_id)
{
if (authenticate($username, $pass)) {
if (isRegForEvent($username, $event_id)) {
return 1;
}
return 0;
}
return 0;
}
示例14: __construct
function __construct()
{
parent::__construct();
authenticate();
//check admin login or not
$this->layout->set_layout('admin/layout/layout_manager');
//set layout
$this->load->model('admin_model');
$this->data['page_name'] = 'dashboard';
}
示例15: __construct
function __construct()
{
global $tpl;
$this->tpl = $tpl;
$user = authenticate();
if (isset($user['user']) && $user['user_id'] == 1) {
$tpl->assign('user', $user);
} else {
redirect(BASE_URL);
}
}