SQL Anweisung rückgängig machen ?

Allgemeiner Support zum phpBB 2 Board und phpBB 2 Modifikationen
Forumsregeln
Auch wenn hier der Support für phpBB 2 weiterhin aufrecht erhalten bleibt, weisen wir darauf hin, dass das phpBB 2 nicht mehr offiziell unterstützt und weiterentwickelt wird!
Antworten
Benutzeravatar
tom10
Beiträge: 1106
Registriert: Sa 29.Jan, 2005 14:58
Kontaktdaten:

SQL Anweisung rückgängig machen ?

Beitrag von tom10 »

Ich abe mal probehalber einen Mod eingebaut und habe folgende PHP Datei zum Updaten der Datenbank ausgeführt. Der Mod gefiel mir nicht und nun suche ich nach einer Rückgängig machung der Datenbankanweisung.
Kann man die PHP Datei so umschreiben das die gemachten Einträge wieder rückgängig gemacht werden ?

Ich hänge den Code mal eben an... ist ja zum Glück nicht all zu groß.

Code: Alles auswählen

<?php
//copyright © 2004 IdleVoid & brustverein
//copyright © 2003 Volodymy (CLowN) Skoryk
//this update template copyright © 2006 Anton Granik

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

$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);

if( !$userdata['session_logged_in'] )
{
   $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
   header($header_location . append_sid("login.$phpEx?redirect=reputation_mod_install_users_v100.$phpEx", true));
   exit;
}

if( $userdata['user_level'] != ADMIN )
{
   message_die(GENERAL_MESSAGE, 'You are not authorised to access this page');
}

$page_title = 'Setting the users reputations for Reputation Mod v.1.0.0 by Anton Granik';
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

echo '<table width="100%" cellspacing="1" cellpadding="2" border="0" class="forumline">';
echo '<tr><th>Setting the users reputations for Reputation Mod v.1.0.0 by Anton Granik</th></tr><tr><td><span class="genmed"><ul type="circle">';

$sql = "SELECT * FROM " . USERS_TABLE . "
		ORDER BY user_id";
if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, "Could not obtain reputation data for this user", '', __LINE__, __FILE__, $sql);
}
while ($row = $db->sql_fetchrow($result))
{
	echo "<strong>" . $row['username'] . "</strong>";
	$dif = time() - $row['user_regdate'];
	$a = ($dif/60/60/24) / $rep_config['days_to_earn'];
	$b = $row['user_posts'] / $rep_config['posts_to_earn'];
	$c = $a + $b;
	echo " (" . round($c,4) . "), ";
	$sql = "UPDATE " . USERS_TABLE . "
			SET user_reputation = $c, user_rep_last_time = " . time() . "
			WHERE user_id = " . $row['user_id'];
	if ( !$db->sql_query($sql) )
	{
		message_die(GENERAL_ERROR, "Could not update reputation for the user", '', __LINE__, __FILE__, $sql);
	}
}

if ($errors == 0)
echo '<tr><th>Finish</th></tr><tr><td><span class="med">Installation is now finished. Please be sure to <strong>delete these files</strong> now: <ul><li>reputation_mod_db_install_v100.php,</li><li>reputation_mod_users_install_v100.php</li></ul></span></td></tr></table>';

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>
Der Versuch was neues zu versuchen....
http://simson-le.de.vu
Benutzeravatar
AmigaLink
Beiträge: 5843
Registriert: Mi 03.Mär, 2004 09:05
Wohnort: NRW
Kontaktdaten:

Beitrag von AmigaLink »

Geh in phpMyAdmin und führ dort das hier aus:

Code: Alles auswählen

ALTER TABLE `phpbb_users` DROP `user_reputation`,
DROP `user_rep_last_time`;
[center].: Web Relax .::. Essen mit Freude .::. AmigaLink.de :.
______________________________________

Kein Support per PM, ICQ oder eMail!!!
[/center]
Benutzeravatar
tom10
Beiträge: 1106
Registriert: Sa 29.Jan, 2005 14:58
Kontaktdaten:

Beitrag von tom10 »

Danke Dir ! :D
Der Versuch was neues zu versuchen....
http://simson-le.de.vu
Antworten