您好,登錄后才能下訂單哦!
本篇文章給大家分享的是有關(guān)怎么在php項(xiàng)目中實(shí)現(xiàn)一個(gè)登陸login功能,小編覺(jué)得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說(shuō),跟著小編一起來(lái)看看吧。
具體內(nèi)容如下
<?php require "../include/DBClass.php"; $username=$_POST['UserName']; $password=$_POST['Password']; if(empty($username) || empty($password)){ Go_Msg("請(qǐng)?zhí)顚?xiě)用戶名,密碼!","../default.html"); exit; } DBConn(); $password=md5($password); $SQL = "Select UserName,UserType,UserPass From siteuser where UserName='" . $username ."' and UserPass='" . $password . "' and isopen=1"; //echo "$SQL"; $result = $db -> exec_SQL($SQL); $total=mysql_num_rows($result); if($total==0){ DBClose(); Go_Msg("注冊(cè)用戶還沒(méi)有通過(guò)管理員審核或用戶名及密碼不符!請(qǐng)重新輸入!","../default.html"); exit; }else{ $Rs = $db -> fetch_array($result); //附值,并登錄 session_register("username"); session_register("usertype"); $_SESSION["usertype"]=$Rs['UserType']; $_SESSION["username"]=$username; //echo $_SESSION["username"]; if ($_SESSION["usertype"]==1){ Go_Msg("登陸成功!","default.php"); //header('Location:http://163.com'); } if ($_SESSION["usertype"]==2){ Go_Msg("登陸成功!","../user2/default_1.php"); } if ($_SESSION["usertype"]==3){ Go_Msg("登陸成功!","../user3/default_2.php"); } // header('Location:default.php'); } DBClose(); // 何問(wèn)起 hovertree.com ?>
以上就是怎么在php項(xiàng)目中實(shí)現(xiàn)一個(gè)登陸login功能,小編相信有部分知識(shí)點(diǎn)可能是我們?nèi)粘9ぷ鲿?huì)見(jiàn)到或用到的。希望你能通過(guò)這篇文章學(xué)到更多知識(shí)。更多詳情敬請(qǐng)關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。