示例#1
0
}
$stats = new stats($dbo);
$gift = new gift($dbo);
$page_id = "gifts";
$error = false;
$error_message = '';
if (isset($_GET['action'])) {
    $action = isset($_GET['action']) ? $_GET['action'] : '';
    $id = isset($_GET['id']) ? $_GET['id'] : 0;
    $action = helper::clearText($action);
    $action = helper::escapeText($action);
    $id = helper::clearInt($id);
    if (!APP_DEMO) {
        switch ($action) {
            case 'remove':
                $gift->db_remove($id);
                header("Location: /admin/gifts.php");
                break;
            default:
                header("Location: /admin/gifts.php");
                break;
        }
    }
}
if (!empty($_POST)) {
    $authToken = isset($_POST['authenticity_token']) ? $_POST['authenticity_token'] : '';
    $cost = isset($_POST['cost']) ? $_POST['cost'] : 3;
    $category = isset($_POST['category']) ? $_POST['category'] : 0;
    $cost = helper::clearInt($cost);
    $category = helper::clearInt($category);
    if ($authToken === helper::getAuthenticityToken() && !APP_DEMO) {