當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FileData::LoadOrganizationFoID方法代碼示例

本文整理匯總了PHP中FileData::LoadOrganizationFoID方法的典型用法代碼示例。如果您正苦於以下問題:PHP FileData::LoadOrganizationFoID方法的具體用法?PHP FileData::LoadOrganizationFoID怎麽用?PHP FileData::LoadOrganizationFoID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FileData的用法示例。


在下文中一共展示了FileData::LoadOrganizationFoID方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Login

 public function Login($name, $passwd)
 {
     $access = false;
     $data_org = new FileData();
     $l = fopen('system/log.dat', 'a+');
     $result = mysql_query("SELECT * FROM users WHERE login='{$name}'");
     if ($myuser = mysql_fetch_array($result)) {
         if (md5($passwd) == $myuser['passwdhash']) {
             $access = true;
             $this->name = $name;
             $this->organizationid = $myuser['orgnizid'];
             //echo'id='.$myuser['orgnizid'];
             $this->hashpasswd = md5($passwd);
             $this->id_user = $myuser['id'];
             $this->viewgroup = $myuser['viewgroup'];
             $this->viewname = $myuser['viewname'];
             $this->privilege = $myuser['privilege'];
             $orgname = $data_org->LoadOrganizationFoID($myuser['orgnizid']);
             //print_r($orgname);
             $this->organization = $orgname[0];
             $this->organizationlastname = $orgname[1];
             unset($_SESSION["login"]);
             unset($_SESSION["pwd"]);
             $_SESSION['login'] = $this->name;
             $_SESSION['pwd'] = $this->hashpasswd;
             //fwrite($l,"user:$name login Sucses \n"); //запись в лог файл
             $this->sendlog("user:{$name} login Sucses");
         }
     } elseif (!isset($_SESSION['login']) && !isset($_SESSION['pwd'])) {
         echo 'нет такого пользователя!!!';
         $this->sendlog("user:{$name} bad login");
     }
     if (isset($_SESSION['login']) && isset($_SESSION['pwd']) && !$access) {
         $result = mysql_query("SELECT * FROM users WHERE login='{$_SESSION['login']}'");
         $myuser = mysql_fetch_array($result);
         if ($myuser && $_SESSION['pwd'] == $myuser['passwdhash']) {
             $access = true;
             $this->name = $myuser['login'];
             $this->organizationid = $myuser['orgnizid'];
             $this->hashpasswd = $_SESSION['pwd'];
             $this->id_user = $myuser['id'];
             $this->viewgroup = $myuser['viewgroup'];
             $this->viewname = $myuser['viewname'];
             $this->email = $myuser['email'];
             $this->privilege = $myuser['privilege'];
             $orgname = $data_org->LoadOrganizationFoID($myuser['orgnizid']);
             $this->organization = $orgname[0];
             $this->organizationlastname = $orgname[1];
         }
     }
     if (!$access) {
         $this->sendlog("user: {$name} login failed");
         //	$t=date("Y-m-d H:i:s");
         //	fwrite($l,"$t user:$name login failed \n");
     }
     fclose($l);
     return $access;
 }
開發者ID:antbut,項目名稱:my_site_php,代碼行數:58,代碼來源:user.php


注:本文中的FileData::LoadOrganizationFoID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。