fucking sql query
This commit is contained in:
parent
b687eaad64
commit
cdbb724234
@ -8,7 +8,7 @@
|
||||
|
||||
session_start();
|
||||
require_once '../functions.php';
|
||||
|
||||
db::c()->prepare();
|
||||
if (empty($user['admin'])) {
|
||||
echo "<!DOCTYPE HTML><html><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL {$_SERVER['SCRIPT_NAME']} was not found on this server.</p><hr><address>Apache/2.2.22 (@RELEASE@) Server at Hetzner Datacenter 426</address></body></html>";
|
||||
exit;
|
||||
|
63
zayavka.php
63
zayavka.php
@ -53,6 +53,13 @@ class zayavka
|
||||
function getlist($razdel = 1, $level = null, $id = null)
|
||||
{
|
||||
/*
|
||||
* $level - заявки какого уровня мне показывать
|
||||
* $razdel - тип поединка
|
||||
* 1 - нубы
|
||||
* 2 - физы
|
||||
* 4 - группы
|
||||
* 5 - хаос
|
||||
*
|
||||
* if ($level AND $razdel==4 AND $id):
|
||||
* SELECT * FROM `zayavka` WHERE
|
||||
* (`t1min` <= {$level} OR `t1min` = 99) AND
|
||||
@ -75,19 +82,65 @@ class zayavka
|
||||
* (`t1max` >= {$level} OR `t1max` = 99) AND
|
||||
* `level` = {$razdel}
|
||||
*
|
||||
* if ($level AND $razdel==4 AND !$id):
|
||||
* SELECT * FROM `zayavka` WHERE
|
||||
* (`t1min` <= {$level} OR `t1min` = 99) AND
|
||||
* (`t1max` >= {$level} OR `t1max` = 99) AND
|
||||
* (`t2min` <= {$level} OR `t2min` = 99) AND
|
||||
* (`t2max` >= {$level} OR `t2max` = 99) AND
|
||||
* `level` = {$razdel}
|
||||
*
|
||||
* if (!$level AND $id):
|
||||
* SELECT * FROM `zayavka` WHERE
|
||||
* `level` = {$razdel}
|
||||
* `id` = {$id}
|
||||
*
|
||||
* if (!$level AND !$id):
|
||||
* SELECT * FROM `zayavka` WHERE
|
||||
* `level` = {$razdel}
|
||||
*
|
||||
* Пидорасы!
|
||||
*/
|
||||
$fict = mysql_query("SELECT * FROM `zayavka` WHERE " . (($level != null) ? " ((`t1min` <= '{$level}' OR `t1min` = '99') AND (`t1max` >= '{$level}' OR `t1max` = '99') " . (($razdel == 4) ? "AND (`t2min` <= '{$level}' OR `t2min` = '99') AND (`t2max` >= '{$level}' OR `t2max` = '99')" : "") . ") AND " : "") . " `level` = {$razdel} " . (($id != null) ? " AND `id` = {$id} " : "") . " ORDER BY `podan` DESC");
|
||||
while ($row = mysql_fetch_array($fict)) {
|
||||
|
||||
$sql = db::c()->prepare('SELECT * FROM `zayavka` WHERE `level` = ?i', $razdel);
|
||||
if (!is_null($level)) {
|
||||
$sql .= db::c()->prepare('AND (`t1min` <= ?i OR `t1min` = 99) AND (`t1max` >= ?i OR `t1max` = 99)', $level, $level);
|
||||
if (4 == $razdel) {
|
||||
$sql .= db::c()->prepare('AND (`t2min` <= ?i OR `t2min` = 99) AND (`t2max` >= ?i OR `t2max` = 99)', $level, $level);
|
||||
}
|
||||
}
|
||||
if (!is_null($id)) {
|
||||
$sql .= db::c()->prepare('AND `id` = ?i', $id);
|
||||
}
|
||||
|
||||
$fict = db::c()->query($sql);
|
||||
|
||||
// $fict = mysql_query("
|
||||
//SELECT * FROM `zayavka`
|
||||
//WHERE " .
|
||||
// (($level != null) ?
|
||||
// " ((`t1min` <= '{$level}' OR `t1min` = '99') AND (`t1max` >= '{$level}' OR `t1max` = '99') "
|
||||
// . (($razdel == 4) ?
|
||||
// "AND (`t2min` <= '{$level}' OR `t2min` = '99') AND (`t2max` >= '{$level}' OR `t2max` = '99')"
|
||||
// : "")
|
||||
// . ") AND "
|
||||
// : "")
|
||||
// . " `level` = {$razdel} "
|
||||
// . (($id != null) ?
|
||||
// " AND `id` = {$id} "
|
||||
// : "")
|
||||
// . " ORDER BY `podan` DESC");
|
||||
|
||||
while ($row = $fict->fetch_assoc()) {
|
||||
if (($row['start'] + 300) < time()) {
|
||||
if (mysql_query("DELETE FROM `zayavka` WHERE `id` = '{$row['id']}' LIMIT 1")) {
|
||||
if (db::c()->query('DELETE FROM `zayavka` WHERE `id` = ?i', $row['id'])) {
|
||||
$team1 = $this->fteam($row['team1']);
|
||||
foreach ($team1 as $k => $v) {
|
||||
mysql_query("UPDATE `users` SET `zayavka` = '0' WHERE `id` = {$v}");
|
||||
db::c()->query('UPDATE `users` SET `zayavka` = 0 WHERE `id` = ?i', $v);
|
||||
}
|
||||
$team2 = $this->fteam($row['team2']);
|
||||
foreach ($z[$zay]['team2'] as $k => $v) {
|
||||
mysql_query("UPDATE `users` SET `zayavka` = '0' WHERE `id` = {$v}");
|
||||
db::c()->query('UPDATE `users` SET `zayavka` = 0 WHERE `id` = ?i', $v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user