error_die changes and various bug fixes to files

git-svn-id: file:///svn/phpbb/trunk@149 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2001-04-15 17:32:12 +00:00
parent cbafa0db4e
commit eecdd3049f
8 changed files with 43 additions and 49 deletions

View file

@ -48,7 +48,7 @@ $sql = "SELECT *
WHERE selected = 1"; WHERE selected = 1";
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
{ {
error_die($db, SQL_CONNECT); error_die(SQL_QUERY, "Could not query config information.", __LINE__, __FILE__);
} }
else else
{ {

View file

@ -57,8 +57,7 @@ $sql = "SELECT c.*
ORDER BY c.cat_order"; ORDER BY c.cat_order";
if(!$q_categories = $db->sql_query($sql)) if(!$q_categories = $db->sql_query($sql))
{ {
$db_error = $db->sql_error(); error_die(SQL_QUERY, "Could not query categories list.", __LINE__, __FILE__);
error_die($db, QUERY_ERROR, $db_error["message"]);
} }
$total_categories = $db->sql_numrows(); $total_categories = $db->sql_numrows();
@ -80,7 +79,7 @@ if($total_categories)
ORDER BY f.cat_id, f.forum_order"; ORDER BY f.cat_id, f.forum_order";
if(!$q_forums = $db->sql_query($sql)) if(!$q_forums = $db->sql_query($sql))
{ {
error_die($db, QUERY_ERROR); error_die(SQL_QUERY, "Could not query forums information.", __LINE__, __FILE__);
} }
$sql = "SELECT f.forum_id, u.username, u.user_id $sql = "SELECT f.forum_id, u.username, u.user_id
@ -90,7 +89,7 @@ if($total_categories)
ORDER BY f.forum_id"; ORDER BY f.forum_id";
if(!$q_forum_mods = $db->sql_query($sql)) if(!$q_forum_mods = $db->sql_query($sql))
{ {
error_die($db, QUERY_ERROR); error_die(SQL_QUERY, "Could not query forum moderator information.", __LINE__, __FILE__);
} }
$total_forums = $db->sql_numrows($q_forums); $total_forums = $db->sql_numrows($q_forums);
@ -105,10 +104,13 @@ if($total_categories)
for($i = 0; $i < $total_categories; $i++) for($i = 0; $i < $total_categories; $i++)
{ {
$template->assign_block_vars("catrow", array("CAT_ID" => $category_rows[$i]["cat_id"], $template->assign_block_vars("catrow",
"PHP_SELF" => $PHP_SELF, array("CAT_ID" => $category_rows[$i]["cat_id"],
"POST_FORUM_URL" => POST_FORUM_URL, "PHP_SELF" => $PHP_SELF,
"CAT_DESC" => stripslashes($category_rows[$i]["cat_title"]))); "POST_FORUM_URL" => POST_FORUM_URL,
"CAT_DESC" => stripslashes($category_rows[$i]["cat_title"])
)
);
for($j = 0; $j < $total_forums; $j++) for($j = 0; $j < $total_forums; $j++)
{ {
@ -176,7 +178,7 @@ if($total_categories)
}// if ... total_categories }// if ... total_categories
else else
{ {
error_die($db, GENERAL_ERROR, "There are no Categories or Foums on this board."); error_die(GENERAL_ERROR, "There are no Categories or Foums on this board.");
} }
$template->pparse("body"); $template->pparse("body");

View file

@ -46,7 +46,7 @@ if(isset($HTTP_POST_VARS['submit']) || isset($HTTP_GET_VARS['submit']))
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
if(!$result) if(!$result)
{ {
error_die($db, "Error in obtaining userdata : login"); error_die(SQL_QUERY, "Error in obtaining userdata : login", __LINE__, __FILE__);
} }
$rowresult = $db->sql_fetchrow($result); $rowresult = $db->sql_fetchrow($result);
@ -61,17 +61,17 @@ if(isset($HTTP_POST_VARS['submit']) || isset($HTTP_GET_VARS['submit']))
} }
else else
{ {
error_die($db, "Couldn't start session : login"); error_die(GENERAL_ERROR, "Couldn't start session : login", __LINE__, __FILE__);
} }
} }
else else
{ {
error_die($db, LOGIN_FAILED); error_die(LOGIN_FAILED);
} }
} }
else else
{ {
error_die($db, LOGIN_FAILED); error_die(LOGIN_FAILED);
} }
} }
else if($HTTP_GET_VARS['submit'] == "logout" && $userdata['session_logged_in']) else if($HTTP_GET_VARS['submit'] == "logout" && $userdata['session_logged_in'])

View file

