真的我试过很多方法,看过很多视频,明明是一样的代码,为什么我的都是不成功,别人的我不知道...很烦啊,未成功提示框也不显示错误点在哪,感觉要崩溃了0_0
login.php:
function init(){
if(myform.username.value==""){
alert("请输入用户名");
//将光标移动到文本框中
myform.username.focus();
return false;
}
if(myform.userpwd.value==""){
alert("请输入密码");
myform.userpwd.focus();
return false;
}
if(myform.code.value==""){
alert("请输入验证码");
myform.code.focus();
return false;
}
}
.code{
width: 80px;
}
.title{
font-size: 20px;
font-weight: bold;
position: relative;
left: 50px;
}
.bd{
background-color:#f0f0f0;
width: 230px;
}
regcheck.php
header("content-Type: text/html; charset=Utf-8");
session_start();
//注册处理页面regcheck.php
if (isset($_POST["hidden"])&&$_POST["hidden"]=="hidden") {
$user=trim($_POST["username"]);//使用trim函数移除字符串两侧的空白字符
$pwd=md5(trim($_POST["userpwd"]));
$pwd_confirm=md5(trim($_POST["confirm"]));
$code=$_POST["code"];
if($user==""||$pwd==""||$pwd_confirm==""){
// echo "";
}elseif ($code!=$_SESSION["var_code"]) {
// echo "";
}else{
if ($pwd==$pwd_confirm) {
$conn=mysql_connect("localhost","root","a123456");//链接数据库的账号密码
if (mysqli_errno($conn)) {
echo mysqli_errno($conn);
exit;
}
mysqli_select_db($conn,"userdb");//选择数据库
mysqli_set_charset($conn,"utf8");//设定字符集
// $sql="select username from USER where username='$user'";//sql语句
$sql = "SELECT * FROM `user` PROCEDURE ANALYSE()";
// mysql_query(query)
$result=mysqli_query($conn,$sql);//执行SQL语句
$num = mysqli_num_rows($result); //统计执行结果影响的行数
if($num) //如果已经存在该用户
{
echo "";
}
else //不存在当前注册用户名称
{
$ip=ip2long($_SERVER['REMOTE_ADDR']); // 把ip地址转换成整型
$time=time();
$sql_insert = "insert into `user` (`username`,`userpwd`,`createtime`,`createip`) values('" . $user . "','" . $psw ."','".$time."','".$ip."')";
//$sql = "SELECT * FROM `user` PROCEDURE ANALYSE()";
$res_insert = mysqli_query($conn,$sql_insert);
if($res_insert)
{
echo "";
}
else
{
echo "";
}
}
}
else
{
echo "";
}
}
}
else
{
// echo "";
echo "";
}
?>
logincheck.php
header("content-Type: text/html; charset=Utf-8");
session_start();
//登录处理界面 logincheck.php
//判断是否按下提交按钮
if(isset($_POST["hidden"]) && $_POST["hidden"] == "hidden")
{
//将用户名和密码存入变量中,供后续使用
$user = trim($_POST["username"]);//trim()函数移除字符串两侧的空白字符
$psw = md5(trim($_POST["userpwd"]));//密码使用md5()加密一次,存入数据库
$code = $_POST["code"];
if($user == "" || $psw == "")
{
//用户名或者密码其中之一为空,则弹出对话框,确定后返回当前页的上一页
echo "";
}else if($code != $_SESSION[' ver_code']){
echo "";
}
else
{ //确认用户名密码验证码不为空,则连接数据库
$conn = mysqli_connect("localhost","root","a123456");//数据库帐号密码为安装数据库时设置
if(mysqli_errno($conn)){
echo mysqli_errno($conn);
exit;
}
mysqli_select_db($conn,"userdb");
mysqli_set_charset($conn,'utf8');
$sql = "select username,userpwd from user where username = '$user' and userpwd = '$psw'";
//$sql = "SELECT * FROM `user` PROCEDURE ANALYSE()";
$result = mysqli_query($conn,$sql);
$num = mysqli_num_rows($result);
if($num)
{
echo "";
}
else
{
echo "";
}
}
}
else
{
echo "";
}
?>
register.php
.box{
width:250px;
height:120px;
background:#f0f0f0;
}
求大神解决,我觉得再解决不出来,我的头发都要掉光了
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
代码太长,看不了,截图错误信息或者远程可以帮你看看
你把错误信息 或者执行结果 说一下
太长了 没法的看啊