用户的登录注册可以说是我们经常要写的一些简单代码,今天我先给大家带来用php写的用户的注册别且有邮箱的验证
<?php
require ('email.class.php');
include "dbconnect.php";
include "functions.php";
$form=check_form(@$_POST['edit']);
extract($form);
<td>
<input type="password" name="edit[pass]" id="edit-pass" size="30" />
</td>
<tr bgcolor="#6699CC">
<td><div align="right">确认密码:</div></td>
<td>
<input type="password" name="edit[pass2]" id="edit-pass2" size="30" />
</td>
</tr>
<tr bgcolor="#6699CC">
<td width="45"><div align="right">邮箱:</div></td>
<td>
<input type="text" name="edit[mail]" id="edit-mail"/>
</td>
</tr>
<tr bgcolor="#CCCCCC" align="center">
<td colspan="2">
<input type="submit" name="op" value="确认注册" />
</td>
</tr>
</table>
</form>
<script language="javascript">
function check_form(){
var username = document.getElementById("edit-name").value;
var password = document.getElementById("edit-pass").value;
var password2 = document.getElementById("edit-pass2").value;
var mail = document.getElementById("edit-mail").value;
var msg ="";
if(username=="")
{
msg+="username is not null! \n";
alert(msg);
}
if(password==""){msg+="password is not null! \n";
alert(msg);
}
if(password!=password2){msg+="password must equal! \n";
alert(msg);
}
if(radiobutton==""){msg+="sex is not null! \n";
alert(msg);
}
if(mail==""){msg+="mail is not null! \n";
alert(msg);
}
if(msg==""){
alert("哈哈,小飞飞又成功了");
window.open("login.php");
return true;