@ -48,7 +48,7 @@ else
case 'newtopic': case 'newtopic':
if(!isset($forum_id)) if(!isset($forum_id))
{ {
error_die($db, GENERAL_ERROR, "Sorry, no there is no such forum"); error_die(GENERAL_ERROR, "Sorry, no there is no such forum");
} }
$pagetype = "newtopic"; $pagetype = "newtopic";
@ -56,7 +56,7 @@ else
$sql = "SELECT forum_name, forum_access FROM forums WHERE forum_id = '$forum_id'"; $sql = "SELECT forum_name, forum_access FROM forums WHERE forum_id = '$forum_id'";
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
{ {
error_die($db, QUERY_ERROR); error_die(SQL_QUERY, "Could not obtain forum/forum access information.", __LINE__, __FILE__);
} }
$forum_info = $db->sql_fetchrowset($result); $forum_info = $db->sql_fetchrowset($result);
$forum_name = stripslashes($forum_info[0]["forum_name"]); $forum_name = stripslashes($forum_info[0]["forum_name"]);

View file

@ -98,15 +98,7 @@ switch($mode)
} }
else else
{ {
if(DEBUG) error_die(SQL_QUERY, "Couldn't obtained next user_id information.", __LINE__, __FILE__);
{
$db_error = $db->sql_error();
error_die($db, GENERAL_ERROR, "Error getting next user ID.<br>Reason: ".$db_error["message"]."<br>Line: ".__LINE__."<br>File: ".__FILE__);
}
else
{
error_die($db, QUERY_ERROR);
}
} }
$md_pass = md5($password); $md_pass = md5($password);
@ -189,7 +181,7 @@ switch($mode)
{ {
mail($email, $l_welcomesubj, $email_msg, "From: $email_from\r\n"); mail($email, $l_welcomesubj, $email_msg, "From: $email_from\r\n");
} }
error_die($db, GENERAL_ERROR, $msg); error_die(GENERAL_ERROR, $msg);
} }
else else
{ {
@ -284,21 +276,21 @@ switch($mode)
$sql_update = "UPDATE ".USERS_TABLE." SET user_active = 1, user_actkey = '' WHERE user_id = ".$rowset[0]["user_id"]; $sql_update = "UPDATE ".USERS_TABLE." SET user_active = 1, user_actkey = '' WHERE user_id = ".$rowset[0]["user_id"];
if($result = $db->sql_query($sql_update)) if($result = $db->sql_query($sql_update))
{ {
error_die($db, GENERAL_ERROR, $l_nowactive); error_die(GENERAL_ERROR, $l_nowactive);
} }
else else
{ {
error_die($db, QUERY_ERROR); error_die(SQL_QUERY);
} }
} }
else else
{ {
error_die($db, GENERAL_ERROR, $l_wrongactiv); error_die(GENERAL_ERROR, $l_wrongactiv);
} }
} }
else else
{ {
error_die($db, QUERY_ERROR); error_die(SQL_QUERY);
} }
break; break;
} }

View file

@ -60,12 +60,12 @@ if(isset($forum_id))
} }
else else
{ {
error_die($db, "", "You have reached this page in error, please go back and try again"); error_die(GENERAL_ERROR, "You have reached this page in error, please go back and try again");
} }
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
{ {
error_die($db, QUERY_ERROR); error_die(SQL_QUERY, "Couldn't obtain forums information.", __LINE__, __FILE__);
} }
// //
@ -76,13 +76,13 @@ if(!$result = $db->sql_query($sql))
// If the query dosan't return any rows this isn't a valid forum. Inform the user. // If the query dosan't return any rows this isn't a valid forum. Inform the user.
if(!$total_rows = $db->sql_numrows($result)) if(!$total_rows = $db->sql_numrows($result))
{ {
error_die($db, "", "The forum you selected does not exist. Please go back and try again."); error_die(GENERAL_ERROR, "The forum you selected does not exist. Please go back and try again.");
} }
$forum_row = $db->sql_fetchrowset($result); $forum_row = $db->sql_fetchrowset($result);
if(!$forum_row) if(!$forum_row)
{ {
error_die($db, QUERY_ERROR); error_die(SQL_QUERY, "Couldn't obtain rowset.", __LINE__, __FILE__);
} }
$forum_name = stripslashes($forum_row[0]["forum_name"]); $forum_name = stripslashes($forum_row[0]["forum_name"]);
@ -112,7 +112,7 @@ $sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as i
LIMIT $start, $topics_per_page"; LIMIT $start, $topics_per_page";
if(!$t_result = $db->sql_query($sql)) if(!$t_result = $db->sql_query($sql))
{ {
error_die($db, QUERY_ERROR); error_die(SQL_QUERY, "Couldn't obtain topic information.", __LINE__, __FILE__);
} }
$total_topics = $db->sql_numrows(); $total_topics = $db->sql_numrows();
@ -188,7 +188,7 @@ if($total_topics)
} }
else else
{ {
$pagination .= " <a href=\"viewforum.$phpEx?forum_id=$forum_id&start=$x\">$count</a> "; $pagination .= " <a href=\"viewforum.$phpEx?".POST_FORUM_URL."=$forum_id&start=$x\">$count</a> ";
} }
$count++; $count++;
if(!($count % 20)) if(!($count % 20))
@ -203,9 +203,9 @@ if($total_topics)
} }
else else
{ {
error_die($db, NO_POSTS); error_die(NO_POSTS);
} }
include('includes/page_tail.'.$phpEx); include('includes/page_tail.'.$phpEx);
?> ?>

