Jump to content

Recommended Posts

Hi guys can you all please help me. I am stuck with my script it keep inputting errors: Script below thanks

 

 


<?php  
session_start(); 
$password=$_GET['password']; 
include("phpfiles/maindb.php"); 
connect(); 
if(!isset($_POST['password'])){ 
$sql="select email from users where password='".$password."' and id=0"; 
$query = mysqli_query($maindb, $sql);
while($row = mysqli_fetch_array($query, MYSQLI_ASSOC)){
$email=$row['email']; 
   } 
If ($email!=''){ 
          $_SESSION['email']=$email; 
else die("Invalid link or Password already changed");} 
$password=$_POST['password']; 
$email=$_SESSION['email']; 
if(!isset($password)){ 
echo '<form method="post"> 
enter your new password:<input type="password" name="password" /> 
<a href="index.php><input type="submit" value="Change Password">Back</span></a>
</form>';} 
if(isset($_POST['password'])&&isset($_SESSION['email'])) 
$sql="update users set password='".md5($password)."' where email='".$email."'"; 
$query = mysqli_query($maindb, $sql);
if(mysqli_query($maindb, $sql), "update users set id=1 where password='".$password."'");
echo "Your password has been changed successfully"; 
if(!$query)echo "An error occurred"; 
    }
?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/280272-error-reporting/
Share on other sites

I didn't even try to diagnose the issue, but I can tell you that you should seriously scrap this whole thing and start over with something that is actually secure and built correctly.  You are totally wide open for sql injection and security is NONE in your case.  There are some good video tutorials on youtube from phpacademy and betterphp, I would suggest starting there.

Link to comment
https://forums.phpfreaks.com/topic/280272-error-reporting/#findComment-1441234
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.