function redeemed($code, $user) { if (!RedeemedCode::exists($code->id, $user->id)) { if ($code->item != "") { if ($code->item == "life") { $user->lives += $code->value; } else { if ($code->item == "bullet") { $user->bullets += $code->value; } else { if ($code->item == "coin") { $user->coins += $code->value; } else { if ($code->item == "shield") { $user->shields += $code->value; } else { if ($code->item == "slowmo") { $user->slowmos += $code->value; } } } } } } $user->update(); $redeemed_code = new RedeemedCode(); $redeemed_code->code_id = $code->id; $redeemed_code->user_id = $user->id; $redeemed_code->create(); return false; } else { return true; } }
} if ($what == "user") { foreach ($ids as $id) { User::get_by_id($id)->delete(); } $response = "success"; } else { if ($what == "code") { foreach ($ids as $id) { Code::get_by_id($id)->delete(); } $response = "success"; } else { if ($what == "redeemed_code") { foreach ($ids as $id) { RedeemedCode::get_by_id($id)->delete(); } $response = "success"; } else { if ($what == "log") { foreach ($ids as $id) { Logs::get_by_id($id)->delete(); } $response = "success"; } else { if ($what == "hit") { foreach ($ids as $id) { Hit::get_by_id($id)->delete(); } $response = "success"; }
if ($searchOper == 'eq') { $searchString = $searchString; } if ($searchOper == 'bw' || $searchOper == 'bn') { $searchString .= '%'; } if ($searchOper == 'ew' || $searchOper == 'en') { $searchString = '%' . $searchString; } if ($searchOper == 'cn' || $searchOper == 'nc' || $searchOper == 'in' || $searchOper == 'ni') { $searchString = '%' . $searchString . '%'; } $where = "{$searchField} {$ops} '{$searchString}'"; $redeemed_codes = RedeemedCode::get_by_sql("SELECT * FROM " . T_REDEEMED_CODES . " WHERE " . $where . " ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}"); } else { $redeemed_codes = RedeemedCode::get_by_sql("SELECT * FROM " . T_REDEEMED_CODES . " ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}"); } header("Content-type: text/xml;charset=utf-8"); $s = "<?xml version='1.0' encoding='utf-8'?>"; $s .= "<rows>"; $s .= "<page>" . $page . "</page>"; $s .= "<total>" . $total_pages . "</total>"; $s .= "<records>" . $count . "</records>"; foreach ($redeemed_codes as $redeemed_code) { $s .= "<row id='" . $redeemed_code->id . "'>"; $s .= "<cell></cell>"; $s .= "<cell>" . $redeemed_code->code_id . "</cell>"; $s .= "<cell>" . Code::get_by_id($redeemed_code->code_id)->code . "</cell>"; $s .= "<cell>" . Code::get_by_id($redeemed_code->code_id)->item . "</cell>"; $s .= "<cell>" . Code::get_by_id($redeemed_code->code_id)->value . "</cell>"; $s .= "<cell>" . Code::get_by_id($redeemed_code->code_id)->message . "</cell>";
<?php require_once "../../includes/initialize.php"; global $session; if (!$session->is_logged_in()) { redirect_to("../../index.php"); } if ($_POST['oper'] == 'add') { $redeemed_code = new RedeemedCode(); $redeemed_code->code_id = $_POST['code_id']; $redeemed_code->user_id = $_POST['user_id']; $redeemed_code->create(); } else { if ($_POST['oper'] == 'edit') { $redeemed_code = RedeemedCode::get_by_id($_POST['id']); $redeemed_code->code_id = $_POST['code_id']; $redeemed_code->user_id = $_POST['user_id']; $redeemed_code->update(); } else { if ($_POST['oper'] == 'del') { RedeemedCode::get_by_id($_POST['id'])->delete(); } } }