Error When Viewing Posts Since Last Visit

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Locked
Mopat
Registered User
Posts: 10
Joined: Sun Apr 25, 2004 12:11 am

Error When Viewing Posts Since Last Visit

Post by Mopat »

Hi

I just upgraded to version 2.0.22 and am running the Classic template. My problem is that when they attempt to view the posts since last visit they receive the following message:

Could not delete old search id sessions

DEBUG MODE

SQL Error : 1054 Unknown column 'search_time' in 'where clause'

DELETE FROM phpbb_search_results WHERE search_time < 1167677859

Line : 658
File : search.php


Any help appreciated.

Pat
User avatar
karlsemple
Former Team Member
Posts: 39802
Joined: Mon Nov 01, 2004 8:54 am
Location: Hereford, UK
Contact:

Post by karlsemple »

  1. Create a fix.php file with the following:

    Code: Select all

    <?php
    define('IN_PHPBB', true);
    include('./extension.inc');
    include('./common.'.$phpEx);
    $page_title = 'phpBB Fix';
    
    $sql = array();
    $sql[] = "CREATE TABLE " . $table_prefix . "confirm (`confirm_id` char(32) NOT NULL default '', `session_id` char(32) NOT NULL default '', `code` char(6) NOT NULL default '', PRIMARY KEY (`session_id`,`confirm_id`)) TYPE=MyISAM;";
    $sql[] = "ALTER TABLE " . SESSIONS_TABLE . " ADD COLUMN session_admin tinyint(2) DEFAULT '0' NOT NULL";
    $sql[] = "CREATE TABLE " . $table_prefix . "sessions_keys (`key_id` varchar(32) NOT NULL default '0', `user_id` mediumint(8) NOT NULL default '0', `last_ip` varchar(8) NOT NULL default '0', `last_login` int(11) NOT NULL default '0', PRIMARY KEY (`key_id`,`user_id`), KEY `last_login` (`last_login`))";
    $sql[] = "UPDATE " . USERS_TABLE . " SET user_active = 0 WHERE user_id = -1";
    $sql[] = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('allow_autologin','1')";
    $sql[] = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('max_autologin_time','0')";
    $sql[] = "ALTER TABLE " . USERS_TABLE . " ADD COLUMN user_last_login_try int(11) DEFAULT '0' NOT NULL";
    $sql[] = "ALTER TABLE " . USERS_TABLE . " ADD COLUMN user_login_tries smallint(5) unsigned NOT NULL default '0'";
    $sql[] = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('max_login_attempts', '5')";
    $sql[] = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('login_reset_time', '30')";
    $sql[] = "ALTER TABLE " . SEARCH_TABLE . " ADD COLUMN `search_time` int(11) NOT NULL default '0'";
    $sql[] = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('search_flood_interval', '15')";
    $sql[] = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('rand_seed', '0')";
    $sql[] = "TRUNCATE TABLE " . SESSIONS_TABLE . "";
    $sql[] = "TRUNCATE TABLE " . SESSIONS_KEYS_TABLE . "";
    
    $sql_count = count($sql);
    for( $i = 0; $i < $sql_count; $i++ )
    {
       if ( !($result = $db->sql_query($sql[$i])) )
       $echo .= '<b>Query ' . ($i+1) . ': </b><font color="red"><b>Error (' . mysql_error() . ')</b></font><br />';
       else
       $echo .= '<b>Query ' . ($i+1) . ': </b><font color="green"><b>Ran successfully</b></font><br />';
    }
    message_die(GENERAL_MESSAGE, "<table width=\"80%\" class=\"forumline\"><tr><td><u><b>Report:</b></u><br />$echo<br /><br />All queries have been run. If any errors came up above, be sure to post the report in your topic on phpBB.com.<br /><b>You should now delete this file</b></td><tr></table>");
    ?>
  2. Upload the file to your board's root folder (the one with config.php)
  3. Run it by navigating to the file in your browser (ex. http://www.yoursite.com/phpBB2/fix.php)
  4. If any errors come up, post the report here.
  5. Be sure to delete the file; don't leave it on your server
Image
Mopat
Registered User
Posts: 10
Joined: Sun Apr 25, 2004 12:11 am

Post by Mopat »

Hi

I ran the fix.php and came up with the following:
Report:
Query 1: Error (Table 'phpbb_confirm' already exists)
Query 2: Error (Duplicate column name 'session_admin')
Query 3: Error (Table 'phpbb_sessions_keys' already exists)
Query 4: Ran successfully
Query 5: Error (Duplicate entry 'allow_autologin' for key 1)
Query 6: Error (Duplicate entry 'max_autologin_time' for key 1)
Query 7: Error (Duplicate column name 'user_last_login_try')
Query 8: Error (Duplicate column name 'user_login_tries')
Query 9: Error (Duplicate entry 'max_login_attempts' for key 1)
Query 10: Error (Duplicate entry 'login_reset_time' for key 1)
Query 11: Ran successfully
Query 12: Error (Duplicate entry 'search_flood_interval' for key 1)
Query 13: Error (Duplicate entry 'rand_seed' for key 1)
Query 14: Ran successfully
Query 15: Ran successfully


Thanks for your help!

Pat
Locked

Return to “2.0.x Support Forum”