Probleempje met de last visit mod van Niels

Hulp nodig bij een modificaties of op zoek naar een MOD? Bekijk ons archief. Support wordt helaas niet meer verleend.
Forumregels

Sinds 1 januari 2009 wordt phpBB2 niet meer ondersteund.
Onderstaande informatie is verouderd en dient uitsluitend als archief.
phpBB2.0.x
Gesloten
Gebruikersavatar
pencak
Berichten: 377
Lid geworden op: 19 jun 2005, 07:09
Contacteer:

Probleempje met de last visit mod van Niels

Bericht door pencak » 05 nov 2005, 17:16

Ik ben bezig om de last visit mod op 1 van onze forums te plaatsen

om vage reden kan ik de database update niet uitgevoerd krijgen

het file heb ik gewoon in de root gezet en via mijn browser aangeroepen,
elke keer kan hij hem niet vinden

nu wil ik de update direct via phpMyAdmin invoeren, maar ik weet niet precies hoe ik dit moet doen

kan iemand mij helpen

dit is het file met instructies:

Code: Selecteer alles

<?php
#########################################################
## SQL commands to phpBB2
## Author: Niels Chr. Rød
## Nickname: Niels Chr. Denmark
## Email: ncr@db9.dk
##
## Ver 1.0.8
##
## phpBB2 database update script for mods
## this file is intended to use with phpBB2, when installing mods
## after so you may delete this file, but only admin can use so it really doesen't matter
## The script will look what prefix you are using, and use the existing DB defined by congig.php
## The execution of this script's included SQL is harmless, so you can run it as meny times you like
## note, though that the users last visit, will be set back to his/her last login, 
## but that is a minor cosmetic isue, that will correct it self next time the use  logs in
##
## the following example are from my mods, and you can add some self, for other mods if you like
## you will after execution get a list over those commands that are run with succes and those with warnings !
## delete the sample lines if you are using it only for other mods
##
#########################################################

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);

###################################################################################################
##
## put the SQL commands below here, the SQL commands listed below are only exampels, substitude them with the one you need ##
##
###################################################################################################
$sql=array(
'ALTER TABLE '.USERS_TABLE.' ADD user_lastlogon INT (11) DEFAULT "0" not null',
'UPDATE '.USERS_TABLE.' SET user_lastlogon=user_lastvisit WHERE user_lastlogon="0"',
'INSERT INTO '.CONFIG_TABLE.' (config_name, config_value) VALUES ("hidde_last_logon", "0")',
'ALTER TABLE ' . USERS_TABLE .' ADD user_totaltime INT (11) DEFAULT "0"',
'ALTER TABLE ' . USERS_TABLE .' ADD user_totallogon INT (11) DEFAULT "0"',
'ALTER TABLE ' . USERS_TABLE .' ADD user_totalpages INT (11) DEFAULT "0"',
'UPDATE '. USERS_TABLE .' SET user_totaltime=(user_session_time-user_lastlogon) WHERE user_totaltime="0" AND user_lastlogon>0',
'UPDATE '. USERS_TABLE .' SET user_totallogon=1 WHERE user_totallogon="0" AND user_session_time<>"0"'
);


$mods = array ( 
'Last Visit PART 1 Mod','Last Visit PART 1 Mod','Last Visit PART 2 Mod','Last Visit PART 4 Mod','Last Visit PART 4 Mod','Last Visit PART 4 Mod','Last Visit PART 4 Mod','Last Visit PART 4 Mod'
);

############################################### Do not change anything below this line #######################################

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//

if ($userdata['user_level']!=ADMIN)
      message_die(GENERAL_ERROR, "You are not Authorised to do this"); 
$n=0;
$message="<b>This list is a result of the SQL queries needed for MOD</b><br/><br/>";
while($sql[$n])
{
	$message .= ($mods[$n-1] != $mods[$n]) ? '<p><b><font size=3>'.$mods[$n].'</font></b><br/>' : '';
	if(!$result = $db->sql_query($sql[$n])) 
	$message .= '<b><font color=#FF0000>[Already added]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />';
	else $message .='<b><font color=#0000fF>[Added/Updated]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />';
	$n++;
}
 message_die(GENERAL_MESSAGE, $message); 
?>

wat moet ik nu invoeren in de database om te zorgen dat het gaat werken :?:
Afbeelding

Gebruikersavatar
Bee
Berichten: 13403
Lid geworden op: 29 aug 2004, 10:30

Bericht door Bee » 05 nov 2005, 17:35

Indien je 2.0.18 gebruikt zou ik wachten met deze mod totdat Niels een update gemaakt heeft.
... Maar ik modereer (nog) niet.

Gebruikersavatar
pencak
Berichten: 377
Lid geworden op: 19 jun 2005, 07:09
Contacteer:

Bericht door pencak » 05 nov 2005, 19:33

dit forum draait nog op 2.0.17

er zijn wel een paar veiligheids aanpassingen gemaakt om een sql injectie tegen te gaan

ik wil deze mod wel gewoon alvast plaatsen,
kan je mij dan toch vertellen welke query ik moet uitvoeren om die database_update te doen :?:
Afbeelding

Gebruikersavatar
Bee
Berichten: 13403
Lid geworden op: 29 aug 2004, 10:30

Bericht door Bee » 05 nov 2005, 21:19

Code: Selecteer alles

ALTER TABLE phpbb_users ADD user_lastlogon INT (11) DEFAULT "0" not null;
UPDATE phpbb_users SET user_lastlogon=user_lastvisit WHERE user_lastlogon="0";
INSERT INTO phpbb_config (config_name, config_value) VALUES ("hidde_last_logon", "0");
ALTER TABLE phpbb_users ADD user_totaltime INT (11) DEFAULT "0";
ALTER TABLE phpbb_users ADD user_totallogon INT (11) DEFAULT "0";
ALTER TABLE phpbb_users ADD user_totalpages INT (11) DEFAULT "0";
UPDATE phpbb_users SET user_totaltime=(user_session_time-user_lastlogon) WHERE user_totaltime="0" AND user_lastlogon>0;
UPDATE phpbb_users SET user_totallogon=1 WHERE user_totallogon="0" AND user_session_time<>"0"; 
*Geen garantie geeft*
... Maar ik modereer (nog) niet.

Gesloten