当前位置: 首页>>代码示例>>PHP>>正文


PHP authenticate函数代码示例

本文整理汇总了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");
		}
	 
}
开发者ID:rashmibachani,项目名称:Feed-Reader,代码行数:25,代码来源:funx.php

示例2: __construct

 function __construct()
 {
     parent::__construct();
     authenticate();
     $this->load->model('administrator_model');
     $this->load->model('activity_model');
 }
开发者ID:DavidAH01,项目名称:auto_forms,代码行数:7,代码来源:Administrators.php

示例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];
}
开发者ID:NinjaWars,项目名称:ninjawars,代码行数:33,代码来源:lib_auth.php

示例4: __construct

 function __construct()
 {
     parent::__construct();
     authenticate();
     only_super_administrator();
     $this->load->model('configuration_model');
 }
开发者ID:DavidAH01,项目名称:auto_forms,代码行数:7,代码来源:Configuration.php

示例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);
    }
}
开发者ID:nbtscommunity,项目名称:phpfnlib,代码行数:28,代码来源:login.php

示例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;
}
开发者ID:genaromendezl,项目名称:ATutor,代码行数:40,代码来源:assignment_dropbox.inc.php

示例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;
            }
        }
    }
}
开发者ID:pmavji,项目名称:Enactus-Leicester,代码行数:27,代码来源:auth.php

示例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>";
    }
}
开发者ID:40thieves,项目名称:WikiVLE,代码行数:34,代码来源:ldapLogin.php

示例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;
}
开发者ID:BackupTheBerlios,项目名称:denial,代码行数:31,代码来源:rpc.php

示例10: __construct

 function __construct()
 {
     parent::__construct();
     authenticate();
     $this->load->model('event_model');
     $this->load->model('task_model');
     $this->load->model('activity_model');
 }
开发者ID:DavidAH01,项目名称:auto_forms,代码行数:8,代码来源:Dashboard.php

示例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");
 }
开发者ID:Cyclopeans,项目名称:mlm,代码行数:8,代码来源:Product.php

示例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);
     }
 }
开发者ID:mtaisigue,项目名称:albaranes,代码行数:9,代码来源:Login.php

示例13: validate

function validate($username, $pass, $event_id)
{
    if (authenticate($username, $pass)) {
        if (isRegForEvent($username, $event_id)) {
            return 1;
        }
        return 0;
    }
    return 0;
}
开发者ID:shubhamsharma24,项目名称:Website-EffervescenceMMXIV,代码行数:10,代码来源:auth.php

示例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';
 }
开发者ID:Cyclopeans,项目名称:mlm,代码行数:10,代码来源:Dashboard.php

示例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);
     }
 }
开发者ID:AlvarodelRosal,项目名称:xppass,代码行数:11,代码来源:user.class.php


注:本文中的authenticate函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。