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


PHP security::login方法代码示例

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


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

示例1: process

 public function process()
 {
     //load de security class
     $sec = new security();
     // if the user data send user and password post...!!
     if (!empty($_POST) && !empty($_POST["user"]) && !empty($_POST["password"])) {
         //we try to log in...!!
         $res = $sec->login($_POST["user"], $_POST["password"]);
     }
     // verify if we are login, this check session, and check
     $res = $sec->loged();
     if ($res["success"]) {
         //check the action we need
         //$this->debug->log($_GET);
         $Module = null;
         $option = null;
         $action = null;
         if (isset($_GET["Module"])) {
             $Module = $_GET["Module"];
         }
         if (isset($_GET["option"])) {
             $option = $_GET["option"];
         }
         if (isset($_GET["action"])) {
             $action = $_GET["action"];
         }
         if (isset($_POST["Module"])) {
             $Module = $_POST["Module"];
         }
         if (isset($_POST["option"])) {
             $option = $_POST["option"];
         }
         if (isset($_POST["action"])) {
             $action = $_POST["action"];
         }
         switch ($Module) {
             case "Main":
                 if ($action == "load_user/") {
                     $action = "load_user";
                 }
                 //TODO: dirty fix in update to ext js4
                 switch ($action) {
                     case "load_user":
                         // we get the languaje strings
                         $languaje = json_encode($this->lang["languaje"]);
                         // send a ok signal
                         $json = '{"success" : true, "login": true,';
                         // we print user data
                         $json = $json . '"user" : [{' . $sec->print_user();
                         $json = $json . '"strings":' . $languaje . ",";
                         $modules = new modules();
                         $moduleStr = $modules->getUserModules();
                         $json = $json . '"modules": ' . $moduleStr . ' }  ]}';
                         echo $json;
                         break;
                 }
                 //<--end case action
                 break;
             default:
                 //first check the user permisión
                 //this is a generic function
                 $modules = new modules();
                 $permision = $modules->checkPermision();
                 //KILL THIS FUCKING LINE IS JUST TO TEST
                 //$permision=1;
                 //$this->debug->log(var_dump($permision));
                 if ($permision == 1) {
                     switch ($Module) {
                         case 'Settings':
                             switch ($option) {
                                 case 'Wallpaper':
                                     if ($action = "save") {
                                         $isSet = $modules->saveWallpaper();
                                         if (!$isSet) {
                                             echo '{success:false, msg:"No se realizaron los cambios en el servidor"}';
                                         } else {
                                             echo '{success:true, msg:"Guardado"}';
                                         }
                                     }
                                     break;
                                 case "Shortcuts":
                                     if ($action = "save") {
                                         $isSet = $modules->saveShortcuts();
                                         if (!$isSet) {
                                             echo '{success:false, msg:"No se realizaron los cambios en el servidor"}';
                                         } else {
                                             echo '{success:true, msg:"Guardado"}';
                                         }
                                     }
                                     break;
                                 case "QLaunchs":
                                     if ($action = "save") {
                                         $isSet = $modules->saveQLaunchs();
                                         if (!$isSet) {
                                             echo '{success:false, msg:"No se realizaron los cambios en el servidor"}';
                                         } else {
                                             echo '{success:true, msg:"Guardado"}';
                                         }
                                     }
                                     break;
//.........这里部分代码省略.........
开发者ID:apocoder,项目名称:ExtDesk,代码行数:101,代码来源:os.php

示例2: exit

<?php

include '../security.php';
include '../sqli.php';
if (!isset($_POST['username']) or empty($_POST['username'])) {
    exit(json_encode(array('error' => 'Username Required')));
}
if (!isset($_POST['password']) or empty($_POST['password'])) {
    exit(json_encode(array('error' => 'Password Required')));
}
$s = new security($db, $_POST['username']);
$token = $s->login($_POST['password']);
if ($token === false) {
    exit(json_encode(array('error' => 'Incorrect Username or Password')));
} else {
    exit(json_encode(array('token' => $token)));
}
开发者ID:bobkingof12vs,项目名称:HumbleData,代码行数:17,代码来源:login.php


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