Changeset 118 for db/character.php
- Timestamp:
- Nov 4, 2007, 5:38:25 PM (17 years ago)
- Location:
- db
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
db
- Property svn:ignore
-
old new 1 1 config.php 2 navrh
-
- Property svn:ignore
-
db/character.php
r109 r118 1 1 <?php 2 if (!defined('IN_CODE')){ exit; }; 2 3 /* ##################################################################### 3 4 ##################################################################### */ … … 14 15 \* ================================= */ 15 16 16 require_once "./config.php";17 18 @mysql_connect( $Config['DB_read']['Database']['Host'], $Config['DB_read']['Database']['User'], $Config['DB_read']['Database']['Password'] )19 OR DIE("<p>Vyskytla se chyba a nelze se připojit k databázi.<br> Zkuste to později.</p>");20 21 17 /* Podle předlohy nastavte v následujícím poli tabulky které se mají přečíst 22 18 Jsou přednastavené, ale pokud by některá chyběla nebo přebývala, opravte je 23 19 Klíč => array("tabulka","podmínka na select", "podmínka na nalezeni"), */ 20 24 21 $table = array( 25 22 0 => array("character", "guid", "name"), … … 39 36 14 => array("character_ticket", "guid"), 40 37 15 => array("character_tutorial", "guid"), 41 16 => array("item_instance", "owner_guid") 38 16 => array("item_instance", "owner_guid") 42 39 ); 43 40 44 41 /* ############### Konec Nastavení scriptu ############### */ 45 42 46 if( !isset($_POST['char']) ){47 @mysql_select_db($Config['DB_read']['DB_read']['Database_mangos'])48 OR DIE("<p>Nepodařilo se nastavit pracovní databázi ".$Config['DB_read']['DB_read']['Database_mangos']."!</p>");49 @mysql_query("SET CHARACTER SET utf8");50 43 51 $character_sql = mysql_query("SELECT * FROM `character` WHERE `guid`='".$_GET['char']."' LIMIT 1"); 52 if( mysql_num_rows($character_sql) == 1 ){ $character_sql = mysql_fetch_array($character_sql); } 53 else{ echo "Chyba postava nenalezena ! "; exit; }; 54 55 ?> 56 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 57 <html> 58 <head> 59 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" > 60 <meta name="author" content="http://HBstudio.ic.cz; e-mail: HosipLan@seznam.cz" > 61 <meta name="Description" content="Vytažení postavy z databáze" > 62 <meta name="Keywords" content="character,postava,database,vytazeni,obnoveni" > 63 <meta name="robots" content="all, follow" > 64 <title>::] Vytažení postavy z databáze [::</title> 65 </head> 66 <body> 67 <p>Pro ověření zadejte heslo a jméno accoutu, na kterém se postava nachází.</p> 68 <form action="<?php echo("./".basename(__FILE__)); ?>" method="post"> 69 <table border="0" id="login" cellspacing="0" cellpadding="3"> 70 <tr><td colspan='2'><h3>Character: <?php echo $character_sql['name']; ?></h3></td></tr> 71 <tr><td><label for="username">Acount:</label></td><td><input type="text" name="username" id="username" value="<?php echo $_POST['username']; ?>" maxlength="32" style="width: 250px;"></td></tr> 72 <tr><td><label for="pass">Heslo:</label></td><td><input type="password" name="pass" id="pass" maxlength="32" style="width: 250px;"></td></tr> 73 <tr><td align='right' colspan='2'><input type="submit" value="Download !" name="down"> 74 <input type="hidden" name="char" value="<?php echo $_GET['char']; ?>" style="display:none;"></td></tr> 75 </table></form> 76 <?php 77 } else{ 78 44 79 45 $nick = $_POST['username']; $heslo = $_POST['pass']; 80 46 $zakodovane_heslo = sha1(STRTOUPPER($nick).":".STRTOUPPER($heslo)); 81 @mysql_select_db($Config['DB_read']['DB_read']['Database_realmd'])82 OR DIE("<p>Nepodařilo se nastavit pracovní databázi ".$Config['DB_read']['DB_read']['Database_realmd']."!</p>");83 @mysql_query("SET CHARACTER SET utf8");84 47 48 SwitchDB(2); // nastavení databáze na realmd 85 49 $sql_acc = @mysql_query("SELECT * FROM `account` WHERE (`username`='$nick' AND `I`='$zakodovane_heslo') LIMIT 1 "); 86 50 if( mysql_num_rows($sql_acc) == 1 ) { 87 51 $sql_acc = mysql_fetch_array($sql_acc); 88 52 89 @mysql_select_db($Config['DB_read']['DB_read']['Database_mangos']) 90 OR DIE("<p>Nepodařilo se nastavit pracovní databázi ".$Config['DB_read']['DB_read']['Database_mangos']."!</p>"); 91 @mysql_query("SET CHARACTER SET utf8"); 92 53 SwitchDB(1); // nastavení databáze na mangos 93 54 $sql_user = @mysql_query("SELECT * FROM `character` WHERE `guid`='".addslashes($_POST['char'])."' AND `account`='".$sql_acc['id']."' LIMIT 1 "); 94 55 if( mysql_num_rows($sql_user) == 1 ) { 95 56 $sql_user = mysql_fetch_array($sql_user); 96 97 57 98 @mysql_select_db($Config['DB_read']['DB_read']['Database_web']) 99 OR DIE("<p>Nepodařilo se nastavit pracovní databázi ".$Config['DB_read']['DB_read']['Database_web']."!</p>"); 100 @mysql_query("SET CHARACTER SET utf8"); 58 SwitchDB(3); // nastavení databáze na web 101 59 $limit_sql = mysql_query("SELECT * FROM `acc_down_char` WHERE (`acc`='".$sql_user['account']."' AND `char`='".$sql_user['guid']."') ORDER BY `date` DESC"); 102 60 if( mysql_num_rows($limit_sql) > 0 ){ … … 106 64 }; 107 65 }; 108 109 66 110 @mysql_select_db($Config['DB_read']['DB_read']['Database_mangos']) 111 OR DIE("<p>Nepodařilo se nastavit pracovní databázi ".$Config['DB_read']['DB_read']['Database_mangos']."!</p>"); 112 @mysql_query("SET CHARACTER SET utf8"); 113 67 SwitchDB(1); // nastavení databáze na mangos 114 68 /* =========== Zacatek Hlavniho Scriptu =========== */ 115 69 $character = mysql_query("SELECT * FROM `".$table[0][0]."` WHERE `".$table[0][2]."`='".$sql_user['name']."' LIMIT 1"); … … 178 132 @header('Content-disposition: attachment; filename='.$Config['DB_read']['DB_read']['Abbr'].'_'.$sql_user['name'].".sql"); 179 133 print($file); 180 181 134 182 @mysql_select_db($Config['DB_read']['DB_read']['Database_web']) 183 OR DIE("<p>Nepodařilo se nastavit pracovní databázi ".$Config['DB_read']['DB_read']['Database_web']."!</p>"); 184 @mysql_query("SET CHARACTER SET utf8"); 135 SwitchDB(3); // nastavení databáze na web 185 136 mysql_query("INSERT INTO `acc_down_char` (`acc`,`char`,`date`,`ip`) VALUES ('".$sql_acc['id']."','".$sql_user['guid']."','".time()."','".$_SERVER["REMOTE_ADDR"]."') "); 186 137 … … 191 142 } else { echo "Špatný account nebo heslo ! "; exit; }; 192 143 193 };194 195 196 mysql_close(); // odpojíme se od databáze197 /* =========== END_scritps =========== */198 if( !isset($_POST['down']) ){199 ?>200 201 </body>202 </html>203 204 <?php205 };206 144 207 145 /* #####################################################################
Note:
See TracChangeset
for help on using the changeset viewer.