if (isset($_POST['kodas'])) {
$kodas = $_POST['kodas'];
$result = dbquery("SELECT user_id, user_name, fb_id, user_status, user_actiontime, user_password FROM ".DB_USERS." WHERE kodas='".$kodas."' LIMIT 1");
if (dbrows($result)) {
$data = dbarray($result);
$cookie_value = $data['user_id'].".".$data['user_password'];
if ($data['user_status'] == 1) {
redirect(BASEDIR."setuser.php?error=1&id=".$data['user_id'], true);
} elseif ($data['user_status'] == 2) {
redirect(BASEDIR."setuser.php?error=2", true);
} elseif ($data['user_status'] == 3) {
if ($data['user_actiontime'] < time()) {
require_once INCLUDES."suspend_include.php";
require_once INCLUDES."sendmail_include.php";
$_SESSION[COOKIE_PREFIX.'user_id'] = $data['user_id'];
$_SESSION[COOKIE_PREFIX.'user_pass'] = $data['user_password'];
$result = dbquery("UPDATE ".DB_USERS." SET user_status='0', user_actiontime='0' WHERE user_id='".$data['user_id']."'");
unsuspend_log($data['user_id'], 3, $locale['global_450'], true);
// Send mail
$subject = $locale['global_453'];
$message = str_replace("USER_NAME", $data['user_name'], $locale['global_452']);
sendemail($data['user_name'], $data['user_email'], $settings['siteusername'], $settings['siteemail'], $subject, $message);
// Send mail
redirect(BASEDIR."setuser.php?user=".$data['user_name'], true);
} else {
redirect(BASEDIR."setuser.php?error=3&id=".$data['user_id'], true);
}
} elseif ($data['user_status'] == 4) {
redirect(BASEDIR."setuser.php?error=4&id=".$data['user_id'], true);
} elseif ($data['user_status'] == 5) {
redirect(BASEDIR."setuser.php?error=5", true);
} elseif ($data['user_status'] == 6) {
redirect(BASEDIR."setuser.php?error=6", true);
} elseif ($data['user_status'] == 7) {
require_once INCLUDES."sendmail_include.php";
$_SESSION[COOKIE_PREFIX.'user_id'] = $data['user_id'];
$_SESSION[COOKIE_PREFIX.'user_pass'] = $data['user_password'];
$result = dbquery("UPDATE ".DB_USERS." SET user_status='0', user_actiontime='0' WHERE user_id='".$data['user_id']."'");
// Send mail
$subject = $locale['global_454'];
$message = str_replace("USER_NAME", $data['user_name'], $locale['global_455']);
sendemail($data['user_name'], $data['user_email'], $settings['siteusername'], $settings['siteemail'], $subject, $message);
// Send mail
redirect(BASEDIR."setuser.php?user=".$data['user_name'], true);
}
} else {
redirect(BASEDIR."setuser.php?error=8");
}
}