View file

@ -1,6 +1,6 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* index.php * viewonline.php
* ------------------- * -------------------
* begin : Saturday, Feb 13, 2001 * begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
@ -51,18 +51,18 @@ $sql = "SELECT u.username, u.user_id, f.forum_name, f.forum_id, s.session_page,
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
if(!$result) if(!$result)
{ {
error_die($db, QUERY_ERROR); error_die(SQL_QUERY, "Couldn't obtain user/online information.", __LINE__, __FILE__);
} }
$onlinerow = $db->sql_fetchrowset($result); $onlinerow = $db->sql_fetchrowset($result);
if(!$onlinerow) if(!$onlinerow)
{ {
error_die($db, QUERY_ERROR, "Couldn't fetchrow"); error_die(SQL_QUERY, "Couldn't fetchrow", __LINE__, __FILE__);
} }
$template->assign_vars(array( $template->assign_vars(array(
"PHP_SELF" => $PHP_SELF, "PHP_SELF" => $PHP_SELF,
"POST_FORUM_URL" => POST_FORUM_URL, "POST_FORUM_URL" => POST_FORUM_URL,
"POST_USER_URL" => POST_USER_URL, "POST_USER_URL" => POST_USERS_URL,
"L_WHOSONLINE" => $l_whosonline, "L_WHOSONLINE" => $l_whosonline,
"L_USERNAME" => $l_username, "L_USERNAME" => $l_username,
"L_LOCATION" => $l_location "L_LOCATION" => $l_location
@ -158,7 +158,7 @@ if($online_count)
} }
else else
{ {
error_die($db, GENERAL_ERROR, "There are no users currently browsing this forum"); error_die(GENERAL_ERROR, "There are no users currently browsing this forum");
} }
include('includes/page_tail.'.$phpEx); include('includes/page_tail.'.$phpEx);

View file

@ -37,7 +37,7 @@ $is_moderator = 0;
if(!isset($topic_id)) if(!isset($topic_id))
{ {
error_die($db, GENERAL_ERROR, "You have reached this page in error, please go back and try again"); error_die(GENERAL_ERROR, "You have reached this page in error, please go back and try again");
} }
$sql = "SELECT t.topic_title, t.topic_status, t.topic_replies, $sql = "SELECT t.topic_title, t.topic_status, t.topic_replies,
@ -50,11 +50,11 @@ $sql = "SELECT t.topic_title, t.topic_status, t.topic_replies,
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
{ {
error_die($db, QUERY_ERROR); error_die(SQL_QUERY, "Couldn't obtain topic information.", __LINE__, __FILE__);
} }
if(!$total_rows = $db->sql_numrows($result)) if(!$total_rows = $db->sql_numrows($result))
{ {
error_die($db, GENERAL_ERROR, "The forum you selected does not exist. Please go back and try again."); error_die(GENERAL_ERROR, "The forum you selected does not exist. Please go back and try again.");
} }
$forum_row = $db->sql_fetchrowset($result); $forum_row = $db->sql_fetchrowset($result);
$topic_title = $forum_row[0]["topic_title"]; $topic_title = $forum_row[0]["topic_title"];
@ -106,18 +106,18 @@ $sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website,
LIMIT $start, $posts_per_page"; LIMIT $start, $posts_per_page";
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
{ {
error_die($db, QUERY_ERROR); error_die(SQL_QUERY, "Couldn't obtain post/user information.", __LINE__, __FILE__);
} }
if(!$total_posts = $db->sql_numrows($result)) if(!$total_posts = $db->sql_numrows($result))
{ {
error_die($db, GENERAL_ERROR, "Error getting post data."); error_die(GENERAL_ERROR, "There don't appear to be any posts for this topic.", __LINE__, __FILE__);
} }
$sql = "SELECT * $sql = "SELECT *
FROM ".RANKS_TABLE." FROM ".RANKS_TABLE."
ORDER BY rank_min"; ORDER BY rank_min";
if(!$ranks_result = $db->sql_query($sql)) if(!$ranks_result = $db->sql_query($sql))
{ {
error_die($db, QUERY_ERROR); error_die(SQL_QUERY, "Couldn't obtain ranks information.", __LINE__, __FILE__);
} }
$postrow = $db->sql_fetchrowset($result); $postrow = $db->sql_fetchrowset($result);
$ranksrow = $db->sql_fetchrowset($ranksresult); $ranksrow = $db->sql_fetchrowset($ranksresult);