Php和mysql登录脚本无法正常工作 [英] Php and mysql login script not working as it should work

查看:84
本文介绍了Php和mysql登录脚本无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我的PHP脚本有一个大问题,我在php和mysql中进行简单的登录/注册。

一切正常,除了在登录页面,它登录任何电子邮件甚至未注册...





Hello,
I have a big problem with my php script, i am making a simple login/register in php and mysql.
Everything works fine except that in the login page it logins any email even unregistered...


include("connect.php");
include("functions.php");


$error = "";
 if(isset($_POST['submit'])) //this line means that if the submit button is pressed do the following code.
 {

     $email = mysqli_real_escape_string($con,$_POST['email']);
     $password = mysqli_real_escape_string($con,$_POST['password']);

     if(email_exists($email,$con))
     {
         $result=mysqli_query($con,"SELECT password FROM users WHERE email='$email'");
         $retrievePassword=mysqli_fetch_assoc($result);

         if(md5($password)!==$retrievePassword['password'])
         {
             $error="Password is inccorect";
         }
     }
     else
     {
         $_SESSION['email']=$email;
         header("location: profile.php");
     }
}
?>





我尝试了什么:



我在其他网站上提出了问题,我甚至下载了一些脚本,看看哪里出错了但是我找不到任何东西



What I have tried:

I have asked questions in other websites and i even downloaded some scripts to see whats wrong but i cant find anything

推荐答案

错误 = ;
if(isset(
error = ""; if(isset(


_POST [' submit'])) // 此行表示如果按下提交按钮,请执行以下代码。
{

_POST['submit'])) //this line means that if the submit button is pressed do the following code. {


email = mysqli_real_escape_string(
email = mysqli_real_escape_string(


这篇关于Php和mysql登录脚本无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