View file wu-engine/wu-actions/adm_user_edit_pass.php

File size: 804B
<?php
require_once('../wu_init.php');
if (!wu_token()) { exit('wu-error'); }
if (!USER_LOGGED) { exit('wu-error'); }
include('wu_checkadmin.php');

if(isset($_POST['usr']) && isset($_POST['pass'])){
if(!empty($_POST['usr']) && !empty($_POST['pass'])){

$usr = intval($_POST['usr']);
$pass = mysqli_real_escape_string($connect_db, trim($_POST['pass']));
if(strlen($pass) < '3'){ exit('3'); }
$now_pass = mysqli_fetch_assoc(mysqli_query($connect_db, "SELECT uid,pas,regdate FROM `".DB_PREFIX."_users` WHERE uid = '$usr' LIMIT 1"));
$newp = md5(md5(trim($now_pass['regdate'].'_'.$pass)));

if ($newp == $now_pass['pas']) { exit('2'); }
mysqli_query($connect_db, "UPDATE `".DB_PREFIX."_users` SET `pas` = '$newp' WHERE uid = '$usr' LIMIT 1");
exit('1');

} else { exit('0'); }
} else { exit('wu-error'); }
?>