index.php模塊(登錄模塊)
創(chuàng)新互聯(lián)專業(yè)為企業(yè)提供朗縣網(wǎng)站建設(shè)、朗縣做網(wǎng)站、朗縣網(wǎng)站設(shè)計(jì)、朗縣網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計(jì)與制作、朗縣企業(yè)網(wǎng)站模板建站服務(wù),十載朗縣做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。
reg.php模塊(注冊(cè)模塊)
include("inc/conn.php");
?>
function CheckPost()
{
if (myform.name.value.length=='')
{
alert("請(qǐng)?zhí)顚懶彰?);
myform.name.focus();
return false;
}
if (myform.password.value.length<2)
{
alert("請(qǐng)?zhí)顚懩拿艽a");
myform.password.focus();
return false;
}
if (myform.enpass.value.length<2)
{
alert("請(qǐng)?zhí)顚懩拇_認(rèn)密碼");
myform.enpass.focus();
return false;
}
if (myform.enpass.value!=myform.password.value)
{
alert("新密碼和確認(rèn)密碼不一致,請(qǐng)重新輸入");
myform.ennewpass.focus();
return false;
}
myform.submit();
}
|
checklogin.php(檢查登錄模塊)
session_start();
include("inc/conn.php");
$username=$_POST["username"];
$password=$_POST["password"];
$sql="select * from user where username='$username' and password='$password'";
$query=MySQL_query($sql);
if(mysql_num_rows($query)==0)
{
echo "";
}
else
{
$rs=mysql_fetch_assoc($query);
$_SESSION["username"]=$username;
echo "";
}
?>
save.php(保存數(shù)據(jù)模塊)
include("inc/conn.php");
$username=$_POST["username"];
$password=$_POST["password"];
$sex=$_POST["sex"];
$email=$_POST["email"];
$qq=$_POST["qq"];
$sql="insert into user(username,password,sex,email,qq) values('$username','$password','$sex','$email','$qq')";
$query=mysql_query($sql);
if ($sql){echo "";}
?>
inc/conn.php數(shù)據(jù)庫連接模塊
//ini_set("error_reporting","E_ALL & ~E_NOTICE");
$conn=mysql_connect ("localhost", "root", "") or die("沒有連接上??!");
//127.0.0.1是MySql IP,root是帳號(hào),如果有密碼請(qǐng)?zhí)顚懺?"中
mysql_select_db("reg") or die("沒有連接上"); //guestbook是數(shù)據(jù)庫名
mysql_query("set names gb2312");
?>
整理中出現(xiàn)的問題:
數(shù)據(jù)庫中中文出現(xiàn)亂碼。