本文目錄一覽:
php註冊源碼,高手指點下,加個什麼語句就能顯示註冊成功了,謝謝了
倒數第二的/SCRIPT刪掉
最後的/form移動到 /table下面
然後在最後的php程序段里的最後加上success
php 用戶註冊源碼
html
head
title用戶註冊/title
/head
body
strong用戶註冊/strong
form action=”reg.php” method=”post”
用戶名稱:input type=”text” name=”user”br
您的密碼:input type=”password” name=”pass”br
確定密碼:input type=”password” name=”pass2″br
input type=”submit” name=”submit” value=”註冊”
/form
/body
/html
?php
include (‘conn.php’); //這裡是您配置的數據庫
if($_POST[submit]){
//判斷用戶名不低於字數
$struser=strlen($_POST[user]);
if($struser = 4){
echo “script language=javascriptalert(‘註冊請輸入5位數以上’);history.go(-1);/script”;
exit;
}
//判斷用戶是否存在
$users=$_POST[user];
$result=mysql_query(“select * from manage where user=’$users'”);
$row=mysql_fetch_array($result);
if($_POST[user]==$row[user]){
echo “script language=javascriptalert(‘啊!這個名字有人註冊啦!’);history.go(-1);/script”;
exit;
}
//判斷用戶密碼兩次輸入正確
if($_POST[pass]!=$_POST[pass2]){
echo “script language=javascriptalert(‘親,別耍我啦,兩次密碼怎麼能輸入不一樣呢?’);history.go(-1);/script”;
exit;
}
$_POST[pass]=md5($_POST[pass]);
$sql=mysql_query(“insert into manage(id,user,pass)
VALUES(”,’$_POST[user]’,’$_POST[pass]’)
“);
if($sql){
echo “script language=javascriptalert(‘親,註冊成功!’);history.go(-1);/script”;
}
else {
echo “script language=javascriptalert(‘對不起,親!註冊失敗咯!’);history.go(-1);/script”;
}
exit;
}
mysql_close($con)
?
我自己寫的 很簡單,100%適合新人。加密了密碼,利用的是MD5
跪求簡單的php用戶註冊源碼
?php
include ‘conn.php’;
if($_POST[‘submit’]){
$sql = “INSERT INTO admin (Aid,Aname,Apass) values (”,’$_POST[Aname]’,’$_POST[Apass]’)”;
mysql_query($sql);
echo $sql;
}
?
script type=”text/javascript”
function regcheck(){
if(regform.Aname.value==””){
alert(“用戶名不得為空”);
regform.Aname.focus();
return false;
}
if(regform.Apass.value==””){
alert(“密碼不得為空”);
regform.Apass.focus();
return false;
}
}
/script
form action=”zhuceyeA.php” name=”regform” method=”post” onsubmit=”return regcheck()”
註冊管理員br
用戶名:input type=”text” name=”Aname”
密碼:input type=”password” name=”Apass”
input type=”submit” name=”submit” value=”註冊”
/form
//我也是初學者 大四 這個代碼是我自己練手做的 數據庫很簡單 ID 用戶名 密碼(明文顯示,為了簡便起見) 高手不要笑話我。。。。
原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-hk/n/289392.html