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


PHP auth::authenticate方法代码示例

本文整理汇总了PHP中auth::authenticate方法的典型用法代码示例。如果您正苦于以下问题:PHP auth::authenticate方法的具体用法?PHP auth::authenticate怎么用?PHP auth::authenticate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在auth的用法示例。


在下文中一共展示了auth::authenticate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process

 public function process()
 {
     $username = $_POST['username'];
     $password = $_POST['password'];
     if (empty($username)) {
         lib::seterror('Please enter a username.');
         lib::sendto('/login');
     }
     if (empty($password)) {
         lib::setitem('username', $username);
         lib::seterror('Please enter a password.');
         lib::sendto('/login');
     }
     $user = new user(array('username' => $username));
     if (auth::authenticate($user, $password)) {
         lib::setitem('user', $user);
         lib::sendto();
     } else {
         lib::setitem('username', $username);
         lib::seterror('Invalid username or password.');
         lib::sendto('/login');
     }
 }
开发者ID:quekaihua,项目名称:StudyTest,代码行数:23,代码来源:login.php

示例2: auth

// Use Sessions
// WARNING: Vulnerable to javascript injection.
// NOTE: This will store the username and password entered by the user to the cookie
// variables USERNAME and PASSWORD respectively even if the combination is correct or
// not. Be sure to authenticate every page that you want to be secured and pass as
// parameters the variables USERNAME and PASSWORD.
setcookie("USERNAME", $_POST['username']);
setcookie("PASSWORD", $_POST['password']);
// Change the path to auth.php and authconfig.php if you moved
// vAuthenticate.php from its original directory.
include_once "auth.php";
include_once "authconfig.php";
$username = $_POST['username'];
$password = $_POST['password'];
$Auth = new auth();
$detail = $Auth->authenticate($username, $password);
if ($detail == 0) {
    ?>

	<HEAD>
		<SCRIPT language="JavaScript1.1">
		<!--
			location.replace("<?php 
    echo $failure;
    ?>
");
		//-->
		</SCRIPT>
	  </HEAD>

<?php 
开发者ID:ZYMO,项目名称:vAuthenticate-4,代码行数:31,代码来源:vAuthenticate.php


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