1 | <?
|
---|
2 | include("../conn.php");
|
---|
3 |
|
---|
4 | $heslo = $_GET['heslo'];
|
---|
5 |
|
---|
6 | if(!empty($heslo) AND $heslo!=$admin):
|
---|
7 | $chyba = "<font color=red>Špatné heslo!</font>";
|
---|
8 | $heslo = 0;
|
---|
9 | endif;
|
---|
10 | if(empty($heslo)):
|
---|
11 | if(!empty($chyba)):
|
---|
12 | echo"<p align=center>$chyba<br />";
|
---|
13 | endif;
|
---|
14 | echo"<form method=GET action=''><p align=center>Heslo: <input type=password name=heslo><br /><br />";
|
---|
15 | echo"<input type=submit value='Přihlásit'></form>";
|
---|
16 |
|
---|
17 | else:
|
---|
18 |
|
---|
19 | $q = $_GET['q'];
|
---|
20 | $err = $_GET['err'];
|
---|
21 | $info = $_GET['info'];
|
---|
22 | $err_text = array("Toto ID nebylo nalezeno v databázi!", "Při vkládání do seznamu došlo k chybě!", "Při exportu došlo k chybě!", "Položku se nepodařilo vymazat ze seznamu!");
|
---|
23 | $info_text = array("Přidání do seznamu proběhlo úspěšně!", "Export proběhl vpořádku", "Vymazání položky ze seznamu proběhlo úspěšně");
|
---|
24 |
|
---|
25 | if(empty($q)){
|
---|
26 | //////////////////////////////////////////////////////////Základní zobrazení
|
---|
27 |
|
---|
28 |
|
---|
29 |
|
---|
30 |
|
---|
31 | if(!empty($err)):
|
---|
32 | $err = $err - 1;
|
---|
33 | echo"<p align=center><font color=red><b>$err_text[$err]</b></font>";
|
---|
34 | endif;
|
---|
35 | if(!empty($info)):
|
---|
36 | $info = $info - 1;
|
---|
37 | echo"<p align=center><font color=green><b>$info_text[$info]</b></font>";
|
---|
38 | endif;
|
---|
39 |
|
---|
40 | echo"<br />
|
---|
41 | <br />
|
---|
42 | ";
|
---|
43 |
|
---|
44 | echo"<form method=post action=index.php?q=1&i=gameobject&heslo=$heslo><input type=submit value='Přidat object do seznamu exportovaných'></form>";
|
---|
45 | echo"<form method=post action=index.php?q=1&i=creature&heslo=$heslo><input type=submit value='Přidat NPC do seznamu exportovaných'></form>";
|
---|
46 |
|
---|
47 | echo"<br><br>";
|
---|
48 | echo"<form method=post action=index.php?q=3&i=gameobject&heslo=$heslo><input type=submit value='Zobrazit seznam objectů'></form>";
|
---|
49 | echo"<form method=post action=index.php?q=3&i=creature&heslo=$heslo><input type=submit value='Zobrazit seznam NPC'></form>";
|
---|
50 |
|
---|
51 | echo"<br><br>";
|
---|
52 | echo"<form method=post action=index.php?q=2&i=gameobject&heslo=$heslo><input type=submit value='Vytvořit export objectů'></form>";
|
---|
53 | echo"<form method=post action=index.php?q=2&i=creature&heslo=$heslo><input type=submit value='Vytvořit export NPC'></form>";
|
---|
54 | echo"<form method=post action=index.php?q=2&i=creature_movement&heslo=$heslo><input type=submit value='Vytvořit export Waypointu'></form>";
|
---|
55 |
|
---|
56 | } elseif($q==1){
|
---|
57 | //////////////////////////////////////////////////////////Přidávání do seznamů exportovaných
|
---|
58 | $typ = $_GET['i'];
|
---|
59 | $instal = $_POST['instal'];
|
---|
60 |
|
---|
61 |
|
---|
62 | if(empty($instal)):
|
---|
63 | ////formulář před přidáním
|
---|
64 | echo"<form method=post action=index.php?q=1&i=$typ&heslo=$heslo>
|
---|
65 | ID ($typ): <input type=\"text\" name='guid'><br />
|
---|
66 | <input type=hidden name=instal value=1>
|
---|
67 | <input type=submit value='Přidat do seznamu'>
|
---|
68 | </form>
|
---|
69 | ";
|
---|
70 | else:
|
---|
71 | ////instalace do seznamu
|
---|
72 | $guid = $_POST['guid'];
|
---|
73 |
|
---|
74 | mysql_connect($SQL_Server, $SQL_Uzivatel, $SQL_Heslo);
|
---|
75 | mysql_select_db($Databaze_world);
|
---|
76 | mysql_query("SET NAMES 'utf8'");
|
---|
77 | $existuje_guid = mysql_num_rows(mysql_query("SELECT id from $typ where id=$guid"));
|
---|
78 |
|
---|
79 | if($existuje_guid==0):
|
---|
80 | echo"<meta http-equiv=\"refresh\" content=\"0.1;url=index.php?err=1&heslo=$heslo\">";
|
---|
81 | else:
|
---|
82 | mysql_select_db($Databaze);
|
---|
83 | $pridat_do_seznamu = mysql_query("insert into export_list values ('$typ', '$guid')");
|
---|
84 |
|
---|
85 | if($pridat_do_seznamu):
|
---|
86 | echo"<meta http-equiv=\"refresh\" content=\"0.1;url=index.php?info=1&heslo=$heslo\">";
|
---|
87 | else:
|
---|
88 | echo"<meta http-equiv=\"refresh\" content=\"0.1;url=index.php?err=2&heslo=$heslo\">";
|
---|
89 | endif;
|
---|
90 |
|
---|
91 | endif;
|
---|
92 | endif;
|
---|
93 |
|
---|
94 | } elseif($q==2){
|
---|
95 | //////////////////////////////////////////////////////////Export
|
---|
96 | $typ = $_GET['i'];
|
---|
97 | $datum = date("Y-m-d");
|
---|
98 | ////////////////Vytvoření souboru:
|
---|
99 | if($typ=="creature_movement"):
|
---|
100 | $soubor = fopen("waypoint.sql", "w");
|
---|
101 | else:
|
---|
102 | $soubor = fopen("$typ.sql", "w");
|
---|
103 | endif;
|
---|
104 |
|
---|
105 | $hotovo = 0;
|
---|
106 | $x = 0;
|
---|
107 |
|
---|
108 | mysql_connect($SQL_Server, $SQL_Uzivatel, $SQL_Heslo);
|
---|
109 | mysql_select_db($Databaze);
|
---|
110 | mysql_query("SET NAMES 'utf8'");
|
---|
111 |
|
---|
112 | if($typ=="creature_movement"):
|
---|
113 | $vyhledat_guid_exportovanych = mysql_query("select * from export_list where typ='creature'");
|
---|
114 | else:
|
---|
115 | $vyhledat_guid_exportovanych = mysql_query("select * from export_list where typ='$typ'");
|
---|
116 | endif;
|
---|
117 |
|
---|
118 | while($row = mysql_fetch_array($vyhledat_guid_exportovanych)){
|
---|
119 | $guid_exp = $row['guid'];
|
---|
120 |
|
---|
121 | mysql_select_db($Databaze_world);
|
---|
122 | mysql_query("SET NAMES 'utf8'");
|
---|
123 | $vypsat_data_exportovanych = mysql_query("select * from $typ where id=$guid_exp");
|
---|
124 | $pocet_exportovanych = mysql_num_rows(mysql_query("select id from $typ where id=$guid_exp"));
|
---|
125 | while($a = mysql_fetch_array($vypsat_data_exportovanych)):
|
---|
126 |
|
---|
127 | if($typ=="gameobject"):
|
---|
128 |
|
---|
129 | $prikaz = "INSERT INTO gamobject values('', '".$a['id']."', '".$a['map']."', '".$a['spawnMask']."', '".$a['position_x']."', '".$a['position_y']."', '".$a['position_z']."', '".$a['orientation']."', '".$a['rotation0']."', '".$a['rotation1']."', '".$a['rotation2']."', '".$a['rotation3']."', '".$a['spawntimesecs']."', '".$a['animprogress']."', '".$a['state']."');";
|
---|
130 | $prikaz .= "\n";
|
---|
131 |
|
---|
132 | elseif($typ=="creature"):
|
---|
133 | $prikaz = "INSERT INTO creature values('', '".$a['id']."', '".$a['map']."', '".$a['spawnMask']."', '".$a['modelid']."', , '".$a['equipment_id']."', '".$a['position_x']."', '".$a['position_y']."', '".$a['position_z']."', '".$a['orientation']."', '".$a['spawntimesecs']."', '".$a['spawndist']."', '".$a['currentwaypoint']."', '".$a['curhealth']."', '".$a['curmana']."', '".$a['DeathState']."', '".$a['MovementType']."');";
|
---|
134 | $prikaz .= "\n";
|
---|
135 |
|
---|
136 | elseif($typ=="creature_movement"):
|
---|
137 | $prikaz = "INSERT INTO creature_movement values('".$a['id']."', '".$a['point']."', '".$a['position_x']."', '".$a['position_y']."', '".$a['position_z']."', '".$a['waittime']."', '".$a['text1']."', '".$a['text2']."', '".$a['text3']."', '".$a['text4']."', '".$a['text5']."', '".$a['emote']."', '".$a['spell']."', '".$a['wpguid']."', '".$a['orientation']."', '".$a['model1']."', '".$a['model2']."');";
|
---|
138 | $prikaz .= "\n";
|
---|
139 | endif;
|
---|
140 |
|
---|
141 | $zapis = fwrite($soubor,$prikaz);
|
---|
142 |
|
---|
143 | if($zapis):
|
---|
144 | $hotovo = $hotovo + 1;
|
---|
145 | endif;
|
---|
146 |
|
---|
147 | $x = $x + 1;
|
---|
148 | endwhile;
|
---|
149 | ////////////////vložení informací do souboru:
|
---|
150 |
|
---|
151 |
|
---|
152 |
|
---|
153 | }
|
---|
154 | fclose($soubor);
|
---|
155 | if($hotovo==$x):
|
---|
156 | echo"<meta http-equiv=\"refresh\" content=\"0.1;url=index.php?info=2&heslo=$heslo\">";
|
---|
157 | else:
|
---|
158 | echo"<meta http-equiv=\"refresh\" content=\"0.1;url=index.php?err=3&heslo=$heslo\">";
|
---|
159 | endif;
|
---|
160 |
|
---|
161 | } elseif($q==3){
|
---|
162 | //////////////////////////////////////////////////////////Zobrazení seznamu
|
---|
163 | $typ = $_GET['i'];
|
---|
164 | $delete = $_POST['delete'];
|
---|
165 |
|
---|
166 | if(empty($delete)):
|
---|
167 | if(!empty($err)):
|
---|
168 | $err = $err - 1;
|
---|
169 | echo"<p align=center><font color=red><b>$err_text[$err]</b></font>";
|
---|
170 | endif;
|
---|
171 | if(!empty($info)):
|
---|
172 | $info = $info - 1;
|
---|
173 | echo"<p align=center><font color=green><b>$info_text[$info]</b></font>";
|
---|
174 | endif;
|
---|
175 | echo"<p align=center>Seznam $typ ID k exportu<br>
|
---|
176 | <table align=center><tr><td><b>ID</b><td> ";
|
---|
177 | mysql_connect($SQL_Server, $SQL_Uzivatel, $SQL_Heslo);
|
---|
178 | mysql_select_db($Databaze);
|
---|
179 | mysql_query("SET NAMES 'utf8'");
|
---|
180 | $vyhledat_data_v_seznamu = mysql_query("select * from export_list where typ='$typ'");
|
---|
181 | while($row = mysql_fetch_array($vyhledat_data_v_seznamu)){
|
---|
182 | $id = $row['guid'];
|
---|
183 | echo"<tr><td>$id</td><form method=post action=index.php?q=3&i=$typ&heslo=$heslo><td><input type=hidden name=delete value=1><input type=hidden name=id value='$id'><input type=submit value='Smazat ze seznamu'></form>";
|
---|
184 |
|
---|
185 | }
|
---|
186 | echo"</table><br>
|
---|
187 | <br>
|
---|
188 | <a href=index.php?heslo=$heslo><-- Zpět do menu</a>";
|
---|
189 | elseif($delete==1):
|
---|
190 | //////////////////////////////////////////////////////////Mazání ze seznamu
|
---|
191 | $id = $_POST['id'];
|
---|
192 |
|
---|
193 | mysql_connect($SQL_Server, $SQL_Uzivatel, $SQL_Heslo);
|
---|
194 | mysql_select_db($Databaze);
|
---|
195 | mysql_query("SET NAMES 'utf8'");
|
---|
196 | $vyhledat_data_v_seznamu = mysql_query("delete from export_list where guid='$id' LIMIT 1");
|
---|
197 | if($vyhledat_data_v_seznamu):
|
---|
198 | echo"<meta http-equiv=\"refresh\" content=\"0.1;url=index.php?q=3&i=$typ&info=3&heslo=$heslo\">";
|
---|
199 | else:
|
---|
200 | echo"<meta http-equiv=\"refresh\" content=\"0.1;url=index.php?q=3&i=$typ&err=4&heslo=$heslo\">";
|
---|
201 | endif;
|
---|
202 | endif;
|
---|
203 | }
|
---|
204 |
|
---|
205 | endif;
|
---|
206 |
|
---|
207 |
|
---|
208 |
|
---|
209 |
|
---|
210 |
|
---|
211 |
|
---|
212 |
|
---|
213 |
|
---|
214 |
|
---|
215 |
|
---|
216 |
|
---|
217 |
|
---|
218 |
|
---|
219 |
|
---|
220 |
|
---|
221 |
|
---|
222 |
|
---|
223 |
|
---|