From 1cb945e201704062e9940f327464f4b31a861f20 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Mon, 5 Jan 2009 21:48:01 -0500 Subject: Changed comments' user index Previously, the comments table referenced users by username. However, if user ever changed their username, everything would become messed up. To fix this, the index has been changed to the user ID. This change obviously requires maintenance: This SQL must be run: "ALTER TABLE `comments` ADD `user_id` INT( 11 ) NOT NULL AFTER `page_id`;" This PHP will generate some SQL that must be run: "); } $getusers = "SELECT * FROM anon_commenters"; $getusers2 = mysql_query($getusers); while ($getusers3 = mysql_fetch_array($getusers2)) { echo("UPDATE comments SET user_id = " . $getusers3['id'] . " WHERE username = \"" . $getusers3['username'] . "\" AND is_anon = 1;
"); } ?> This SQL must be run: "ALTER TABLE `comments` DROP `username`;" --- includes/session.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'includes/session.php') diff --git a/includes/session.php b/includes/session.php index 19ad24e..94c919a 100755 --- a/includes/session.php +++ b/includes/session.php @@ -38,6 +38,24 @@ function getSessionID() return false; } +function getSessionUserID() +{ + $getconfig = "SELECT * FROM phpbb_config WHERE config_name LIKE \"cookie_name\""; + $getconfig2 = mysql_query($getconfig); + $getconfig3 = mysql_fetch_array($getconfig2); + + if (isset($_COOKIE[$getconfig3['config_value'] . '_sid'])) + { + $getsession = "SELECT * FROM phpbb_sessions WHERE session_id LIKE \"" . mysql_real_escape_string($_COOKIE[$getconfig3['config_value'] . '_sid']) . "\""; + $getsession2 = mysql_query($getsession) or die($getsession); + $getsession3 = mysql_fetch_array($getsession2); + + return $getsession3['session_user_id']; + } + + return false; +} + function getSessionUsername() { $getconfig = "SELECT * FROM phpbb_config WHERE config_name LIKE \"cookie_name\""; -- cgit 1.4.1