每日博客
php
<?php session_start(); require("lineMysql.php"); global $db; $username = $_POST['username']; $password = $_POST['pwd']; $email = $_POST['email']; $tel = $_POST['mobile']; $db->insert("user","$username","$password","$email","$tel"); header('Location:login.html');
<?php //@header("content-type:text/html;charset=uft8"); //$conne = mysql_connect("localhost","root","fx30001225")or die("数据库用户名或密码错误".@mysql_error()); //$select = mysql_select_db("user",$conne)or die("数据库用户名或密码错误".@mysql_error()); //$utf = mysql_query("set names utf8"); //$username= $_REQUEST['username']; //$sql = mysql_query("select count(*) from user where username='$username'"); //$row = mysql_fetch_row($sql); session_start(); require("lineMysql.php"); $username = $_POST['username']; global $db; $select = $db->selectbyUser("user", $username); $row = $db->rows($select); if(!empty($row)){ echo json_encode(repeat);//被注册返回repeat } ?>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>找回密码</title> </head> <body> <p><strong>输入您注册的电子邮箱,找回密码:</strong></p> <p><input type="text" class="input" name="email" id="email"><span id="chkmsg"></span></p> <p><input type="button" class="btn" id="sub_btn" value="提 交" onclick="return tj()"></p> </body> <script> function tj() { var email = document.getElementById("email"); var reg = /^\w+@\w+(\.[a-zA-Z]{2,3}){1,2}$/; if(reg.test(email) == false){alert("请填写正确的邮箱!");} else { $.post("sendmail.php",{mail:email},function(msg) { if(msg=="noreg") { $("#chkmsg").html("该邮箱尚未注册!"); $("#sub_btn").removeAttr("disabled").val('提 交').css("cursor","pointer"); } else{$(".demo").html(msg);} }); } } </script> </html>