Задавайте вопросы, мы ответим
Вы не зашли.
Ошибка в SQL
Ответ от сервера MySQL: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
в /home/httpd/torrent.gres.net.ua/content/html/include/cleanup.php, линия 315
Запрос номер 25.
вот файл
<? /* // +--------------------------------------------------------------------------+ // | Project: CyBERhype Tracker | // +--------------------------------------------------------------------------+ // | This file is part of CyBERhype Tracker. | // | CyBERhype Tracker is based on TBDev, originally by RedBeard of | // | TorrentBits, extensively modified by Gartenzwerg. | // | | // | CyBERhype Tracker is free software; you can redistribute it and/or modify| // | it under the terms of the GNU General Public License as published by | // | the Free Software Foundation; either version 2 of the License, or | // | (at your option) any later version. | // | | // | CyBERhype Tracker is distributed in the hope that it will be useful, | // | but WITHOUT ANY WARRANTY; without even the implied warranty of | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | // | GNU General Public License for more details. | // | | // | You should have received a copy of the GNU General Public License along | // | with CyBERhype Tracker; if not, write to the Free Software Foundation, | // | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | // +--------------------------------------------------------------------------+ // | Do not remove above lines! | // +--------------------------------------------------------------------------+ */ # IMPORTANT: Do not edit below unless you know what you are doing! if (! defined ( 'IN_TRACKER' )) die ( 'Hacking attempt!' ); function docleanup() { global $torrent_dir, $del_inactive, $del_oldparked, $signup_timeout, $max_dead_torrent_time, $use_ttl, $autoclean_interval, $points_per_cleanup, $ttl_days, $tracker_lang, $rootpath, $CURGROUP, $deleteannounces, $chat_clear_mess, $chat_clear_time; @set_time_limit ( 0 ); @ignore_user_abort ( 1 ); // MULTITRACKER MOD /// global $refresh_atorrents, $refresh_announces; include $rootpath . 'include/functions_getpeers.php'; $res = sql_query ( "SELECT torrents.id, torrents.announce_list, torrents.info_hash, torrents.last_update FROM torrents WHERE torrents.last_update<=" . (time () - intval ( $refresh_announces )) . " AND torrents.announce_list IS NOT NULL ORDER BY torrents.last_update LIMIT " . intval ( $refresh_atorrents ) ) or sqlerr ( __FILE__, __LINE__ ); get_peers ( $res ); // MULTITRACKER MOD /// do { $res = sql_query ( "SELECT id, trailer FROM torrents" ) or sqlerr ( __FILE__, __LINE__ ); $ar = array (); $tr = array (); while ( $row = mysql_fetch_array ( $res ) ) { $id = $row [0]; $ar [$id] = 1; $tr [$id] = $row ['trailer']; } if (! count ( $ar )) break; $dp = @opendir ( $torrent_dir ); if (! $dp) break; $ar2 = array (); while ( ($file = readdir ( $dp )) !== false ) { if (! preg_match ( '/^(\d+)\.torrent$/', $file, $m )) continue; $id = $m [1]; $ar2 [$id] = 1; if (isset ( $ar [$id] ) && $ar [$id]) continue; $ff = $torrent_dir . "/$file"; unlink ( $ff ); } closedir ( $dp ); if (! count ( $ar2 )) break; $delids = array (); foreach ( array_keys ( $ar ) as $k ) { if (isset ( $ar2 [$k] ) && $ar2 [$k]) continue; if ($tr [$k] == 'no') { $delids [] = $k; unset ( $ar [$k] ); } } if (count ( $delids )) sql_query ( "DELETE FROM torrents WHERE id IN (" . join ( ",", $delids ) . ") AND trailer!='no'" ) or sqlerr ( __FILE__, __LINE__ ); $res = sql_query ( "SELECT torrent FROM peers GROUP BY torrent" ) or sqlerr ( __FILE__, __LINE__ ); $delids = array (); while ( $row = mysql_fetch_array ( $res ) ) { $id = $row [0]; if (isset ( $ar [$id] ) && $ar [$id]) continue; $delids [] = $id; } if (count ( $delids )) sql_query ( "DELETE FROM peers WHERE torrent IN (" . join ( ",", $delids ) . ")" ) or sqlerr ( __FILE__, __LINE__ ); $res = sql_query ( "SELECT torrent FROM files GROUP BY torrent" ) or sqlerr ( __FILE__, __LINE__ ); $delids = array (); while ( $row = mysql_fetch_array ( $res ) ) { $id = $row [0]; if ($ar [$id]) continue; $delids [] = $id; } if (count ( $delids )) sql_query ( "DELETE FROM files WHERE torrent IN (" . join ( ", ", $delids ) . ")" ) or sqlerr ( __FILE__, __LINE__ ); } while ( 0 ); $res = sql_query ( "SELECT * FROM lottery_config" ) or sqlerr ( __FILE__, __LINE__ ); while ( $arr = mysql_fetch_assoc ( $res ) ) $arr_config [$arr ['name']] = $arr ['value']; if ($arr_config ['enable'] == 1) { if (get_date_time () > $arr_config ['end_date']) { if ($arr_config ["ticket_amount_type"] == GB) $arr_config ['ticket_amount'] = 1024 * 1024 * 1024 * $arr_config ['ticket_amount']; else if ($arr_config ["ticket_amount_type"] == MB) $arr_config ['ticket_amount'] = 1024 * 1024 * $arr_config ['ticket_amount']; $size = $arr_config ['ticket_amount']; if ($arr_config ["ticket_amount_type"] == GB) $arr_config ['prize_fund'] = 1024 * 1024 * 1024 * $arr_config ['prize_fund']; else if ($arr_config ["ticket_amount_type"] == MB) $arr_config ['prize_fund'] = 1024 * 1024 * $arr_config ['prize_fund']; $prize_fund = $arr_config ['prize_fund']; $total = mysql_num_rows ( sql_query ( "SELECT * FROM tickets" ) ); if ($arr_config ["use_prize_fund"]) { $pot = $prize_fund / $arr_config ['total_winners']; $res = sql_query ( "SELECT user FROM tickets ORDER BY RAND() LIMIT $arr_config[total_winners]" ) or sqlerr ( __FILE__, __LINE__ ); $who_won = array (); $msg = sqlesc ( "Поздравляем, Вы выйграли: [b]" . mksize ( $pot ) . "[/b].\n\nЭта сумма будет добавлена к Вашей раздаче\n\nСпасибо за участие." ); while ( $arr = mysql_fetch_assoc ( $res ) ) { $res2 = sql_query ( "SELECT modcomment FROM users WHERE id = $arr[user]" ) or sqlerr ( __FILE__, __LINE__ ); $arr2 = mysql_fetch_assoc ( $res2 ); $modcomment = $arr2 ['modcomment']; $modcom = sqlesc ( "Выйграл в лотерею: " . mksize ( $pot ) . " от " . get_date_time () . "\n" . $modcomment ); sql_query ( "UPDATE users SET uploaded = uploaded + $pot, modcomment = $modcom WHERE id = $arr[user]" ) or sqlerr ( __FILE__, __LINE__ ); sql_query ( "INSERT INTO messages (sender, receiver, added, subject, msg, poster) VALUES(0, $arr[user], NOW(), 'Вы выйграли в лотерее', $msg, 0)" ) or sqlerr ( __FILE__, __LINE__ ); $who_won [] = $arr ['user']; } } else { $pot = $total * $size / $arr_config ['total_winners']; $res = sql_query ( "SELECT user FROM tickets ORDER BY RAND() LIMIT $arr_config[total_winners]" ) or sqlerr ( __FILE__, __LINE__ ); $who_won = array (); $msg = sqlesc ( "Поздравляем, Вы выйграли: [b]" . mksize ( $pot ) . "[/b].\n\nЭта сумма будет добавлена к Вашей раздаче\n\nСпасибо за участие." ); while ( $arr = mysql_fetch_assoc ( $res ) ) { $res2 = sql_query ( "SELECT modcomment FROM users WHERE id = $arr[user]" ) or sqlerr ( __FILE__, __LINE__ ); $arr2 = mysql_fetch_assoc ( $res2 ); $modcomment = $arr2 ['modcomment']; $modcom = sqlesc ( "Выйграл в лотерею: " . mksize ( $pot ) . " от " . get_date_time () . "\n" . $modcomment ); sql_query ( "UPDATE users SET uploaded = uploaded + $pot WHERE id = $arr[user]" ) or sqlerr ( __FILE__, __LINE__ ); sql_query ( "INSERT INTO messages (sender, receiver, added, subject, msg, poster) VALUES(0, $arr[user], NOW(), 'Вы выйграли в лотерее', $msg, 0)" ) or sqlerr ( __FILE__, __LINE__ ); $who_won [] = $arr ['user']; } } $who_won = implode ( "|", $who_won ); $who_won_date = get_date_time (); $who_won_prize = $pot; sql_query ( "TRUNCATE TABLE tickets" ) or sqlerr ( __FILE__, __LINE__ ); if ($who_won != '') { sql_query ( "UPDATE lottery_config SET value = '$who_won' WHERE name = 'lottery_winners'" ) or sqlerr ( __FILE__, __LINE__ ); sql_query ( "UPDATE lottery_config SET value = '$who_won_prize' WHERE name = 'lottery_winners_amount'" ) or sqlerr ( __FILE__, __LINE__ ); sql_query ( "UPDATE lottery_config SET value = '$who_won_date' WHERE name = 'lottery_winners_time'" ) or sqlerr ( __FILE__, __LINE__ ); } sql_query ( "UPDATE lottery_config SET value = '0' WHERE name = 'enable'" ) or sqlerr ( __FILE__, __LINE__ ); } } // END LOTTERY - THADON $deadtime = deadtime (); sql_query ( "DELETE FROM peers WHERE last_action < FROM_UNIXTIME($deadtime)" ) or sqlerr ( __FILE__, __LINE__ ); $deadtime = deadtime (); sql_query ( "UPDATE snatched SET seeder = 'no' WHERE seeder = 'yes' AND last_action < FROM_UNIXTIME($deadtime)" ) or sqlerr ( __FILE__, __LINE__ ); $deadtime -= $max_dead_torrent_time; sql_query ( "UPDATE torrents SET torrents.visible='no' WHERE torrents.visible='yes' AND torrents.last_action < FROM_UNIXTIME($deadtime) AND (SELECT SUM(left_peers.seeders) FROM left_peers WHERE left_peers.torrent_id = torrents.id) = 0" ) or sqlerr ( __FILE__, __LINE__ ); $torrents = array (); $res = sql_query ( "SELECT torrent, seeder, COUNT(*) AS c FROM peers GROUP BY torrent, seeder" ) or sqlerr ( __FILE__, __LINE__ ); while ( $row = mysql_fetch_assoc ( $res ) ) { if ($row ["seeder"] == "yes") $key = "seeders"; else $key = "leechers"; $torrents [$row ["torrent"]] [$key] = $row ["c"]; } $res = sql_query ( "SELECT torrent, COUNT(*) AS c FROM comments GROUP BY torrent" ) or sqlerr ( __FILE__, __LINE__ ); while ( $row = mysql_fetch_assoc ( $res ) ) { $torrents [$row ["torrent"]] ["comments"] = $row ["c"]; } $fields = explode ( ":", "comments:leechers:seeders" ); $res = sql_query ( "SELECT id, seeders, leechers, comments FROM torrents" ) or sqlerr ( __FILE__, __LINE__ ); while ( $row = mysql_fetch_assoc ( $res ) ) { $id = $row ["id"]; $torr = $torrents [$id]; foreach ( $fields as $field ) { if (! isset ( $torr [$field] )) $torr [$field] = 0; } $update = array (); foreach ( $fields as $field ) { if ($torr [$field] != $row [$field]) $update [] = "$field = " . $torr [$field]; } if (count ( $update )) sql_query ( "UPDATE torrents SET " . implode ( ", ", $update ) . " WHERE id = $id" ) or sqlerr ( __FILE__, __LINE__ ); } //delete default inactive user accounts if ($del_inactive) { $secs = $del_inactive * 86400; $dt = sqlesc ( get_date_time ( gmtime () - $secs ) ); $res = sql_query ( "SELECT u.id FROM users AS u LEFT JOIN groups AS g ON g.id=u.`group` WHERE u.parked='no' AND u.status='confirmed' AND g.default = 'yes' AND u.last_access < $dt AND u.last_access <> '0000-00-00 00:00:00'" ) or sqlerr ( __FILE__, __LINE__ ); while ( $arr = mysql_fetch_assoc ( $res ) ) { deleteuser ( $arr ["id"] ); //sql_query ( "DELETE FROM offervotes WHERE userid = " . sqlesc ( $arr ["id"] ) ) or sqlerr ( __FILE__, __LINE__ ); } } //delete default parked user accounts if ($del_oldparked) { $secs = $del_oldparked * 86400; // change the time to fit your needs $dt = sqlesc ( get_date_time ( gmtime () - $secs ) ); // FORUM INTEGRATION MOD // $res = sql_query ( "SELECT u.id, u.username FROM users AS u LEFT JOIN groups AS g ON g.id=u.`group` WHERE u.parked='yes' AND u.status='confirmed' AND g.default = 'yes' AND u.last_access < $dt" ) or sqlerr ( __FILE__, __LINE__ ); // FORUM INTEGRATION MOD // if (mysql_num_rows ( $res ) > 0) { while ( $arr = mysql_fetch_array ( $res ) ) { // FORUM INTEGRATION MOD // FORUM_deleteuser ( $arr ['username'] ); // FORUM INTEGRATION MOD // deleteuser ( $arr ["id"] ); //sql_query ( "DELETE FROM offervotes WHERE userid = " . sqlesc ( $arr ["id"] ) ) or sqlerr ( __FILE__, __LINE__ ); } } } // delete unconfirmed users if timeout. if ($signup_timeout) { $deadtime = time () - $signup_timeout; // FORUM INTEGRATION MOD // $res = sql_query ( "SELECT id, username FROM users WHERE status = 'pending' AND added < FROM_UNIXTIME($deadtime) AND last_login < FROM_UNIXTIME($deadtime) AND last_access < FROM_UNIXTIME($deadtime)" ) or sqlerr ( __FILE__, __LINE__ ); // FORUM INTEGRATION MOD // if (mysql_num_rows ( $res ) > 0) { while ( $arr = mysql_fetch_array ( $res ) ) { // FORUM INTEGRATION MOD // FORUM_deleteuser ( $arr ['username'] ); // FORUM INTEGRATION MOD // sql_query ( "DELETE FROM users WHERE id = " . sqlesc ( $arr ["id"] ) ) or sqlerr ( __FILE__, __LINE__ ); } } } // Update seed bonus sql_query ( "UPDATE users SET bonus = bonus + $points_per_cleanup WHERE users.id IN (SELECT userid FROM peers WHERE seeder = 'yes')" ) or sqlerr ( __FILE__, __LINE__ ); //remove expired warnings $now = sqlesc ( get_date_time () ); $modcomment = sqlesc ( date ( "Y-m-d" ) . " - Предупреждение снято системой по таймауту.\n" ); $msg = sqlesc ( "Ваше предупреждение снято по таймауту. Постарайтесь больше не получать предупреждений и сделовать правилам.\n" ); sql_query ( "INSERT INTO messages (sender, receiver, added, msg, poster) SELECT 0, id, $now, $msg, 0 FROM users WHERE warned='yes' AND warneduntil < NOW() AND warneduntil <> '0000-00-00 00:00:00'" ) or sqlerr ( __FILE__, __LINE__ ); sql_query ( "UPDATE users SET warned='no', warneduntil = '0000-00-00 00:00:00', modcomment = CONCAT($modcomment, modcomment) WHERE warned='yes' AND warneduntil < NOW() AND warneduntil <> '0000-00-00 00:00:00'" ) or sqlerr ( __FILE__, __LINE__ ); // delete old torrents if ($use_ttl) { $dt = sqlesc ( get_date_time ( gmtime () - ($ttl_days * 86400) ) ); $res = sql_query ( "SELECT id, name FROM torrents WHERE added < $dt" ) or sqlerr ( __FILE__, __LINE__ ); while ( $arr = mysql_fetch_assoc ( $res ) ) { deletetorrent ( $arr ['id'] ); write_log ( "Торрент $arr[id] ($arr[name]) был удален системой (старше чем $ttl_days дней)", "", "torrent" ); } } // delete old regimage codes $secs = 1 * 86400; $dt = time () - $secs; sql_query ( "DELETE FROM captcha WHERE dateline < $dt" ) or sqlerr ( __FILE__, __LINE__ ); $secs = 1 * 3600; $dt = time () - $secs; sql_query ( "DELETE FROM sessions WHERE time < $dt" ) or sqlerr ( __FILE__, __LINE__ ); global $ALLGROUPS; ///// MOD BAN //// // FORUM INTEGRATION MOD // $res1 = sql_query ( "SELECT downloaded, uploaded, dateban, id, `group`, enabled, username FROM users WHERE makeban='yes'" ) or sqlerr ( __FILE__, __LINE__ ); // FORUM INTEGRATION MOD // while ( $arras = mysql_fetch_assoc ( $res1 ) ) { if ($arras ["downloaded"] > 0) $ratia = $arras ['uploaded'] / $arras ['downloaded']; else { if ($arras ["uploaded"] > 0) $ratia = 100; else $ratia = 0; } if ((get_date_time () > $arras ["dateban"]) && $arras ["dateban"] != '0000-00-00' && ($ratia < 0.2) && $ALLGROUPS [$arras ['group']] ['can_bebanned'] && $arras ['enabled'] == 'yes') { sql_query ( "UPDATE users SET enabled = 'no' WHERE id = '$arras[id]'" ) or sqlerr ( __FILE__, __LINE__ ); // FORUM INTEGRATION MOD // FORUM_ban ( $arras ['username'] ); // FORUM INTEGRATION MOD // } elseif ($ratia >= 0.2) sql_query ( "UPDATE users SET makeban = 'no', warned = 'no', enabled='yes' WHERE id = '$arras[id]'" ) or sqlerr ( __FILE__, __LINE__ ); } //// MOD BAN ///// /// AUTO VIP DOWN /// global $ALLGROUPS; foreach ( $ALLGROUPS as $id => $group ) { if ($group ['price'] > 0) $grtosell [] = ( int ) $id; } // FORUM INTEGRATION MOD // $resass = sql_query ( "SELECT u.`vipdowngroup`, u.id, u.vipdowndate, u.group, u.username FROM users AS u WHERE u.`group` IN(" . implode ( ",", $grtosell ) . ")" ) or sqlerr ( __FILE__, __LINE__ ); // FORUM INTEGRATION MOD // while ( $arrass = mysql_fetch_assoc ( $resass ) ) { if (get_date_time () > $arrass ["vipdowndate"] && $arrass ["vipdowngroup"] >= 0 && $arrass ["vipdowndate"] != '0000-00-00' && $arrass [vipdowngroup] > $arrass [group]) { // FORUM INTEGRATION MOD // FORUM_setgroup ( $arras ['username'], $arrass ['vipdowngroup'] ); // FORUM INTEGRATION MOD // sql_query ( "UPDATE users SET `group` = '$arrass[vipdowngroup]', vipdowngroup = -1, vipdowndate='0000-00-00' WHERE id = '$arrass[id]'" ) or sqlerr ( __FILE__, __LINE__ ); } } /// AUTO VIP DOWN /// // GLOBAL FREEZE RATIO MOD // $frmod = sql_query ( 'SELECT id, nid, to_date FROM freezeratio' ) or sqlerr ( __FILE__, __LINE__ ); $now = date ( "Y-m-d" ); while ( $frrmod = mysql_fetch_array ( $frmod ) ) if ($frrmod ['to_date'] < $now) { sql_query ( 'DELETE FROM freezeratio WHERE id=' . intval ( $frrmod ['id'] ) ) or sqlerr ( __FILE__, __LINE__ ); sql_query ( 'DELETE FROM news WHERE id=' . intval ( $frrmod ['nid'] ) ) or sqlerr ( __FILE__, __LINE__ ); } // GLOBAL FREEZE RATIO MOD // //update_titles (); // Обновление званий $banres = sql_query ( 'SELECT uid, id, totime FROM bans WHERE uid>0 AND totime!=0' ) or sqlerr ( __FILE__, __LINE__ ); $now = date ( "Y-m-d H:i:s" ); while ( $banrow = mysql_fetch_array ( $banres ) ) if ($banrow ['totime'] <= $now && $banrow ['totime']) { sql_query ( 'DELETE FROM bans WHERE id=' . $banrow ['id'] ) or sqlerr ( __FILE__, __LINE__ ); sql_query ( "UPDATE users SET enabled='yes' WHERE id=" . $banrow ['uid'] ) or sqlerr ( __FILE__, __LINE__ ); write_log ( "Пользователь ID " . $banrow ['uid'] . " был разбанен по истечению срока блокировки", "", "bans" ); } /// Check NOT downloaded Torrents by owner users global $not_dtotime, $not_dwtotime; if ($not_dtotime) { $today = 60 * 60 * 24 * $not_dtotime; $date = sqlesc ( get_date_time ( time () - $today ) ); $res = sql_query ( "SELECT u.id, u.group, t.name, t.id AS tid, s.seeder AS sseeder, p.seeder AS pseeder FROM users AS u LEFT JOIN torrents AS t ON t.owner=u.id LEFT JOIN snatched AS s ON s.userid=u.id AND s.torrent=t.id LEFT JOIN peers AS p ON p.userid=u.id AND p.torrent=t.id WHERE t.added<$date AND u.warned='no' GROUP BY t.id, u.id" ) or sqlerr ( __FILE__, __LINE__ ); $uids = array (); $tids = array (); $tnames = array (); while ( $row = mysql_fetch_array ( $res ) ) { if ($ALLGROUPS [$row ['group']] ['can_bebanned'] && $row ['tid'] && $row ['sseeder'] != 'yes' && $row ['pseeder'] != 'yes') { $uids [] = ( int ) $row ['id']; $tids [] = ( int ) $row ['tid']; $tnames [] = $row ['name']; } } $today = 60 * 60 * 24 * $not_dwtotime; $newdate = get_date_time ( time () + $today ); if ($uids) { $values = array (); if ($not_dwtotime) sql_query ( "UPDATE users SET warned='yes', warneduntil = " . sqlesc ( $newdate ) . " WHERE id IN(" . implode ( ', ', $uids ) . ")" ) or sqlerr ( __FILE__, __LINE__ ); foreach ( $tids as $num => $id ) { $mess = sqlesc ( 'Вы должны раздавать свой торрент [url=details.php?id=' . $id . ']' . htmlspecialchars_uni ( $tnames [$num] ) . '[/url].' . ($not_dwtotime ? 'Вы были предупреждены на ' . $not_dwtotime . ' дней' : "") ); $subject = sqlesc ( 'Вы должны раздать свой торрент!' ); $values [] = '(' . $uids [$num] . ', ' . sqlesc ( get_date_time () ) . ', ' . $subject . ', ' . $mess . ')'; } sql_query ( "INSERT INTO messages (receiver, added, subject, msg) VALUES" . implode ( ', ', $values ) ) or sqlerr ( __FILE__, __LINE__ ); } } sql_query ( "UPDATE torrents SET seeders=(SELECT COUNT(*) FROM peers WHERE torrent = torrents.id AND seeder = 'yes')" ) or sqlerr ( __FILE__, __LINE__ ); sql_query ( "UPDATE torrents SET leechers=(SELECT COUNT(*) FROM peers WHERE torrent = torrents.id AND seeder = 'no')" ) or sqlerr ( __FILE__, __LINE__ ); /// Check NOT downloaded Torrents by owner users if ($deleteannounces) { $drop_announce = sqlesc ( get_date_time ( time () - ($deleteannounces * 60 * 60 * 24) ) ); $res = sql_query ( "SELECT id, image FROM announces WHERE added <= " . $drop_announce ); if (mysql_num_rows ( $res )) { $ids = array (); while ( list ( $id, $poster ) = mysql_fetch_array ( $res ) ) { $ids [] = $id; if (strpos ( $poster, "{dbu}" ) === 0) { $poster = substr ( $poster, strlen ( "{dbu}" ) ); if ($poster) unlink_image ( $poster, $torrent_dir . '/images/' ); } } if ($ids) { sql_query ( "DELETE FROM announces WHERE id IN (" . implode ( ', ', $ids ) . ')' ) or sqlerr ( __FILE__, __LINE__ ); sql_query ( "DELETE FROM ratings WHERE announce IN (" . implode ( ', ', $ids ) . ')' ) or sqlerr ( __FILE__, __LINE__ ); } } } if (intval ( $chat_clear_mess ) || intval ( $chat_clear_time )) { if (intval ( $chat_clear_time )) $time_clean = time () - $chat_clear_time * 60 * 60; $res = sql_query ( "SELECT date, (SELECT COUNT(*) FROM shoutbox) AS count FROM shoutbox ORDER BY date LIMIT 1" ); list ( $chat_date, $chat_count ) = mysql_fetch_array ( $res ); if (($chat_date <= $time_clean && $time_clean) || ($chat_clear_mess >= $chat_count && $chat_clear_mess)) sql_query ( "DELETE FROM shoutbox" ); } groups_autoupdate (); // Автоапдейт групп } ?>
Отредактированно seteviksis (10.04.2010 20:12:21)
Неактивен
В следующий раз вместо того чтобы вываливать целый файл, найдите 315-ю строку и запостите её одну.
На первый раз найду её за Вас. Там вот что:
$resass = sql_query ( "SELECT u.`vipdowngroup`, u.id, u.vipdowndate, u.group, u.username FROM users AS u WHERE u.`group` IN(" . implode ( ",", $grtosell ) . ")" ) or sqlerr ( __FILE__, __LINE__ );
На закрывающую скобку ругается, по всей видимости, из-за того, что массив $grtosell пустой.
Нужно выяснить, почему он пустой (судя по коду, пустым быть не должен) или исправить код так, чтобы работало и с пустым массивом.
Неактивен
Извиняюсь за строку!!!я просто новичек здесь!А как исправить код чтобы он работал с пустым масивом!Если не трудно помогите!Я не сильный знаток MySQL да и гугл уже весь облазил вот к вам попал!Теперь здесь буду чаще читать так как ваш сайт уже выручает 2 раз и огромное спасибо именно за русский ресурс.
Неактивен
Это уже вопрос не по MySQL, а по PHP и задавать его нужно на webew.ru/php/ (там ответят скорее и более квалифицированно).
Что касается ответа на ваш вопрос, то что-то типа
if (массив пустой){ $where = 0}
else{ $where = 'IN(" . implode ( ",", $grtosell ) . ")'}
$resass = sql_query ( "SELECT u.`vipdowngroup`, u.id, u.vipdowndate, u.group, u.username FROM users AS u WHERE u.`group` ".$where."" ) or sqlerr ( __FILE__, __LINE__ );
Неактивен
Скорее $where = '', а не $where = 0
Неактивен
LazY написал:
Скорее $where = '', а не $where = 0
Спасибо и за ето!!!будим дальше копать.
Неактивен