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