[Tool] phpBB 2.0.14 to 2.0.15 Code Changes

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
97
63%
Very Good
15
10%
Good
14
9%
Fair
7
5%
Poor
20
13%
 
Total votes: 153

Nenad
Registered User
Posts: 46
Joined: Sat Apr 19, 2003 11:26 am
Contact:

Post by Nenad » Sat May 07, 2005 8:10 pm

With this added admin reauthentication the JuniorAdmin mod has stopped working. Could the mod be modified? ;)

»»EDDY««
Registered User
Posts: 220
Joined: Mon Jun 02, 2003 10:14 am
Location: Poland/Slupsk
Contact:

Post by »»EDDY«« » Sat May 07, 2005 8:23 pm

Code: Select all

phpBB : Critical Error 

Error creating new session

DEBUG MODE

SQL Error : 1054 Unknown column 'session_admin' in 'field list'

INSERT INTO phpbb_sessions (session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in, session_admin) VALUES ('2c27412acf4ce4bbaebc79227a9cbc69', -1, 1115497280, 1115497280, '5319dfd0', 0, 0, 0)

Line : 171
File : sessions.php 

Code: Select all

LINE 171 and before:


	//
	// Create or update the session
	//
	$sql = "UPDATE " . SESSIONS_TABLE . "
		SET session_user_id = $user_id, session_start = $current_time, session_time = $current_time, session_page = $page_id, session_logged_in = $login, session_admin = $admin
		WHERE session_id = '" . $session_id . "' 
			AND session_ip = '$user_ip'";
	if ( !$db->sql_query($sql) || !$db->sql_affectedrows() )
	{
		list($sec, $usec) = explode(' ', microtime());
		mt_srand((float) $sec + ((float) $usec * 100000));
		$session_id = md5(uniqid(mt_rand(), true));

		$sql = "INSERT INTO " . SESSIONS_TABLE . "
			(session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in, session_admin)
			VALUES ('$session_id', $user_id, $current_time, $current_time, '$user_ip', $page_id, $login, $admin)";
		if ( !$db->sql_query($sql) )
		{
			message_die(CRITICAL_ERROR, 'Error creating new session', '', __LINE__, __FILE__, $sql);

Make a Tiny URL in excellent domain heh.pl


cooling system & water cooling

th3zone
Registered User
Posts: 194
Joined: Tue Jan 04, 2005 11:02 pm

Post by th3zone » Sat May 07, 2005 8:29 pm

SUPERB!!! :D all hack mods work great without problem

chatasos
Registered User
Posts: 748
Joined: Wed May 15, 2002 1:16 pm
Location: Paralia

Post by chatasos » Sat May 07, 2005 8:30 pm

»»EDDY«« wrote:

Code: Select all

phpBB : Critical Error 

Error creating new session

DEBUG MODE

SQL Error : 1054 Unknown column 'session_admin' in 'field list'

INSERT INTO phpbb_sessions (session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in, session_admin) VALUES ('2c27412acf4ce4bbaebc79227a9cbc69', -1, 1115497280, 1115497280, '5319dfd0', 0, 0, 0)

Line : 171
File : sessions.php 

Code: Select all

LINE 171 and before:


	//
	// Create or update the session
	//
	$sql = "UPDATE " . SESSIONS_TABLE . "
		SET session_user_id = $user_id, session_start = $current_time, session_time = $current_time, session_page = $page_id, session_logged_in = $login, session_admin = $admin
		WHERE session_id = '" . $session_id . "' 
			AND session_ip = '$user_ip'";
	if ( !$db->sql_query($sql) || !$db->sql_affectedrows() )
	{
		list($sec, $usec) = explode(' ', microtime());
		mt_srand((float) $sec + ((float) $usec * 100000));
		$session_id = md5(uniqid(mt_rand(), true));

		$sql = "INSERT INTO " . SESSIONS_TABLE . "
			(session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in, session_admin)
			VALUES ('$session_id', $user_id, $current_time, $current_time, '$user_ip', $page_id, $login, $admin)";
		if ( !$db->sql_query($sql) )
		{
			message_die(CRITICAL_ERROR, 'Error creating new session', '', __LINE__, __FILE__, $sql);



maybe you forgot to run the update script?
Last edited by chatasos on Sat May 07, 2005 8:32 pm, edited 1 time in total.

snpmarq
Registered User
Posts: 30
Joined: Sun Jan 05, 2003 11:00 pm

Sessions.php fixes BREAK the SQL fix code...

Post by snpmarq » Sat May 07, 2005 8:31 pm

One of the NEW sessions.php code changes smacks into the SQL fix that would have previously been inserted in the middle of the code being changed. In essense the old MYSQL sessions 'fix' breaks when the new code is added around it.

In the previous sessions.php the 'mysql sessions fixed' code looked like this :
// Start of fix
$sql = "SELECT COUNT(*) as numrows FROM ". SESSIONS_TABLE ." WHERE session_ip = '$user_ip'";
$result = $db->sql_query($sql);
if ( !$result )
{
message_die(CRITICAL_ERROR, 'Error checking existing sessions', '', __LINE__, __FILE__, $sql);
}

$numrows = $db->sql_fetchrow($result);
if($numrows['numrows'] > 4)
{
$delete_limit = $numrows['numrows'] - 4;
switch( SQL_LAYER )
{
case 'mysql4':
$sql = "DELETE FROM ". SESSIONS_TABLE ." WHERE session_ip = '$user_ip' ORDER BY session_start ASC LIMIT $delete_limit";
break;
default:
$sql = "SELECT session_start FROM ". SESSIONS_TABLE ." WHERE session_ip = '$user_ip' ORDER BY session_start DESC LIMIT 4";
$result = $db->sql_query($sql);

if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error select session data', '', __LINE__, __FILE__, $sql);
}

$session_rows = $db->sql_fetchrowset($result);

$sql = "DELETE FROM ". SESSIONS_TABLE ." WHERE session_ip = '$user_ip' AND session_start < ".$session_rows[3]['session_start'];
}

if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error deleting old sessions', '', __LINE__, __FILE__, $sql);
}
}

// End of fix



And it was inserted in between the following sessions.php code :

# Line 158
SET session_user_id = $user_id, session_start = $current_time, session_time = $current_time, session_page = $page_id, session_logged_in = $login
WHERE session_id = '" . $session_id . "'
AND session_ip = '$user_ip'";
if ( !$db->sql_query($sql) || !$db->sql_affectedrows() )
{
$session_id = md5(uniqid($user_ip));


THE FIX CODE REFERENCED ABOVE USE TO GO HERE....


$sql = "INSERT INTO " . SESSIONS_TABLE . "
(session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in)
VALUES ('$session_id', $user_id, $current_time, $current_time, '$user_ip', $page_id, $login)";

#



The changes in the new code require the following change affect this part of the sessions.php code :
SET session_user_id = $user_id, session_start = $current_time, session_time = $current_time, session_page = $page_id, session_logged_in = $login, session_admin = $admin
WHERE session_id = '" . $session_id . "'
AND session_ip = '$user_ip'";
if ( !$db->sql_query($sql) || !$db->sql_affectedrows() )
{
list($sec, $usec) = explode(' ', microtime());
mt_srand((float) $sec + ((float) $usec * 100000));
$session_id = md5(uniqid(mt_rand(), true));

IN THEORY THE OLD MYSQL SESSIONS FIX CODE SHOULD GO HERE... IF ALL THINGS WERE RELATIVELY THE SAME...

$sql = "INSERT INTO " . SESSIONS_TABLE . "
(session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in, session_admin)
VALUES ('$session_id', $user_id, $current_time, $current_time, '$user_ip', $page_id, $login, $admin)";

#


But unfortunately when I put the newly updated sessions.php online ( with the 'mysql fix' placed as indicated above it caused the forum to lock up and report a mysql error with the database.

Is there a possible change required to the 'mysql fix' to put it in sync with this new change in sessions.php code ?

Or does the 'mysql sessions fix' just not fit in with the new change to the sessions.php ?

Thanks in advance for any advice you can regarding this part of the upgrade. If there is a problem between the updated code and that old 'mysql fix' code... then I suspect quite a few sites are going to 'break'..


Marq

th3zone
Registered User
Posts: 194
Joined: Tue Jan 04, 2005 11:02 pm

Post by th3zone » Sat May 07, 2005 8:31 pm

SeraphicGate wrote: Problem

"Please read: INSTALL.html before attempting to update."

Comes up after making the code changes and then trying to run "update_to_latest.php".

And yes, I know it needs to be run in root/install/update_to_latest.php


did u delete the folder install? u need delete that files after update on ur forum...if not u will get error messages.

Neverbirth
Registered User
Posts: 153
Joined: Thu Dec 30, 2004 10:38 pm

Post by Neverbirth » Sat May 07, 2005 8:32 pm

I updated my forum a while ago without any problem, and I don't see any malfunction in all the mods I installed ;).

»»EDDY««
Registered User
Posts: 220
Joined: Mon Jun 02, 2003 10:14 am
Location: Poland/Slupsk
Contact:

Post by »»EDDY«« » Sat May 07, 2005 8:38 pm

Problem solved.
Add in DB:

Code: Select all

ALTER TABLE phpbb_sessions ADD COLUMN session_admin tinyint(2) DEFAULT '0' NOT NULL;
Make a Tiny URL in excellent domain heh.pl


cooling system & water cooling

darylt
Registered User
Posts: 151
Joined: Mon Jul 12, 2004 10:00 pm

Post by darylt » Sat May 07, 2005 8:42 pm

darylt wrote: I have the following error after the upgrade

Code: Select all

Parse error: parse error, unexpected '}' in /home/httpd/vhosts/lsdogs.org.uk/httpdocs/phpBB/includes/sessions.php on line 207

Fatal error: Call to undefined function: session_pagestart() in /home/httpd/vhosts/lsdogs.org.uk/httpdocs/phpBB/index.php on line 31
Can anyone help please? :?


I have re-checked everything and found an extra } in sessions.php

Now I get the following errors

Code: Select all

Parse error: parse error, unexpected $ in /home/httpd/vhosts/lsdogs.org.uk/httpdocs/phpBB/includes/sessions.php on line 418

Fatal error: Call to undefined function: session_pagestart() in /home/httpd/vhosts/lsdogs.org.uk/httpdocs/phpBB/index.php on line 31
Line 418 is the last on the page!

mommyKaren
Registered User
Posts: 67
Joined: Sat Mar 27, 2004 11:38 pm

Post by mommyKaren » Sat May 07, 2005 8:45 pm

WOW! The entire process took under a minute. Fan-TASTIC!!

Smoothest. Upgrade. EVER.

Thank you so much!!! :D

alycad
Registered User
Posts: 160
Joined: Thu Mar 04, 2004 10:13 am
Location: Portugal
Contact:

Post by alycad » Sat May 07, 2005 9:15 pm

Nice and done ;)

But why did phpbb sent 2 mails?

Alvaro

chatasos
Registered User
Posts: 748
Joined: Wed May 15, 2002 1:16 pm
Location: Paralia

Post by chatasos » Sat May 07, 2005 9:17 pm

:arrow:
Last edited by chatasos on Sat May 07, 2005 9:20 pm, edited 1 time in total.

chatasos
Registered User
Posts: 748
Joined: Wed May 15, 2002 1:16 pm
Location: Paralia

Post by chatasos » Sat May 07, 2005 9:18 pm

»»EDDY«« wrote: Problem solved.
Add in DB:

Code: Select all

ALTER TABLE phpbb_sessions ADD COLUMN session_admin tinyint(2) DEFAULT '0' NOT NULL;


That sould be done by the "install/update_to_latest.php" script :wink:

rymfaxe
Registered User
Posts: 17
Joined: Fri Nov 12, 2004 2:06 pm
Location: Copenhagen, DK

Re: [Tool] phpBB 2.0.14 to 2.0.15 Code Changes

Post by rymfaxe » Sat May 07, 2005 9:21 pm

MOD Database Manager wrote: Installation Time: ~ 20 Minutes

Well, maybe a few more minutes... it's quite a bunch of editorial traps.
Unfortunately I get this after update

Code: Select all

SQL Error : 1054 Unknown column 'session_admin' in 'field list'
Would you know why ?

/thanks
/rymfaxe was here
...Image
Fumbling with phpBB2 Plus 1.52 / 2.0.19

darylt
Registered User
Posts: 151
Joined: Mon Jul 12, 2004 10:00 pm

Post by darylt » Sat May 07, 2005 9:26 pm

:idea:

Did you run install/update_to_latest.php

Post Reply

Return to “[2.0.x] MOD Database Releases”