Файл: panel/balls.php
Строк: 32
<?php
/**
* @package Prime Social
* @link http://primesocial.ru
* @copyright Copyright (C) 2016 Prime Social
* @author BoB | http://primesocial.ru/about
*/
require_once('../core/start.php');
check_auth();
head('Ballarni aylantirish');
if (privilegy('balls') == FALSE) {
header("Location: ".HOME."/panel");
exit();
}
if ($_POST) {
$us = abs(num($_POST['user']));
$balls = abs(num($_POST['balls']));
if (empty($us) || empty($balls)) {
$err .= 'Hamma maydonchalarni to`ldiring<br />';
}
$ank = DB::$dbs->queryFetch("SELECT `user_id`, `balls` FROM ".USERS." WHERE `user_id` = ?",array($us));
if (empty($ank)) {
$err .= 'Ma`lumotlar bazasida foydalanuvchi topilmadi<br />';
}
if (empty($err)) {
DB::$dbs->query("UPDATE ".USERS." SET `balls` = ? WHERE `user_id` = ?",array( ($ank['balls'] + $balls), $ank['user_id'] ));
echo DIV_MSG . 'Ballar muvaffaqiyatli yangilandi' . CLOSE_DIV;
} else {
echo DIV_ERROR . $err . CLOSE_DIV;
}
}
echo DIV_BLOCK;
echo '<form action="#" method="POST">';
echo 'Foydalanuvchi: [ID]<br /><input type="text" name="user" /><br />';
echo 'Ballar:<br /><input type="text" name="balls" /><br />';
echo '<input type="submit" value="Aylantirish" /></form>';
echo CLOSE_DIV;
echo DIV_GO . '<a href="'.HOME.'/">Bosh sahifa</a> / <a href="'.HOME.'/panel">Boshqaruv paneli</a> / <b>Ballarni aylantirish</b>' . CLOSE_DIV;
require_once('../core/stop.php');
?>