mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
remove all 'or die(mysql_errno())'
This commit is contained in:
@@ -967,6 +967,9 @@ function docleanup($forceAll = 0, $printProgress = false) {
|
|||||||
}
|
}
|
||||||
$log = 'Full cleanup is done';
|
$log = 'Full cleanup is done';
|
||||||
do_log($log);
|
do_log($log);
|
||||||
|
if ($printProgress) {
|
||||||
|
printProgress($log);
|
||||||
|
}
|
||||||
return $log;
|
return $log;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -35,20 +35,20 @@ function get_langfile_path($script_name ="", $target = false, $lang_folder = "")
|
|||||||
function get_row_count($table, $suffix = "")
|
function get_row_count($table, $suffix = "")
|
||||||
{
|
{
|
||||||
$r = sql_query("SELECT COUNT(*) FROM $table $suffix") or sqlerr(__FILE__, __LINE__);
|
$r = sql_query("SELECT COUNT(*) FROM $table $suffix") or sqlerr(__FILE__, __LINE__);
|
||||||
$a = mysql_fetch_row($r) or die(mysql_error());
|
$a = mysql_fetch_row($r);
|
||||||
return $a[0];
|
return $a[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_row_sum($table, $field, $suffix = "")
|
function get_row_sum($table, $field, $suffix = "")
|
||||||
{
|
{
|
||||||
$r = sql_query("SELECT SUM($field) FROM $table $suffix") or sqlerr(__FILE__, __LINE__);
|
$r = sql_query("SELECT SUM($field) FROM $table $suffix") or sqlerr(__FILE__, __LINE__);
|
||||||
$a = mysql_fetch_row($r) or die(mysql_error());
|
$a = mysql_fetch_row($r);
|
||||||
return $a[0];
|
return $a[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_single_value($table, $field, $suffix = ""){
|
function get_single_value($table, $field, $suffix = ""){
|
||||||
$r = sql_query("SELECT $field FROM $table $suffix LIMIT 1") or sqlerr(__FILE__, __LINE__);
|
$r = sql_query("SELECT $field FROM $table $suffix LIMIT 1") or sqlerr(__FILE__, __LINE__);
|
||||||
$a = mysql_fetch_row($r) or die(mysql_error());
|
$a = mysql_fetch_row($r);
|
||||||
if ($a) {
|
if ($a) {
|
||||||
return $a[0];
|
return $a[0];
|
||||||
} else {
|
} else {
|
||||||
@@ -1578,7 +1578,7 @@ function image_code () {
|
|||||||
$imagehash = md5($randomstr);
|
$imagehash = md5($randomstr);
|
||||||
$dateline = time();
|
$dateline = time();
|
||||||
$sql = 'INSERT INTO `regimages` (`imagehash`, `imagestring`, `dateline`) VALUES (\''.$imagehash.'\', \''.$randomstr.'\', \''.$dateline.'\');';
|
$sql = 'INSERT INTO `regimages` (`imagehash`, `imagestring`, `dateline`) VALUES (\''.$imagehash.'\', \''.$randomstr.'\', \''.$dateline.'\');';
|
||||||
sql_query($sql) or die(mysql_error());
|
sql_query($sql);
|
||||||
return $imagehash;
|
return $imagehash;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1877,7 +1877,7 @@ function userlogin() {
|
|||||||
}
|
}
|
||||||
if (!$row["passkey"]){
|
if (!$row["passkey"]){
|
||||||
$passkey = md5($row['username'].date("Y-m-d H:i:s").$row['passhash']);
|
$passkey = md5($row['username'].date("Y-m-d H:i:s").$row['passhash']);
|
||||||
sql_query("UPDATE users SET passkey = ".sqlesc($passkey)." WHERE id=" . sqlesc($row["id"]));// or die(mysql_error());
|
sql_query("UPDATE users SET passkey = ".sqlesc($passkey)." WHERE id=" . sqlesc($row["id"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
$oldip = $row['ip'];
|
$oldip = $row['ip'];
|
||||||
@@ -2260,8 +2260,8 @@ function get_style_highlight()
|
|||||||
}
|
}
|
||||||
if (!$hltr)
|
if (!$hltr)
|
||||||
{
|
{
|
||||||
$r = sql_query("SELECT hltr FROM stylesheets WHERE id=5") or die(mysql_error());
|
$r = sql_query("SELECT hltr FROM stylesheets WHERE id=5");
|
||||||
$a = mysql_fetch_array($r) or die(mysql_error());
|
$a = mysql_fetch_array($r);
|
||||||
$hltr = $a["hltr"];
|
$hltr = $a["hltr"];
|
||||||
}
|
}
|
||||||
return $hltr;
|
return $hltr;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ if (get_user_class() >= UC_MODERATOR)
|
|||||||
stderr("Warning", "Unable to unlink file: <b>{$a['name']}</b>. You should contact an administrator about this error.",false);
|
stderr("Warning", "Unable to unlink file: <b>{$a['name']}</b>. You should contact an administrator about this error.",false);
|
||||||
} } } }
|
} } } }
|
||||||
stdhead("BitBucket Log");
|
stdhead("BitBucket Log");
|
||||||
$res = sql_query("SELECT count(*) FROM bitbucket") or die(mysql_error()); $row = mysql_fetch_array($res); $count = $row[0];
|
$res = sql_query("SELECT count(*) FROM bitbucket"); $row = mysql_fetch_array($res); $count = $row[0];
|
||||||
$perpage = 10;
|
$perpage = 10;
|
||||||
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, $_SERVER["PHP_SELF"] . "?out=" . ($_GET["out"] ?? '') . "&" );
|
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, $_SERVER["PHP_SELF"] . "?out=" . ($_GET["out"] ?? '') . "&" );
|
||||||
print("<h1>BitBucket Log</h1>\n");
|
print("<h1>BitBucket Log</h1>\n");
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ parked();
|
|||||||
if ($replyto && !is_valid_id($replyto))
|
if ($replyto && !is_valid_id($replyto))
|
||||||
stderr($lang_sendmessage['std_error'],$lang_sendmessage['std_permission_denied']);
|
stderr($lang_sendmessage['std_error'],$lang_sendmessage['std_permission_denied']);
|
||||||
|
|
||||||
$res = sql_query("SELECT * FROM users WHERE id=$receiver") or die(mysql_error());
|
$res = sql_query("SELECT * FROM users WHERE id=$receiver");
|
||||||
$user = mysql_fetch_assoc($res);
|
$user = mysql_fetch_assoc($res);
|
||||||
if (!$user)
|
if (!$user)
|
||||||
stderr($lang_sendmessage['std_error'],$lang_sendmessage['std_no_user_id']);
|
stderr($lang_sendmessage['std_error'],$lang_sendmessage['std_no_user_id']);
|
||||||
|
|||||||
+2
-2
@@ -130,13 +130,13 @@ if ($action == "answermessage") {
|
|||||||
|
|
||||||
int_check($receiver,true);
|
int_check($receiver,true);
|
||||||
|
|
||||||
$res = sql_query("SELECT * FROM users WHERE id=" . sqlesc($receiver)) or die(mysql_error());
|
$res = sql_query("SELECT * FROM users WHERE id=" . sqlesc($receiver));
|
||||||
$user = mysql_fetch_assoc($res);
|
$user = mysql_fetch_assoc($res);
|
||||||
|
|
||||||
if (!$user)
|
if (!$user)
|
||||||
stderr($lang_staffbox['std_error'], $lang_staffbox['std_no_user_id']);
|
stderr($lang_staffbox['std_error'], $lang_staffbox['std_no_user_id']);
|
||||||
|
|
||||||
$res2 = sql_query("SELECT * FROM staffmessages WHERE id=" . sqlesc($answeringto)) or die(mysql_error());
|
$res2 = sql_query("SELECT * FROM staffmessages WHERE id=" . sqlesc($answeringto));
|
||||||
$staffmsg = mysql_fetch_assoc($res2);
|
$staffmsg = mysql_fetch_assoc($res2);
|
||||||
stdhead($lang_staffbox['head_answer_to_staff_pm']);
|
stdhead($lang_staffbox['head_answer_to_staff_pm']);
|
||||||
begin_main_frame();
|
begin_main_frame();
|
||||||
|
|||||||
@@ -33,10 +33,10 @@ if(!$body)
|
|||||||
|
|
||||||
|
|
||||||
// check if email addy is already in use
|
// check if email addy is already in use
|
||||||
$a = (@mysql_fetch_row(@sql_query("select count(*) from users where email=".sqlesc($email)))) or die(mysql_error());
|
$a = (@mysql_fetch_row(@sql_query("select count(*) from users where email=".sqlesc($email))));
|
||||||
if ($a[0] != 0)
|
if ($a[0] != 0)
|
||||||
bark($lang_takeinvite['std_email_address'].htmlspecialchars($email).$lang_takeinvite['std_is_in_use']);
|
bark($lang_takeinvite['std_email_address'].htmlspecialchars($email).$lang_takeinvite['std_is_in_use']);
|
||||||
$b = (@mysql_fetch_row(@sql_query("select count(*) from invites where invitee=".sqlesc($email)))) or die(mysql_error());
|
$b = (@mysql_fetch_row(@sql_query("select count(*) from invites where invitee=".sqlesc($email))));
|
||||||
if ($b[0] != 0)
|
if ($b[0] != 0)
|
||||||
bark($lang_takeinvite['std_invitation_already_sent_to'].htmlspecialchars($email).$lang_takeinvite['std_await_user_registeration']);
|
bark($lang_takeinvite['std_invitation_already_sent_to'].htmlspecialchars($email).$lang_takeinvite['std_await_user_registeration']);
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ get_where("audiocodecs", "audiocodec", "aud");
|
|||||||
if ($where)
|
if ($where)
|
||||||
$where = "WHERE ".$where;
|
$where = "WHERE ".$where;
|
||||||
$query = "SELECT torrents.id, torrents.category, torrents.name, torrents.small_descr, torrents.descr, torrents.info_hash, torrents.size, torrents.added, torrents.anonymous, users.username AS username, categories.id AS cat_id, categories.name AS cat_name FROM torrents LEFT JOIN categories ON category = categories.id LEFT JOIN users ON torrents.owner = users.id $where ORDER BY torrents.added DESC LIMIT $limit";
|
$query = "SELECT torrents.id, torrents.category, torrents.name, torrents.small_descr, torrents.descr, torrents.info_hash, torrents.size, torrents.added, torrents.anonymous, users.username AS username, categories.id AS cat_id, categories.name AS cat_name FROM torrents LEFT JOIN categories ON category = categories.id LEFT JOIN users ON torrents.owner = users.id $where ORDER BY torrents.added DESC LIMIT $limit";
|
||||||
$res = sql_query($query) or die(mysql_error());
|
$res = sql_query($query);
|
||||||
$torrentRep = new \App\Repositories\TorrentRepository();
|
$torrentRep = new \App\Repositories\TorrentRepository();
|
||||||
$url = get_protocol_prefix().$BASEURL;
|
$url = get_protocol_prefix().$BASEURL;
|
||||||
$year = substr($datefounded, 0, 4);
|
$year = substr($datefounded, 0, 4);
|
||||||
|
|||||||
+2
-2
@@ -834,7 +834,7 @@ else
|
|||||||
$sql = "SELECT COUNT(*), categories.mode FROM torrents LEFT JOIN categories ON category = categories.id " . ($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "") . $where." GROUP BY categories.mode";
|
$sql = "SELECT COUNT(*), categories.mode FROM torrents LEFT JOIN categories ON category = categories.id " . ($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "") . $where." GROUP BY categories.mode";
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = sql_query($sql) or die(mysql_error());
|
$res = sql_query($sql);
|
||||||
$count = 0;
|
$count = 0;
|
||||||
while($row = mysql_fetch_array($res))
|
while($row = mysql_fetch_array($res))
|
||||||
$count += $row[0];
|
$count += $row[0];
|
||||||
@@ -877,7 +877,7 @@ else{
|
|||||||
$query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp,torrents.pt_gen,tags FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." LEFT JOIN categories ON torrents.category=categories.id $where $orderby $limit";
|
$query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp,torrents.pt_gen,tags FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." LEFT JOIN categories ON torrents.category=categories.id $where $orderby $limit";
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = sql_query($query) or die(mysql_error());
|
$res = sql_query($query);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
unset($res);
|
unset($res);
|
||||||
|
|||||||
Reference in New Issue
Block a user