File size: 1.55Kb
<?php
require('../sys/set.php');
if($user['nick'] == 'Spider' || $user['nick']=='Test')
{
$smarty->assign('title','Error');
$smarty->assign('error','And why do it?');
$smarty->assign('back','index.php');
$smarty->display('header.tpl');
$smarty->display('error.tpl');
$smarty->display('footer.tpl');
}
if(!isset($_GET['edit'])){
$smarty->assign('title','Change Password');
$smarty->display('header.tpl');
$smarty->display('ank.pass.tpl');
$smarty->display('footer.tpl');
}else{
if(md5($_POST['old'])!=$user['pass']){
$err = 'Old password is not correct';}
if($_POST['new']!=$_POST['new1'] || empty($_POST['new'])){
$err = 'Passwords do not match';}
if(isset($err)){
$smarty->assign('title','Error');
$smarty->assign('error',$err);
$smarty->assign('back','editpass.php');
$smarty->display('header.tpl');
$smarty->display('error.tpl');
$smarty->display('footer.tpl');
}
if($sql->query('UPDATE `acc` SET `pass`="'.md5($_POST['new']).'"')){
setcookie('pmixl',$user['nick'].'||&'.$_POST['new'].'||&'.time());
$smarty->assign('title','Finish');
$smarty->assign('back','index.php');
$smarty->assign('ok','Password successfully changed');
$smarty->assign('nz','Personal Menu');
$smarty->display('header.tpl');
$smarty->display('ok.tpl');
$smarty->display('footer.tpl');
} else {
$smarty->assign('title','Error');
$smarty->assign('error','Contact the administrator');
$smarty->assign('back','index.php');
$smarty->display('header.tpl');
$smarty->display('error.tpl');
$smarty->display('footer.tpl');
}
}
?>