php中的登陸login
更新時間:2007年01月18日 00:00:00 作者:
login
<?php
require "../include/DBClass.php";
$username=$_POST['UserName'];
$password=$_POST['Password'];
if(empty($username) || empty($password)){
Go_Msg("請?zhí)顚懹脩裘?,密碼!","../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("注冊用戶還沒有通過管理員審核或用戶名及密碼不符!請重新輸入!","../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();
?>
<?php
require "../include/DBClass.php";
$username=$_POST['UserName'];
$password=$_POST['Password'];
if(empty($username) || empty($password)){
Go_Msg("請?zhí)顚懹脩裘?,密碼!","../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("注冊用戶還沒有通過管理員審核或用戶名及密碼不符!請重新輸入!","../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();
?>
相關(guān)文章
set_include_path和get_include_path使用及注意事項(xiàng)
set_include_path 設(shè)置默認(rèn)包含路徑,本文將介紹下其的使用方法,及注意事項(xiàng),感興趣的朋友可以了解下,或許對你學(xué)習(xí)php有所幫助2013-02-02php解析字符串函數(shù)sscanf的實(shí)用方法
在PHP編程中,有時需要對字符串進(jìn)行解析,而sscanf函數(shù)就是一種非常方便的解析工具,本文詳細(xì)介紹了sscanf函數(shù)的用法,包括基本用法和高級用法,通過大量的示例代碼,展示了如何使用sscanf函數(shù)解析各種不同格式的字符串2023-09-09PHP結(jié)合jQuery實(shí)現(xiàn)找回密碼
本文將使用PHP+Mysql+jQuery來實(shí)現(xiàn)一個密碼找回的功能,分享給大家思路和具體的代碼,有需要的小伙伴可以參考下。2015-07-07PHP實(shí)現(xiàn)通過get方式識別用戶發(fā)送郵件的方法
這篇文章主要介紹了PHP實(shí)現(xiàn)通過get方式識別用戶發(fā)送郵件的方法,涉及php針對數(shù)據(jù)庫的讀取、判斷及session登陸的使用技巧,需要的朋友可以參考下2015-07-07php獲取從百度搜索進(jìn)入網(wǎng)站的關(guān)鍵詞的詳細(xì)代碼
以下是關(guān)于php該如何獲取從百度搜索進(jìn)入網(wǎng)站的關(guān)鍵詞的詳細(xì)代碼,希望本文對廣大php開發(fā)者有所幫助2014-01-01PHP實(shí)現(xiàn)使用DOM將XML數(shù)據(jù)存入數(shù)組的方法示例
這篇文章主要介紹了PHP實(shí)現(xiàn)使用DOM將XML數(shù)據(jù)存入數(shù)組的方法,結(jié)合具體實(shí)例形式分析了php基于DOM實(shí)現(xiàn)xml數(shù)據(jù)讀取與解析相關(guān)操作技巧,需要的朋友可以參考下2017-09-09