<?php教程
$DB_HOST = "localhost"; //數據庫教程主機位置
$DB_LOGIN = "root"; //數據庫的使用賬號
$DB_PASSWORD = "admin"; //數據庫的使用密碼
$DB_NAME = "flag"; //數據庫名稱
$conn= mysql教程_connect($DB_HOST, $DB_LOGIN, $DB_PASSWORD);
mysql_select_db($DB_NAME);
?>
************************222222
<?php
functiondb_query($sqlstr) {returnmysql_query($sqlstr);}
functiondb_num_rows($res) {returnmysql_num_rows($res);}
functiondb_fetch_array($res) {returnmysql_fetch_array($res);}
functiondb_fetch_object($res) {returnmysql_fetch_object($res);}
functiondb_data_seek($res,$num){return mysql_data_seek($res,$num);}
functiondb_insert_id($res) {returnmysql_insert_id($res);}
?>
**************************333333333333
<?
include("registry_up.htm") // 導入網頁上半部
?>
<script>
functioncheck()
{
if(document.regstep1.username.value== "")
{
alert("未輸入賬號");
returnfalse;
}
if(document.regstep1.userpass.value== "")
{
alert("請勿使用空白密碼");
returnfalse;
}
if(document.regstep1.userpass.value!= document.regstep1.userpass2.value)
{
alert("兩次輸入的密碼不相同");
returnfalse;
}
document.regstep1.submit();
}
</script>
<script>
<!--------- 打開會員賬號重復性檢查功能頁面的函數 BEGIN---------->
function Checkname(){
var Name = document.regstep1.username.value;
window.open("uniquecheck.php?name="+Name,"Check","width=300,height=10,status=0,scrollbars=0,resizable=1,menubar=0,toolbar=0,location=0");
}
<!---------- 打開會員賬號重復性檢查功能頁面的函數 END----------->
</script>
<form name="regstep1"method="post" action="registry_do.php">
<?php /*?><inputtype="submit" name="username"value="<?=$username?>">
<inputtype="submit" name="userpass"value="<?=$userpass?>">
<inputtype="submit" name="pass_rem"value="<?=$pass_rem?>">
<inputtype="submit" name="pass_ans"value="<?=$pass_ans?>">
<?php */?>
<BR>
<table width="446" border="0"bordercolor="#000000" align="center"cellspacing="0">
<tr>
<td>
<table width="440" border="0"height="220" align="center" bgcolor="#EEEEEE" cellspacing="0"cellpadding="0">
<tr>
<td colspan="2" bgcolor="#FFFFFF">
<divalign="center"><img src="images/1.GIF"width="298" height="41"></div>
</td>
</tr>
<tr>
<td>
<div align="center">賬 號</div>
</td>
<td height="18">
<divalign="center">
<input type="text"name="username" size="15">
<inputonClick="網頁特效:Checkname()" type=button value="檢查賬號"name="button">
</div>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF">
<divalign="center">密 碼</div>
</td>
<td height="6" bgcolor="#FFFFFF">
<div align="center">
<inputtype="password" name="userpass" size="20">
</div>
</td>
</tr>
<tr>
<td>
<divalign="center">密 碼 確 認</div>
</td>
<td height="2">
<divalign="center">
<inputtype="password" name="userpass2" size="20">
</div>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF">
<divalign="center">密 碼 提 示</div>
</td>
<td height="2" bgcolor="#FFFFFF">
<divalign="center">
<selectname="pass_rem">
<optionvalue="0">您寵物的名字</option>
<optionvalue="1">您最想去的國家</option>
<optionvalue="2">您最喜歡的運動</option>
<optionvalue="3">您最討厭的食物</option>
<optionvalue="4">您在家最常做什麼</option>
<optionvalue="5">您最愛看的電影</option>
</select>
</div>
</td>
</tr>
<tr>
<td>
<divalign="center">答 案</div>
</td>
<td height="2">
<divalign="center">
<input type="text"name="pass_ans" size="20">
</div>
</td>
</tr>
<tr>
<td colspan="2" bgcolor="#FFFFFF">
<divalign="center">
<inputtype="reset" name="reset" value="清除重填">
<inputtype="button" name="Submit" value="提交"onClick="check();">
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<?
include("registry_down.htm") // 導入網頁下半部
?>
******************************44444444444
<?
include("db_conn.php");
include("db_func.php");
//增加會員賬號/密碼 BEGIN
$SQLStrUser= "INSERT INTO member (m_username, m_userpass, m_pass_rem, m_pass_ans)";
$SQLStrUser.= " VALUES('$username', '$userpass', '$pass_rem', '$pass_ans') ";
db_query($SQLStrUser);
//增加會員賬號及密碼 END
?>
<script>
alert("<?php echo "注冊完成"; ?>");
location.href = "www.111cn.net";
</script>
****************************55555555555555555
<?
include("db_conn.php");
include("db_func.php");
//查詢注冊賬號名稱是否包含不雅字詞 BEGIN
$SQLStr= "SELECT * FROM nogood WHERE n_name LIKE '%$username%'";
$res= db_query($SQLStr);
//查詢注冊賬號名稱是否包含不雅字詞 END
if(db_num_rows($res)>0) // 若查詢數據有相符
{
echo"<script>";
echo"alert("請勿使用不雅名稱" . $username . "為賬號");";
echo"location.href = "registry1.php";";
echo"</script>";
}
?>
******************************6^^^^^^^^
<?
include("db_conn.php");
include("db_func.php");
//查詢數據庫是否有此用戶名稱BEGIN
$sqlstr= "SELECT * FROM member WHERE m_username='$name'";
$res= db_query($sqlstr);
//查詢數據庫是否有此用戶名稱BEGIN
if(db_num_rows($res)>0) //檢查查詢結果是否有數據
echo "<br><center>此賬號名稱" .$name. "已被注冊使用</center>";
else
echo "<br><center>此賬號名稱" .$name. "尚未有人注冊使用</center>";
?>