1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320: 321: 322: 323: 324: 325: 326: 327: 328: 329: 330: 331: 332: 333: 334: 335: 336: 337: 338: 339: 340: 341: 342: 343: 344: 345:
|
<?
require_once 'common.php'; require_once './lib/biobackup_funcs.php'; page_header('Biobackups');
// Wenn das Script zum ersten Mal gestartet wird: if(getsetting('backupupdated', '0000-00-00 00:00:00') == '0000-00-00 00:00:00') { $players = players_on_server(); foreach($players AS $v) { $row = db_fetch_assoc(db_query('SELECT bio FROM accounts WHERE acctid = '.intval($v))); file_put_contents('./'.$dir_name.'/'.$v.'.txt', stripslashes($row['bio'])); } savesetting('backupupdated', date('Y-m-d H:i:s')); savesetting('autobackup', 1); savesetting('deletedplayerbackup', 1); savesetting('backupdays', 3); savesetting('delbackupafterday', 50); $out .= '`b`$Dieses Script wird zum ersten Mal gestartet. Es werden automatisch Backups von allen Spielern mit einer Biographie erstellt. `n Das Datum des letzten Updates wurde auf den heutigen Tag gesetzt. `n `n Automatische Backups wurde standardmäßig aktiviert. Die Backups werden alle 3 Tage aktualisiert. `n Von Spielern welche gelöscht werden wird ein Backup erzeugt. Die Backups von gelöschten Spielern werden nach 50 Tagen gelöscht. `n `n Diese Einstellungen kannst du in der Spielmechanik ändern!`b`0`n`n`n'; }
switch($_GET['op']) { case '': $out .= '`b`&Statistiken:`b `n `&Spieler auf dem Server mit einer Biographie: `i`7'.count(players_on_server()).'`i `n `&Spieler mit einem Backup: `i`7'.count(players_with_backup()).'`i `n `&Spieler ohne Backup: `i`7'.count(players_without_backup()).'`i `n `&Backups von Spielern mit gelöschtem Account: `i`7'.count(without_account()).'`i `n `&Letztes Update: `i`7'.date('d.m.Y \\u\m H:i:s', strtotime(getsetting('backupupdated', '0000-00-00 00:00:00'))).'`i `n `n `n <form action="biobackups.php?op=deleteall" method="POST">'; $out .= "<input type='submit' class='button' value='Alle Backups löschen' onClick=\"return confirm('Willst du wirklich alle Biobackups löschen?');\"> </form>"; addnav('', 'biobackups.php?op=deleteall'); addnav('Aktionen'); addnav('Neue Backups', 'biobackups.php?op=new'); addnav('Backups updaten', 'biobackups.php?op=update'); addnav('Backup suchen', 'biobackups.php?op=search'); addnav('Gelöschte Spieler', 'biobackups.php?op=deleted'); addnav('Zurück'); addnav('zum Weltlichen', 'village.php'); addnav('zur Nebengrotte', 'superuser2.php'); break; case 'new': $count_no_backup = count(players_without_backup()); addnav('', 'biobackups.php?op=new2'); output('`c`b`&Neue Biographien hinzufügen`b `n <font size="-2">`i`b`&'.$count_no_backup.'`b Ergebnisse gefunden`i</font>`c `n `n <form action="biobackups.php?op=new2" method="POST">', true); if($count_no_backup > 0) { $i = 0; $got_no_backup = players_without_backup(); foreach($got_no_backup AS $v) { $sql = 'SELECT login, bio FROM accounts WHERE acctid = '.intval($v); $result = db_query($sql); $row = db_fetch_assoc($result); $out .= '<table border="0" cellspacing="1" cellpadding="5" width="750"> <tr class="trhead"> <td colspan="2">`b`&Infos`b</td> <td width="50">`b`&Auswählen`b</td> </tr> <tr class="trdark"> <td valign="top">`b`&AcctID:`b `7'.$v.' `n `b`&Name:`b `7'.$row['login'].' `n `b`&Bio-Wortanzahl:`b `7'.str_word_count(strip_tags($row['bio'])).' </td> <td>`b`&Bio:`b `n `n'; $out .= closetags(strip_tags(subStr($row['bio'], 0, 250)),'`c`i`b').' '.((strLen($row['bio']) > 250)?'`&[...]':''); $out .= '</td> <td align="center"><input type="checkbox" id="CheckboxFor'.$i.'" name="add_backup[]" value="'.$v.'"> </tr> </table>`n`n'; $i++; } $out .= "<table width='750'> <tr> <td align='left'> <input type='button' value='Alle markieren' class='button' onClick='"; for($i=$i-1;$i>=0;$i--) { $out .= "document.getElementById(\"CheckboxFor$i\").checked=true;"; }
$out .= "'></td> <td align='right'> <input type='submit' class='button' value='Backup eintragen'> </td> </tr></table></form> `n`n`n"; } addnav('Aktionen'); addnav('Aktualisieren', 'biobackups.php?op=new'); addnav('Zurück'); addnav('zum Hauptmenü', 'biobackups.php'); addnav('zur Nebengrotte', 'superuser2.php'); break; case 'new2': $add_backup = $_POST['add_backup']; $count_add_backup = count($_POST['add_backup']); if(!is_array($add_backup)) $out .= '`b`&!! Es wurde kein Array übergeben. Fehler im Script !!'; elseif($count_add_backup < 1) $out .= '`&Du hast genau 0 (Null) Biographien ausgewählt, von denen du ein Backup erstellen willst! `n Du musst schon mindestens eine Bio auswählen ;)'; else { $i = 0; foreach($add_backup as $v) { $sql = 'SELECT bio FROM accounts WHERE acctid = '.intval($v); $res = db_query($sql); $row = db_fetch_assoc($res); if(file_put_contents('./'.$dir_name.'/'.$v.'.txt', stripslashes($row['bio'])) !== false) $i++; } $out .= '`&Die Files wurden hinzugefügt. Von den Bios der '.$count_add_backup.' Spielern existiert nun '.$i.' Backups.'; } addnav('Zurück'); addnav('zum Hauptmenü', 'biobackups.php'); addnav('zur Nebengrotte', 'superuser2.php'); break; case 'update': $with_backup = players_with_backup(); $i = 0; foreach($with_backup AS $v) { $sql = 'SELECT bio FROM accounts WHERE acctid = '.intval($v); $res = db_query($sql); $row = db_fetch_assoc($res); if($row['bio'] > '') { file_put_contents('./'.$dir_name.'/'.$v.'.txt', $row['bio']); $i++; } } savesetting('backupupdated', date('Y-m-d H:i:s')); $out .= '`&'.$i.' Biographien wurden aktualisiert!'; addnav('Zurück'); addnav('zum Hauptmenü', 'biobackups.php'); addnav('zur Nebengrotte', 'superuser2.php'); break; case 'search': if(!isset($_POST['name'])) { $out = '`&Hier kannst du nach dem Backup eines Spielers suchen. `n Mögliche Eingaben sind der Name des Spielers (ohne Farbcodes) oder seine acctid. `n `n <form action="biobackups.php?op=search" method="POST"> <input name="name"> <input type="submit" class="button" value="Suchen"> </form>'; addnav('', 'biobackups.php?op=search'); } else { $_POST['name'] = stripslashes($_POST['name']); $StrLen = StrLen($_POST['name']); $who = ''; for($i = 0; $i < $StrLen; $i++) { $who .= '%'.$_POST['name']{$i}; } $who .= '%'; $who = mysql_real_escape_string($who); $sql = 'SELECT acctid, name FROM accounts WHERE (`login` LIKE "%'.$who.'%" OR `acctid` LIKE "'.$who.'")'; $res = db_query($sql); $n = db_num_rows($res); if($n == 0) $out = '`&Es wurde kein Spieler gefunden, auf den Deine Eingabe zutrifft!'; elseif($n == 1) { $row = db_fetch_assoc($res); $players = players_with_backup(); if(!in_array($row['acctid'], $players)) $out = '`&Es wurde kein Spieler gefunden, auf den Deine Eingabe zutrifft!'; else { $session['thisID'] = $row['acctid']; redirect('biobackups.php?op=showbio'); } } else { $out = '`&Es wurden mehr als ein Spieler/in gefunden, die auf deine Eingabe zutreffen. `n Wähle Deinen gewünschten Spieler aus. `n `n <form action="biobackups.php?op=preparetoshow" method="POST"> <select name="thisID">'; addnav('', 'biobackups.php?op=preparetoshow'); for($i=0; $i<$n; $i++) { $row = db_fetch_assoc($res); $players = players_with_backup(); $name = stripcolors($row['name']); if(in_array($row['acctid'], $players)) $out .= '<option value="'.$row['acctid'].'">'.$name.'</option>'; } $out .= '</select> <input type="submit" class="button" value="Anzeigen"> </form>'; } } addnav('Zurück'); addnav('zum Hauptmenü', 'biobackups.php'); addnav('zur Nebengrotte', 'superuser2.php'); break; case 'preparetoshow': $session['thisID'] = $_POST['thisID']; redirect('biobackups.php?op=showbio'); break; case 'showbio': $content = stripslashes(file_get_contents('./'.$dir_name.'/'.$session['thisID'].'.txt')); $res = db_query('SELECT name FROM accounts WHERE acctid = '.$session['thisID']); $row = db_fetch_assoc($res); output('`b `&Backup von '.$row['name'].': `n`n'); rawoutput('<textarea rows="10" cols="65" class="input">'.$content.'</textarea>'); $out = '`n`n`n '.$content; unset($session['thisID']); addnav('Zurück'); addnav('zum Hauptmenü', 'biobackups.php'); addnav('zur Nebengrotte', 'superuser2.php'); break; case 'deleteall': $all_backup_IDs = players_with_backup(); $i = 0; foreach($all_backup_IDs AS $v) { unlink('./'.$dir_name.'/'.$v.'.txt'); $i++; } $out = '`&Es wurden erfolgreich '.$i.' Backups gelöscht!'; addnav('Zurück'); addnav('zum Hauptmenü', 'biobackups.php'); addnav('zur Nebengrotte', 'superuser2.php'); break; case 'deleted': $deleted_acc_data = without_account_data(); if(count(without_account()) > 0) { $out = '<table cellpadding="3" cellspacing="1" bgcolor="#999999"> <tr class="trhead"> <td> `b`&Acctid`b </td> <td> `b`&Name`b </td> <td> `b`&Gelöscht am`b </td> <td> `b`&Optionen`b </td> </tr>'; foreach($deleted_acc_data AS $v) { $links = "`0<a href='biobackups.php?op=deldeleted&filename=".rawurlencode($v['filename'])."' onClick=\"return confirm('Backup von ".$v['name']." wirklich löschen?');\">`\$Del</a> `n <a href='biobackups.php?op=showdelbio&filename=".rawurlencode($v['filename'])."'>Show</a>"; addnav('', 'biobackups.php?op=deldeleted&filename='.rawurlencode($v['filename'])); addnav('', 'biobackups.php?op=showdelbio&filename='.rawurlencode($v['filename'])); $out .= '<tr class="trdark"> <td> `&'.$v['ID'].' </td> <td> `&'.$v['name'].' </td> <td> `&'.date('d.m.Y \\u\m H:i:s', strtotime($v['date'])).' </td> <td> `&'.$links.' </td> </tr>'; } } else { $out = '`&Es gibt keine Backups von gelöschten Spielern!'; } addnav('Zurück'); addnav('zum Hauptmenü', 'biobackups.php'); addnav('zur Nebengrotte', 'superuser2.php'); break; case 'deldeleted': $filename = rawurldecode($_GET['filename']); unlink('./'.$dir_name2.'/'.$filename); redirect('biobackups.php?op=deleted'); break; case 'showdelbio': $filename = rawurldecode($_GET['filename']); $content = stripslashes(file_get_contents('./'.$dir_name2.'/'.$filename)); $parts = explode('|', $filename); $parts[2] = str_replace('.txt', '', $parts[2]); output('`b `&Backup von '.$parts[1].'`&, erstellt am '.date('d.m.Y \\u\m H:i:s', strtotime($parts[2])).': `n`n'); rawoutput('<textarea rows="10" cols="65" class="input">'.$content.'</textarea>'); $out = '`n`n`n '.$content; addnav('Zurück'); addnav('zum Hauptmenü', 'biobackups.php'); addnav('zur Nebengrotte', 'superuser2.php'); break; }
output($out, true); page_footer(); ?>
|