<?php require_once('includes/requirepost.inc.php'); require_once('includes/validation.inc.php'); $info=array( 'login'=>TPOST('login'), 'email'=>TPOST('email'), 'passwd'=>TPOST('passwd'), 'passwd_again'=>TPOST('passwd_again'), 'authcode'=>TPOST('authcode') ); if (count_true_entries($info)<4) header("Location: ./password.reset?authcode=".urlencode($info['authcode'])."&op=fail"); else if ($info['passwd']!=$info['passwd_again']) header("Location: ./password.reset?authcode=".urlencode($info['authcode'])."&op=fail.pswddiff"); else { $DBConn->connect(); $emaillist=db_load_email_with_login($DBConn,$info['email'],$info['login']); $vcinfo=unserialize(base64_decode($info['authcode'])); if ($emaillist && validation_use_code($DBConn,$vcinfo['vc_id'],$email.' '.$login,$vcinfo['vc_seed'])) { db_update_password($DBConn,$emaillist[0]['mb_id'],password_hash($info['passwd'])); logout(); header("Location: ./password.reset.done"); } else header("Location: ./password.reset?authcode=".urlencode($info['authcode'])."&op=fail"); } ?>