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ù)。
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="border">
<form action="checklogin.php" method="post">
<tr>
<td width="29%" height="31" align="right" class="text12">用戶名:</td>
<td align="left"><input name="username" type="text" size="15"></td>
</tr>
<tr>
<td height="29" align="right" class="text12">密碼:</td>
<td align="left"><input name="password" type="password" size="15"></td>
</tr>
<tr>
</td>
</tr>
<tr>
<td height="30" align="right"> </td>
<td align="left"><input type="submit" name="Submit" value="提 交">
<input type="reset" name="Submit2" value="重 置"></td>
</tr>
<tr>
<td height="27" align="right"> </td>
<td><a href="reg.php" class="text12">會(huì)員注冊(cè)</a></td>
</tr>
</form>
</table>
reg.php模塊(注冊(cè)模塊)
<?
include("inc/conn.php");
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>會(huì)員注冊(cè)</title>
<link href="css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
</head>
<SCRIPT language=javascript>
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();
}
</SCRIPT>
<body>
<td width="7" valign="top"> </td>
<td width="700" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="423" valign="top"><p> </p>
<table width="93%" height="362" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
<tr>
<td height="360" align="center"><table width="75%" border="0" cellpadding="0" cellspacing="0" class="border">
<form action="save.php?act=add" method="post" name="myform">
<tr>
<tr>
<td height="33" align="right" class="text12">姓名:</td>
<td><input name="name" type="text" id="name">
<span class="STYLE1">*</span></td>
</tr>
<tr>
<td height="33" align="right" class="text12">學(xué)號(hào):</td>
<td><input name="username" type="text" id="username">
<span class="STYLE1">*</span></td>
</tr>
<tr>
<td height="33" align="right" class="text12">密碼:</td>
<td><input name="password" type="password" id="password">
<span class="STYLE1">*</span></td>
</tr>
<tr>
<td height="33" align="right" class="text12">確認(rèn)密碼:</td>
<td><input name="enpass" type="password" id="enpass">
<span class="STYLE1">*</span></td>
</tr>
<td height="33" align="right" class="text12">性別:</td>
<td><input name="sex" type="radio" value="男" checked>
男
<input type="radio" name="sex" value="女">
女</td>
</tr>
<tr>
<td height="33" align="right"><span class="text12">Email:</span></td>
<td><input name="email" type="text" id="email"></td>
</tr>
<tr>
<td height="33" align="right"><span class="text12">聯(lián)系QQ:</span></td>
<td><input name="qq" type="text" id="qq"></td>
</tr>
<tr>
<td width="35%" height="33"> </td>
<td width="65%"><input type="button" name="Submit3" value="提 交" onClick="CheckPost()">
<input type="reset" name="Submit22" value="重 設(shè)"></td>
</tr>
</form>
</table></td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
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 "<script>alert('請(qǐng)輸入正確的帳號(hào)密碼!');window.top.location.href='index.php'</script>";
}
else
{
$rs=mysql_fetch_assoc($query);
$_SESSION["username"]=$username;
echo "<script>alert('登陸成功');window.location.href='index.php'</script>";
}
?>
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 "<script>alert('注冊(cè)成功,請(qǐng)登錄!'); window.location.href='index.php';</script>";}
?>
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)亂碼。
名稱欄目:用戶注冊(cè)和用戶登錄簡(jiǎn)單代碼
本文URL:http://jinyejixie.com/article6/ipjsig.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)網(wǎng)站建設(shè)、網(wǎng)站導(dǎo)航、微信公眾號(hào)、App設(shè)計(jì)、網(wǎng)站維護(hù)、全網(wǎng)營(yíng)銷推廣
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)