mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
Implement user defined table prefixes
git-svn-id: file:///svn/phpbb/trunk@19 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
22a1da47f3
commit
4317bbe9be
5 changed files with 73 additions and 73 deletions
|
@ -70,8 +70,8 @@ $dbuser = "imanidiot";
|
||||||
$dbpasswd = "imanidiotspassword";
|
$dbpasswd = "imanidiotspassword";
|
||||||
|
|
||||||
// DB table config
|
// DB table config
|
||||||
|
|
||||||
$banlist_table = "phpbb_banlist";
|
$banlist_table = "phpbb_banlist";
|
||||||
|
$categories_table = "phpbb_categories";
|
||||||
$config_table = "phpbb_config";
|
$config_table = "phpbb_config";
|
||||||
$disallow_table = "phpbb_disallow";
|
$disallow_table = "phpbb_disallow";
|
||||||
$forum_access_table = "phpbb_forum_access";
|
$forum_access_table = "phpbb_forum_access";
|
||||||
|
|
|
@ -39,7 +39,7 @@ switch($dbms)
|
||||||
|
|
||||||
// Make the database connection.
|
// Make the database connection.
|
||||||
$db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false);
|
$db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false);
|
||||||
if(!$db->db_connect_id)
|
if(!$db)
|
||||||
{
|
{
|
||||||
error_die($db, SQL_CONNECT);
|
error_die($db, SQL_CONNECT);
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ $logged_in = 0;
|
||||||
$userdata = Array();
|
$userdata = Array();
|
||||||
|
|
||||||
// Setup forum wide options.
|
// Setup forum wide options.
|
||||||
$sql = "SELECT * FROM config WHERE selected = 1";
|
$sql = "SELECT * FROM $config_table WHERE selected = 1";
|
||||||
if(!$result = $db->sql_query($sql))
|
if(!$result = $db->sql_query($sql))
|
||||||
{
|
{
|
||||||
error_die($db, QUERY_ERROR);
|
error_die($db, QUERY_ERROR);
|
||||||
|
|
|
@ -46,11 +46,11 @@ function auth($type,
|
||||||
switch($type)
|
switch($type)
|
||||||
{
|
{
|
||||||
case 'ip ban':
|
case 'ip ban':
|
||||||
$sql = "DELETE FROM banlist
|
$sql = "DELETE FROM $banlist_table
|
||||||
WHERE (ban_end < ". mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y")).")
|
WHERE (ban_end < ". mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y")).")
|
||||||
AND (ban_end > 0)";
|
AND (ban_end > 0)";
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
$sql = "SELECT ban_ip FROM banlist";
|
$sql = "SELECT ban_ip FROM $banlist_table";
|
||||||
if($result = $db->sql_query($sql))
|
if($result = $db->sql_query($sql))
|
||||||
{
|
{
|
||||||
if($totalrows = $db->sql_numrows())
|
if($totalrows = $db->sql_numrows())
|
||||||
|
@ -92,11 +92,11 @@ function auth($type,
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
break;
|
break;
|
||||||
case 'username ban':
|
case 'username ban':
|
||||||
$sql = "DELETE FROM banlist
|
$sql = "DELETE FROM $banlist_table
|
||||||
WHERE (ban_end < ". mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y")).")
|
WHERE (ban_end < ". mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y")).")
|
||||||
AND (ban_end > 0)";
|
AND (ban_end > 0)";
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
$sql = "SELECT ban_userid FROM banlist WHERE ban_userid = '$user_id'";
|
$sql = "SELECT ban_userid FROM $banlist_table WHERE ban_userid = '$user_id'";
|
||||||
if($result = $db->sql_query($sql))
|
if($result = $db->sql_query($sql))
|
||||||
{
|
{
|
||||||
if($db->sql_numrows())
|
if($db->sql_numrows())
|
||||||
|
@ -124,7 +124,7 @@ function auth($type,
|
||||||
function get_userdata_from_id($userid, $db)
|
function get_userdata_from_id($userid, $db)
|
||||||
{
|
{
|
||||||
|
|
||||||
$sql = "SELECT * FROM users WHERE user_id = $userid";
|
$sql = "SELECT * FROM $users_table WHERE user_id = $userid";
|
||||||
if(!$result = $db->sql_query($sql))
|
if(!$result = $db->sql_query($sql))
|
||||||
{
|
{
|
||||||
$userdata = array("error" => "1");
|
$userdata = array("error" => "1");
|
||||||
|
|
|
@ -38,7 +38,7 @@ function new_session($userid, $remote_ip, $lifespan, $db)
|
||||||
$currtime = (string) (time());
|
$currtime = (string) (time());
|
||||||
$expirytime = (string) (time() - $lifespan);
|
$expirytime = (string) (time() - $lifespan);
|
||||||
|
|
||||||
$deleteSQL = "DELETE FROM sessions WHERE (start_time < $expirytime)";
|
$deleteSQL = "DELETE FROM $sessions_tables WHERE (start_time < $expirytime)";
|
||||||
$delresult = $db->sql_query($deleteSQL);
|
$delresult = $db->sql_query($deleteSQL);
|
||||||
|
|
||||||
if (!$delresult)
|
if (!$delresult)
|
||||||
|
@ -46,7 +46,7 @@ function new_session($userid, $remote_ip, $lifespan, $db)
|
||||||
error_die($db, SESSION_CREATE);
|
error_die($db, SESSION_CREATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "INSERT INTO sessions (sess_id, user_id, start_time, remote_ip) VALUES ($sessid, $userid, $currtime, '$remote_ip')";
|
$sql = "INSERT INTO $sessions_table (sess_id, user_id, start_time, remote_ip) VALUES ($sessid, $userid, $currtime, '$remote_ip')";
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ function get_userid_from_session($sessid, $cookietime, $remote_ip, $db)
|
||||||
{
|
{
|
||||||
$mintime = time() - $cookietime;
|
$mintime = time() - $cookietime;
|
||||||
$sql = "SELECT user_id
|
$sql = "SELECT user_id
|
||||||
FROM sessions
|
FROM $sessions_table
|
||||||
WHERE (sess_id = $sessid)
|
WHERE (sess_id = $sessid)
|
||||||
AND (start_time > $mintime)
|
AND (start_time > $mintime)
|
||||||
AND (remote_ip = '$remote_ip')";
|
AND (remote_ip = '$remote_ip')";
|
||||||
|
@ -113,7 +113,7 @@ function update_session_time($sessid, $db)
|
||||||
{
|
{
|
||||||
|
|
||||||
$newtime = (string) time();
|
$newtime = (string) time();
|
||||||
$sql = "UPDATE sessions SET start_time=$newtime WHERE (sess_id = $sessid)";
|
$sql = "UPDATE $sessions_table SET start_time=$newtime WHERE (sess_id = $sessid)";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
{
|
{
|
||||||
|
@ -126,7 +126,7 @@ function update_session_time($sessid, $db)
|
||||||
|
|
||||||
function end_user_session($userid, $db)
|
function end_user_session($userid, $db)
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM sessions WHERE (user_id = $userid)";
|
$sql = "DELETE FROM $sessions_table WHERE (user_id = $userid)";
|
||||||
$result = $db->sql_query($sql, $db);
|
$result = $db->sql_query($sql, $db);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,7 +41,7 @@ include('page_header.'.$phpEx);
|
||||||
$template->set_block("body", "catrow", "cats");
|
$template->set_block("body", "catrow", "cats");
|
||||||
$template->set_block("catrow", "forumrow", "forums");
|
$template->set_block("catrow", "forumrow", "forums");
|
||||||
|
|
||||||
$sql = "SELECT * FROM catagories ORDER BY cat_order";
|
$sql = "SELECT * FROM $categories_table ORDER BY cat_order";
|
||||||
if(!$result = $db->sql_query($sql))
|
if(!$result = $db->sql_query($sql))
|
||||||
{
|
{
|
||||||
error_die($db, QUERY_ERROR);
|
error_die($db, QUERY_ERROR);
|
||||||
|
@ -57,7 +57,7 @@ if($total_rows)
|
||||||
"PHP_SELF" => $PHP_SELF,
|
"PHP_SELF" => $PHP_SELF,
|
||||||
"CAT_DESC" => stripslashes($rows[$x]["cat_title"])));
|
"CAT_DESC" => stripslashes($rows[$x]["cat_title"])));
|
||||||
|
|
||||||
$sub_sql = "SELECT f.* FROM forums f WHERE f.cat_id = '".$rows[$x]["cat_id"]."' ORDER BY forum_id";
|
$sub_sql = "SELECT f.* FROM $forums_table f WHERE f.cat_id = '".$rows[$x]["cat_id"]."' ORDER BY forum_id";
|
||||||
if(!$sub_result = $db->sql_query($sub_sql))
|
if(!$sub_result = $db->sql_query($sub_sql))
|
||||||
{
|
{
|
||||||
error_die($db, QUERY_ERROR);
|
error_die($db, QUERY_ERROR);
|
||||||
|
|
Loading…
Add table
Reference in a new issue