View file newpass.php

File size: 962B
<?php

include 'include/head.php';

if(empty($name) or empty($pass))
{
echo 'Write name and password!';
echo '<meta http-equiv="refresh" content="2; url=login.php">';
exit;
}
if(empty($newpass))
{
echo 'Write new password!';
echo '<meta http-equiv="refresh" content="2; url=profile.php?pass='.$pass.'&name='.$name.'">';
}
else
{
if(file_exists("users/$name.class"))
{
$myFile = "users/$name.class";
$myPass = implode('', file($myFile));
if($myPass == "$pass")
{
$write = fopen("users/$name.class", "w");
fputs ($write,"$newpass");
fclose ($write);
echo 'Password changed!';
echo '<meta http-equiv="refresh" content="2; url=index.php?pass='.$newpass.'&name='.$name.'">';
}
else
{
echo 'Error in password!';
echo '<meta http-equiv="refresh" content="2; url=login.php">';
}

}
else
{
echo 'This user already exist!';
echo '<meta http-equiv="refresh" content="2; url=login.php">';  
}
}

include 'include/foot.php';

?>