本文整理汇总了PHP中USER::login方法的典型用法代码示例。如果您正苦于以下问题:PHP USER::login方法的具体用法?PHP USER::login怎么用?PHP USER::login使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USER
的用法示例。
在下文中一共展示了USER::login方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
if (empty($type) || !isset($type)) {
echo 'Request type is not set';
} else {
if ($type == 'signup') {
$data = USER::addNewUser($_REQUEST);
$_SESSION = $data;
if ($data['status'] == 'error') {
header("location:register.php");
} else {
header("location:index.php");
}
} else {
if ($type == 'login') {
$username = addslashes($_REQUEST['username']);
$password = addslashes($_REQUEST['password']);
$_SESSION = USER::login($username, $password);
if ($_SESSION['status'] == 'error') {
header("location:index.php");
} else {
header("location:profile.php");
}
} else {
if ($type == 'logout') {
unset($_SESSION);
session_destroy();
header("location:index.php");
}
}
}
}
?>
示例2: switch
if (!defined("DRAWLINE_RUN_FROM_INDEX")) {
die;
}
if (isset($_GET['do'])) {
switch ($_GET['do']) {
/*
* login user
*/
case "login":
// check if already logged
if (USER::is_logged()) {
redirect(LINKS::get("admin_home"));
}
// check if sent data
if (isset($_POST['username'], $_POST['password'])) {
if (USER::login($_POST['username'], $_POST['password'])) {
TPL::message("Perfect! You'll be redirected in 2 seconds..", "success");
redirect(isset($_GET['redirect']) ? urldecode($_GET['redirect']) : LINKS::get("admin_home"), 2);
} else {
switch (LOGS::get_error()['log_text']) {
case "wrong_username":
TPL::message("You entered a wrong username..");
break;
case "wrong_password":
TPL::message("You entered a wrong password..");
break;
}
}
}
// set render
TPL::render("v_login/login");
示例3: USER
<?php
session_start();
require_once 'class.user.php';
$user_login = new USER();
if ($user_login->is_logged_in() != "") {
$user_login->redirect('home.php');
}
if (isset($_POST['btn-login'])) {
$email = trim($_POST['txtemail']);
$upass = trim($_POST['txtupass']);
if ($user_login->login($email, $upass)) {
$user_login->redirect('home.php');
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Login | Coding Cage</title>
<!-- Bootstrap -->
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
<link href="assets/styles.css" rel="stylesheet" media="screen">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script src="js/vendor/modernizr-2.6.2-respond-1.1.0.min.js"></script>
</head>
示例4: hash
try {
$query = $conn->prepare("SELECT userID FROM user WHERE email = :email");
$query->execute(array(':email' => $email));
//checks if there is an array of results
$row = $query->fetch(PDO::FETCH_ASSOC);
//fetches the results
$userID = hash('sha512', $row['userID']);
//encrypt the id
if ($userID !== $currentID) {
//if the current id != to the id from the db
$error[] = "I think you have the wrong email!";
} else {
//run the update method
if ($reset->updateDetails($email, $password)) {
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
$reset->login($email, $password);
//if successful then login
$reset->redirect('dashboard.php');
//and redirect to dashboard
}
}
}
} catch (PDOException $e) {
echo $e->getMessage();
}
}
}
}
}
}
}
示例5: header
<?php
/**
* 登录
*/
if (!defined("PMX_ENTRANCE")) {
header("HTTP/1.0 404 Not Found");
exit;
}
$username = isset($_POST['username']) ? $_POST['username'] : "";
$password = isset($_POST['password']) ? $_POST['password'] : "";
$user = new USER($username, $password);
if (!$user->auth()) {
header('Content-Type: text/plain; charset=utf-8');
die("The username or password you input is incorrect.");
}
if ($user->login()) {
pmx_gourl_home();
} else {
header('Content-Type: text/plain; charset=utf-8');
die("Unknow error occured.");
}
示例6: FlashCard
require_once 'class.crud.php';
$decks = new FlashCard();
$user_login = new USER();
/*if($user_login->is_logged_in()!="" && $_SERVER['HTTP_REFERER'] != 'http://'.$_SERVER['HTTP_HOST'].'/account.php')
{
$user_login->redirect('account.php');
exit();
}*/
/*if($user_login->is_logged_in()!="")
{
$user_login->redirect('account.php');
}*/
if (isset($_POST['btn-login'])) {
$email = trim($_POST['txtemail']);
$upass = trim($_POST['txtupass']);
if ($user_login->login($email, $upass) && $_SERVER['HTTP_REFERER'] != 'http://' . $_SERVER['HTTP_HOST'] . '/account.php') {
$user_login->redirect('account.php');
}
}
// show username, email and password if user is logged in
if ($user_login->is_logged_in() == 1) {
list($username, $email, $password) = $user_login->getMember($_SESSION['userSession']);
}
// add +1 to php variable counter
if (isset($_POST['counter'])) {
$count = $_POST['counter'];
} else {
$count = 1;
}
// Check if a search query is set
if (isset($_GET['s'])) {
示例7: USER
<?php
include_once 'php/config.php';
$login = new USER($conn);
define("PAGENAME", "Login");
include_once 'include/header.php';
//if logged in already rediret
if ($login->loggedin() != "") {
$login->redirect('dashboard');
}
//if not, then check details through running a method
if (isset($_POST['login_button'])) {
$email = $_POST['email'];
$pass = $_POST['password'];
if ($login->login($email, $pass)) {
$login->redirect('dashboard');
} else {
$error = "Wrong Details!";
}
}
?>
<header class="big-header">
<h1 class="no-margin">Please, log in</h1>
</header>
<div class="intro bottom-margin">
<form method="post" class="inputs feat first">
<div class="light-green">
<h2>Just fill in your details</h2>
</div>