$_clear['uniqid'] = _check_uniqid($_POST['uniqid'], $_SESSION['uniqid']); $_clear['active'] = _sha1_uniqid(); $_clear['username'] = _check_username($_POST['username']); $_clear['password'] = _check_password($_POST['password'], $_POST['notpassword'], 6); $_clear['question'] = _check_questions($_POST['passt'], 4, 20); $_clear['anwser'] = _check_anwser($_POST['passt'], $_POST['passd'], 4, 20); $_clean['sex'] = $_POST['sex']; $_clean['face'] = $_POST['face']; $_clear['email'] = _check_email($_POST['email']); $_clear['qq'] = _check_qq($_POST['qq']); $_clear['url'] = _check_url($_POST['url']); print_r($_clear); } else { //提交前 //这个存入数据库的唯一标识符还有第二个用处 就是cookie登陆验证 验证cookie的标识符和数据库的标识符是否相等 $_SESSION['uniqid'] = $_uniqid = _sha1_uniqid(); echo $_SESSION['uniqid']; } //唯一标识符 有两个参数 参数一rand() :每次产生的长度是随机的 参数二:是否带小数 true/false //最后用md5加密32位 或者shal() 40位 //echo md5(uniqid(rand(),true )); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>注册</title> <?php require root . 'includes/title.php';
require ROOT_PATH . 'includes/CssLoad.inc.php'; ?> <script type="text/javascript"src = "js/code.js"></script> <script type="text/javascript"src = "js/register.js"></script> </head> <body> <?php require ROOT_PATH . 'includes/header.inc.php'; ?> <div id="register"> <h2>Register</h2> <form method="post" name = "register" action="register.php"> <input type = "hidden" name = "action" value = "register"/> <input type = "hidden" name = "uniqid" <?php $_uniqid = _sha1_uniqid(); $_SESSION['uniqid'] = $_uniqid; ?> value = "<?php echo $_uniqid; ?> "/> <dl> <dt>Please fill in the information below</dt> <dd>Username:<input type="text" name="username" class="text" />(*Two characters)</dd> <dd>Password:<input type="password" name="password" class="text" />(*Six characters)</dd> <dd>Password confirm:<input type="password" name="notpassword" class="text" />(*Six characters)</dd> <dd>Password question:<input type="text" name="question" class="text" />(*Two characters)</dd> <dd>Password answer:<input type="text" name="answer" class="text" />(*Two characters)</dd> <dd>Gender:<input type="radio" name="sex" value="Male" checked="checked" />Male <input type="radio" name="sex" value="Female" />Female</dd> <dd class="profile"><input type="hidden" name="profile" value="profile/profile1.jpg" /><img src="profile/profile1.jpg" alt="choose profile" id="profileimg"/></dd>