<?php
include('connection.php');

$login=$_GET['login'];
//echo $login;

//$old_password=addslashes($_POST['old_password']);
$old_password=addslashes($_GET['old_password']);
//echo $old_password;

//$new_pass=addslashes($_POST['new_pass']);
$new_pass=addslashes($_GET['new_pass']);
//echo $new_pass;
//$new_pass1=addslashes($_POST['new_pass1']);
//$new_pass1=addslashes($_POST['new_pass1']);
$new_pass1=addslashes($_GET['new_pass1']);
//echo $new_pass1;


$encrypted_mypassword=md5($new_pass);
   
 
$sql=mysqli_query($GLOBALS["___mysqli_ston"], "SELECT * FROM login WHERE username='"  .  mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $_GET["login"])  .  "'");
//$sql="SELECT * FROM login WHERE username='$login'";
//echo $sql;
//$result=mysql_query($sql);
//while($row=mysql_fetch_array($result)) 
while($row=mysqli_fetch_array($sql)) 
{
	$user=$row['username'];

	$pass=$row['password'];

	 }

    	if(md5($old_password) == $pass && $new_pass == $new_pass1) 
    	{ 
    	//  $res = mysql_query("UPDATE login set password='$encrypted_mypassword' where username='$login'")or die('Query1 failed: ' . mysql_error());
    	  $res = mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE login set password='$encrypted_mypassword' where username='"  .  mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $_GET["login"])  .  "'")or die('Query1 failed: ' . mysqli_error($GLOBALS["___mysqli_ston"]));

 echo 1;
 
    	}
    	else 
    	{
   
    		}

  		 
?>
