aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/install/update_script.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2002-07-16 13:00:11 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2002-07-16 13:00:11 +0000
commitfcef615972b3ec3ea64cc9d2016e8281766c8e45 (patch)
tree33c24098541e3080331b9b40f86f911997b72070 /phpBB/install/update_script.php
parent87c864b6e0f42f9d02ddc95fa9274f48c5780cd3 (diff)
downloadforums-fcef615972b3ec3ea64cc9d2016e8281766c8e45.tar
forums-fcef615972b3ec3ea64cc9d2016e8281766c8e45.tar.gz
forums-fcef615972b3ec3ea64cc9d2016e8281766c8e45.tar.bz2
forums-fcef615972b3ec3ea64cc9d2016e8281766c8e45.tar.xz
forums-fcef615972b3ec3ea64cc9d2016e8281766c8e45.zip
Alter SQL for decoding IPs as suggested by Josh (area51 post)
git-svn-id: file:///svn/phpbb/trunk@2695 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/install/update_script.php')
-rw-r--r--phpBB/install/update_script.php66
1 files changed, 15 insertions, 51 deletions
diff --git a/phpBB/install/update_script.php b/phpBB/install/update_script.php
index 67c446b66e..1a6b316766 100644
--- a/phpBB/install/update_script.php
+++ b/phpBB/install/update_script.php
@@ -138,10 +138,7 @@ if ( $row = $db->sql_fetchrow($result) )
{
for($i = 0; $i < count($sql); $i++)
{
- if ( !$db->sql_query($sql[$i]) )
- {
- die("Couldn't run update >> " . $sql[$i]);
- }
+ $db->sql_query($sql[$i]);
}
}
@@ -153,10 +150,7 @@ if ( $row = $db->sql_fetchrow($result) )
$sql = "SELECT ban_id, ban_ip
FROM " . BANLIST_TABLE;
- if ( !($result = $db->sql_query($sql)) )
- {
- die("Couldn't select data >> " . $sql);
- }
+ $result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
@@ -170,12 +164,10 @@ if ( $row = $db->sql_fetchrow($result) )
while ( $row = $db->sql_fetchrow($result) );
}
- $sql = "SELECT post_id, poster_ip
- FROM " . POSTS_TABLE;
- if ( !($result = $db->sql_query($sql)) )
- {
- die("Couldn't select data >> " . $sql);
- }
+ $sql = "SELECT DISTINCT poster_ip
+ FROM " . POSTS_TABLE . "
+ WHERE poster_ip NOT LIKE '%.%'";
+ $result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
@@ -183,17 +175,14 @@ if ( $row = $db->sql_fetchrow($result) )
{
$sql_update[] = "UPDATE " . POSTS_TABLE . "
SET poster_ip = '" . decode_ip($row['poster_ip']) . "'
- WHERE post_id = " . $row['post_id'];
+ WHERE poster_ip LIKE '" . $row['poster_ip'] . "'";
}
while ( $row = $db->sql_fetchrow($result) );
}
- $sql = "SELECT privmsgs_id, privmsgs_ip
+ $sql = "SELECT DISTINCT privmsgs_ip
FROM " . PRIVMSGS_TABLE;
- if ( !($result = $db->sql_query($sql)) )
- {
- die("Couldn't select data >> " . $sql);
- }
+ $result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
@@ -201,35 +190,14 @@ if ( $row = $db->sql_fetchrow($result) )
{
$sql_update[] = "UPDATE " . PRIVMSGS_TABLE . "
SET privmsgs_ip = '" . decode_ip($row['privmsgs_ip']) . "'
- WHERE privmsgs_id = " . $row['privmsgs_id'];
- }
- while ( $row = $db->sql_fetchrow($result) );
- }
-
- $sql = "SELECT session_id, session_ip
- FROM " . SESSIONS_TABLE;
- if ( !($result = $db->sql_query($sql)) )
- {
- die("Couldn't select data >> " . $sql);
- }
-
- if ( $row = $db->sql_fetchrow($result) )
- {
- do
- {
- $sql_update[] = "UPDATE " . SESSIONS_TABLE . "
- SET session_ip = '" . decode_ip($row['session_ip']) . "'
- WHERE session_id = '" . $row['session_id'] . "'";
+ WHERE privmsgs_ip LIKE '" . $row['privmsgs_ip'] . "'";
}
while ( $row = $db->sql_fetchrow($result) );
}
- $sql = "SELECT vote_id, vote_user_id, vote_user_ip
+ $sql = "SELECT DISTINCT vote_user_ip
FROM " . VOTE_USERS_TABLE;
- if ( !($result = $db->sql_query($sql)) )
- {
- die("Couldn't select data >> " . $sql);
- }
+ $result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
@@ -237,8 +205,7 @@ if ( $row = $db->sql_fetchrow($result) )
{
$sql_update[] = "UPDATE " . VOTE_USERS_TABLE . "
SET vote_user_ip = '" . decode_ip($row['vote_user_ip']) . "'
- WHERE vote_id = " . $row['vote_id'] . "
- AND vote_user_id = " . $row['vote_user_id'];
+ WHERE vote_user_ip LIKE '" . $row['vote_user_ip'] . "'";
}
while ( $row = $db->sql_fetchrow($result) );
}
@@ -265,13 +232,10 @@ if ( $row = $db->sql_fetchrow($result) )
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '.1.0 [20020905]'
WHERE config_name = 'version'";
-if ( !($result = $db->sql_query($sql)) )
-{
- die("Couldn't update version info");
-}
+$result = $db->sql_query($sql);
echo "\n<br />\n<b>COMPLETE!</b><br />\n";
echo "\n<p>Don't forget to delete this file!</p>\n";
?>
</body>
-</html>
+</html> \ No newline at end of file