本文整理汇总了PHP中login类的典型用法代码示例。如果您正苦于以下问题:PHP login类的具体用法?PHP login怎么用?PHP login使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了login类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct();
include 'controllers/loginController.php';
$valida = new login();
$valida->sessao_valida();
}
开发者ID:suspecie,项目名称:controle-eventos-php-thepowerpuffgirls,代码行数:7,代码来源:homeController.php
示例2: login
function login()
{
header("Content-type: text/html; charset=utf-8");
$username = $_POST['username'];
$password = $_POST['password'];
$database = new login();
$user_data = $database->get_user_info($username);
$user_info = $user_data[0];
if ($user_info) {
$realpass = md5($password);
if ($realpass == $user_info['password']) {
session_start();
$_SESSION['user'] = $username;
$_SESSION['pass'] = md5($realpass);
echo "<script>";
echo "window.location.href = '?c=admin'";
echo "</script>";
} else {
//密码错误
echo "<script>";
echo "alert('用户名或密码错误');";
echo "window.location.href = '?c=login'";
echo "</script>";
}
} else {
//用户名错误
echo "<script>";
echo "alert('用户名或密码错误');";
echo "window.location.href = '?c=login'";
echo "</script>";
}
}
开发者ID:sayi21cn,项目名称:shop72hour,代码行数:32,代码来源:login.class.php
示例3: run
public function run()
{
$login = new login(session::getSID());
if ($login->logged_in() === true) {
header("Location: /index.php?logout=1");
}
}
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:7,代码来源:class.logout.php
示例4: relogin
private function relogin()
{
$username = $_SESSION["username"];
$password = $_SESSION["password"];
session_destroy();
session_start();
require dirname(__FILE__) . "/login.php";
$login_controller = new login();
return $login_controller->attempt_login($username, $password);
}
开发者ID:rexfleischer,项目名称:FledWar,代码行数:10,代码来源:admin.php
示例5: __construct
/**
* Starts the Application
* Takes the parts of the URL and loads the according controller & method and passes the parameter arguments to it
* TODO: get rid of deep if/else nesting
* TODO: make the hardcoded locations ("error/index", "index.php", new Index()) dynamic, maybe via config.php
*/
public function __construct()
{
$this->splitUrl();
// check for controller: is the url_controller NOT empty ?
if ($this->url_controller) {
// check for controller: does such a controller exist ?
if (file_exists(CONTROLLER_PATH . $this->url_controller . '.php')) {
// if so, then load this file and create this controller
// example: if controller would be "car", then this line would translate into: $this->car = new car();
require CONTROLLER_PATH . $this->url_controller . '.php';
$this->url_controller = new $this->url_controller();
// check for method: does such a method exist in the controller ?
if ($this->url_action) {
if (method_exists($this->url_controller, $this->url_action)) {
// call the method and pass the arguments to it
if (isset($this->url_parameter_3)) {
$this->url_controller->{$this->url_action}($this->url_parameter_1, $this->url_parameter_2, $this->url_parameter_3);
} elseif (isset($this->url_parameter_2)) {
$this->url_controller->{$this->url_action}($this->url_parameter_1, $this->url_parameter_2);
} elseif (isset($this->url_parameter_1)) {
$this->url_controller->{$this->url_action}($this->url_parameter_1);
} else {
// if no parameters given, just call the method without arguments
$this->url_controller->{$this->url_action}();
}
} else {
// redirect user to error page (there's a controller for that)
header('location: ' . URL . 'error/index');
}
} else {
// default/fallback: call the index() method of a selected controller
$this->url_controller->index();
}
// obviously mistyped controller name, therefore show 404
} else {
// redirect user to error page (there's a controller for that)
header('location: ' . URL . 'error/index');
}
// if url_controller is empty, simply show the main page (index/index)
} else {
//redirect for entering page and not logged in
if (isset($_SESSION['user_logged_in'])) {
require CONTROLLER_PATH . 'login.php';
$controller = new login();
$controller->index();
} else {
//redirect for entering page and logged in still
require CONTROLLER_PATH . 'home.php';
$controller = new home();
$controller->index();
}
}
}
开发者ID:shuoppy,项目名称:sidewinder,代码行数:59,代码来源:Application.php
示例6: run
public function run()
{
$login = new login(session::getSID());
if ($login->logged_in() === true) {
$user = new users();
$profilePicture = $user->getProfilePicture($_SESSION['userdata']['id']);
$tpl = new template();
$tpl->assign("profilePicture", $profilePicture);
$tpl->assign("userName", $_SESSION['userdata']['name']);
$tpl->assign("userEmail", $_SESSION['userdata']['mail']);
$tpl->display("general.loginInfo");
}
}
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:13,代码来源:class.loginInfo.php
示例7: run
public static function run()
{
new session();
//Suprimir Warnings
error_reporting(E_WARNING);
if (!isset($_SESSION['usuario'])) {
if ($_GET['class']) {
echo "\n\t\t\t\t\t\t<script>\n\t\t\t\t\t\t\ttop.location='./';\n\t\t\t\t\t\t</script>\n\t\t\t\t\t";
}
$pagina = new login();
$pagina->show();
} else {
//$template = file_get_contents('app.view/template.class.php');
$template = new template();
ob_start();
$template->show();
$template = ob_get_contents();
ob_get_clean();
$content = '';
/*
* Se tiver parametros na URL, carrega a classe
*/
if ($_GET) {
$class = $_GET['class'];
if (class_exists($class)) {
$pagina = new $class();
ob_start();
$pagina->show();
$content = ob_get_contents();
ob_end_clean();
} else {
if (function_exists($method)) {
call_user_func($method, $_GET);
}
}
} else {
$pagina = new home();
ob_start();
$pagina->show();
$content = ob_get_contents();
ob_end_clean();
}
/*
* Susbstitui a string #CONTENT# do template para a pagina principal
*/
$site = str_replace('#CONTENT#', $content, $template);
echo $site;
}
}
开发者ID:rodu-pereira,项目名称:Catalogo_PimentaHot,代码行数:49,代码来源:index.php
示例8: checklogin
function checklogin()
{
$login = new login();
if (isset($_SESSION['user']) and isset($_SESSION['loged']) and isset($_SESSION['session']) and $_SESSION['loged'] == true) {
include "body.php";
} else {
$login->logwindow();
}
if (isset($_GET['login']) and $_GET['login'] == "logout" and $_SESSION['loged'] == true) {
$login->logout();
}
if (isset($_POST['usuario']) and isset($_POST['senha']) and $_POST['usuario'] != "" and $_POST['senha'] != "" and isset($_SESSION['cod_usuario']) == false) {
$login->login();
}
}
开发者ID:sergioflorencio,项目名称:toucan,代码行数:15,代码来源:login.php
示例9: validalogin
public function validalogin()
{
$login = new login();
$username = $_REQUEST['username'];
$password = $_REQUEST['password'];
$validar = $login->validacion($username, $password);
if ($validar == 0) {
echo "<script>alert('El usuario y contrasena son incorrectas')</script>";
echo '<meta http-equiv="refresh" content="0; url="/>';
} elseif ($validar == 1) {
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
echo '<meta http-equiv="refresh" content="0; url="/>';
}
}
开发者ID:jaarboledam,项目名称:Gestinv-2.0,代码行数:15,代码来源:login.Controller.php
示例10: __construct
/**
* Opprett objekt av en bruker
* @param integer $u_id
* @param boolean $is_login_user settes kun av login klassen
*/
public function __construct($u_id, $is_login_user = false)
{
global $_base, $_game;
$u_id = (int) $u_id;
$this->id = $u_id;
// hent brukerdata
$result = \Kofradia\DB::get()->query("\n\t\t\tSELECT users.*\n\t\t\tFROM users\n\t\t\tWHERE users.u_id = {$u_id}");
// lagre data
$this->data = $result->fetch();
unset($result);
// fant ikke brukeren?
if (!$this->data) {
return;
}
// levende/aktivert?
$this->active = $this->data['u_access_level'] != 0;
// koble mot login?
if ($is_login_user) {
login::$user = $this;
}
// fjern variablene som skal lastes når de blir benyttet
unset($this->params);
unset($this->player);
unset($this->lock);
unset($this->lock_state);
return;
}
开发者ID:Kuzat,项目名称:kofradia,代码行数:32,代码来源:class.user.php
示例11: __construct
public function __construct()
{
define("BASE_LOADED", true);
// starter utdata buffer
ob_start();
// hent essenntials
require "essentials.php";
ess::$b->base = $this;
// kjør scheduler
if (!MAIN_SERVER) {
$this->scheduler();
}
ess::$b->dt("load_es-gu_pre");
// hent inn brukerinformasjon
login::init();
ess::$b->dt("post");
// sjekk ssl
$this->check_ssl();
// brukerstæsj
if (login::$logged_in) {
$this->load_user_stuff();
} else {
$this->update_anon_stats();
}
// logg visning
$this->log_request();
// sjekk referer
$this->check_referer();
define("SCRIPT_TIME_HALF", microtime(true) - SCRIPT_START);
$profiler = \Kofradia\DB::getProfiler();
define("QUERIES_TIME_HALF", $profiler ? $profiler->time : null);
define("QUERIES_NUM_HALF", $profiler ? $profiler->num : null);
$this->load_config();
ess::$b->dt("base_loaded");
}
开发者ID:Kuzat,项目名称:kofradia,代码行数:35,代码来源:base.php
示例12: main
public static function main()
{
//odczytanie __CLASS__ nie moze byc w funkcji w klasie nadrzędnej
if (basename($_SERVER["SCRIPT_NAME"]) == __CLASS__ . ".php") {
login::display(__CLASS__);
}
}
开发者ID:rofrol,项目名称:gplafferoshop,代码行数:7,代码来源:login.php
示例13: __construct
public function __construct()
{
socialFeed::get_favicon_from('http://www.delicious.com/sydlawrence');
$this->session = Session::instance();
$this->db = new Database();
parent::__construct();
$_POST = $this->input->xss_clean($_POST);
if ($this->input->post('attempt_login')) {
$return = login::attempt_login();
if (isset($return->id) && $return->id > 0) {
$this->user = $return;
} else {
$this->__set_options(array('error' => $return));
}
if (isset($_GET['redirect'])) {
url::redirect(urldecode($_GET['redirect']));
}
}
$this->user = login::check_login();
if ($this->input->get('logout')) {
Auth::instance()->logout(TRUE);
url::redirect();
}
$this->page = Page_Model::get_by_url();
$this->feed = Feed_Model::get_by_url();
$this->feedpost = Feedpost_Model::get_by_url();
$this->__setup();
$this->header = new View('includes/header');
$this->footer = new View('includes/footer');
$this->__binds();
}
开发者ID:sydlawrence,项目名称:SocialFeed,代码行数:31,代码来源:zest.php
示例14: login
function login($user, $pswd)
{
$login = new login();
//var_dump($login);
$login->SetUsername($user);
$login->SetPassword($pswd);
$error = $login->CheckLogin();
//echo $error;
if (isset($_SESSION['ExtDeskSession']['username'])) {
$res["success"] = TRUE;
$res["msg"] = "user {$_SESSION['ExtDeskSession']['username']} loged in ";
} else {
$res["success"] = FALSE;
$res["msg"] = "Not login";
}
return $res;
}
开发者ID:apocoder,项目名称:ExtDesk,代码行数:17,代码来源:class.user.php
示例15: validalogin
public function validalogin()
{
$login = new login();
$username = $_REQUEST['username'];
$password = $_REQUEST['password'];
$validar = $login->validacion($username, $password);
if ($validar == 0) {
echo "<script>alert('El usuario y contrasena son incorrectas')</script>";
echo '<meta http-equiv="refresh" content="0; url="/>';
} elseif ($validar == 1) {
$informacion = $login->loadUsuario($username);
$_SESSION['usu_id'] = $informacion[0]['pk_usu_id'];
$_SESSION['usu_username'] = $informacion[0]['usu_username'];
$_SESSION['name'] = $informacion[0]['usu_primer_nombre'];
$_SESSION['lastname'] = $informacion[0]['usu_primer_apellido'];
echo '<meta http-equiv="refresh" content="0; url="/>';
}
}
开发者ID:Juan-Buitrago,项目名称:Gestinv-2.0,代码行数:18,代码来源:login.Controller.php
示例16: loginClient
function loginClient()
{
$objectLogin = new login();
$dbConnectionArray = $objectLogin->getDatbaseConnectionDetails();
try {
$dbHost = $dbConnectionArray['dbHost'];
$dbName = $dbConnectionArray['dbName'];
$dbUser = $dbConnectionArray['dbUser'];
$dbPassword = $dbConnectionArray['dbPassword'];
//connect to database
$pdo = new PDO("mysql:host={$dbHost};dbname={$dbName}", $dbUser, $dbPassword);
$userName = $_POST['username'];
//validate login details
$loginQuery = $pdo->prepare("SELECT username,password,salt,sitename FROM dw_clients WHERE username = '{$userName}'");
$loginQuery->execute();
$loginCount = count($loginQuery);
if ($loginCount > 0) {
$password = $_POST['password'];
//cleartext password entered via the form
$resultSet = $loginQuery->fetchAll();
$usernameDB = $resultSet[0]['username'];
$passwordDB = $resultSet[0]['password'];
$salt = $resultSet[0]['salt'];
$sitename = $resultSet[0]['sitename'];
$hash = $objectLogin->hashPassword($password, $salt);
//returns the hashedPassword
if ($hash == $passwordDB && $userName == $usernameDB) {
//create session
session_start();
$_SESSION["website"] = $sitename;
$_SESSION['lastActivity'] = time();
//redirect to the subdomain
header("Location:http://www.example.com.ie/client/{$sitename}");
} else {
//fail to login
//redirect to the login form
header("Location:http://www.example.com/login");
}
}
} catch (Exception $e) {
}
}
开发者ID:bob8100,项目名称:salt-hash-login,代码行数:42,代码来源:login.php
示例17: delete
public function delete()
{
$log = ORM::factory('activity');
$log->user_id = login::check_login()->id;
$log->item_type = $this->object_name;
$log->item_id = $this->id;
$log->activity_type = "delete";
$log->item_old = serialize($this);
$log->save();
return parent::delete();
}
开发者ID:sydlawrence,项目名称:SocialFeed,代码行数:11,代码来源:Zest_ORM.php
示例18: start
/**
* start - renders applicaiton and routes to correct template, writes content to output buffer
*
* @access public static
* @return void
*/
public function start()
{
$config = new config();
$login = new login(session::getSID());
$frontController = frontcontroller::getInstance(ROOT);
if ($login->logged_in() === false) {
if (isset($_GET['export']) === true) {
ob_start();
$frontController->run();
$toRender = ob_get_clean();
} else {
ob_start();
include 'includes/templates/' . TEMPLATE . '/login.php';
$toRender = ob_get_clean();
}
} else {
ob_start();
include 'includes/templates/' . TEMPLATE . '/content.php';
$toRender = ob_get_clean();
}
$this->render($toRender);
}
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:28,代码来源:class.application.php
示例19: run
public function run()
{
$login = new login(session::getSID());
if ($login->logged_in() === true) {
$tpl = new template();
//Messages
$message = new messages();
$messages = $message->getInbox($_SESSION['userdata']['id'], 5, 0);
$messageCount = count($messages);
if ($messageCount) {
$mailOptions = array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown', 'href' => '#');
} else {
$mailOptions = array('class' => 'dropdown-toggle');
}
$tpl->assign("mailOptions", $mailOptions);
$tpl->assign("messagecount", $messageCount);
$tpl->assign("messages", $messages);
$tpl->assign("helper", new helper());
//Tickets
$tickets = new tickets();
$newTickets = $tickets->getUnreadTickets($_SESSION['userdata']['id']);
$ticketCount = count($newTickets);
if (count($newTickets)) {
$ticketOptions = array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown', 'data-target' => '#');
} else {
$ticketOptions = array('class' => 'dropdown-toggle');
}
if (is_array($newTickets) === true) {
$limitedTicketItems = array_slice($newTickets, 0, 5);
} else {
$limitedTicketItems = array();
}
$tpl->assign("tickeOptions", $ticketOptions);
$tpl->assign("ticketCount", $ticketCount);
$tpl->assign("newTickets", $limitedTicketItems);
$tpl->display("general.headMenu");
}
}
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:38,代码来源:class.headMenu.php
示例20: index
public function index()
{
$this->template->title = "Please login";
$this->template->content = new View('zest/login_content');
$version = zest::get_version(TRUE);
$this->template->version = $version;
$return = login::attempt_login();
if (isset($return->id)) {
if ($return->roles[0]->id == 4) {
$this->template->message = "You do not have access to this area of the site";
} else {
url::redirect('admin');
}
} else {
$this->template->message = $return;
}
}
开发者ID:sydlawrence,项目名称:SocialFeed,代码行数:17,代码来源:login.php
注:本文中的login类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论