View file me.php
<?php session_name('SID'); session_start(); include_once($_SERVER['DOCUMENT_ROOT'].'/data/inc.cfg'); // TOP OF THE PAGE ?> <div class="top"><b><?=LNG_ME_TITLE?></b> <?php // MAP DATA $q = mysql_query(" SELECT * FROM `map`"); if(!$q) echo '<div class="error">Error: '.mysql_error().'</div>'; // MAP AND SERVER SELECTION echo '<form method="post" align="left" action="?chose_map" style="position:absolute;top:0px;left:0px;"> <select name="map"> <option disabled="yes">'.LNG_ME_CHOSE_MAP.'</option>'; while($maps = mysql_fetch_assoc($q)) { echo '<option value="'.$maps['location'].'">'.$maps['location'].'</option>'; } ?> </select> <input type="submit" value="<?=LNG_ME_CHOSE?>"> </form> <form style="position:absolute;top:0px;right:0px;margin-right:5px;" action="?chose_server"> <select name="server"> <option disabled="yes"><?=LNG_ME_CHOSE_SERVER?></option> <?php $ds = opendir('data/server'); while($ss = readdir($ds)) { if($ss !=='.' AND $ss!=='..') { echo '<option value="'.$ss.'">'.$ss.'</option>'; } } if (empty($_SESSION['map']) AND empty($_SESSION['server'])) { $mt = 'test'; $ms = 'test'; } else { $mt = $_SESSION['map']; $ms = $_SESSION['server']; } ?> </select> </form> </div> <div class="block"><br> <?php if(empty($_SESSION['drop_texture'])) $parl = LNG_ME_TEX_CHOSE; else { $isw = mysql_query(" SELECT * FROM `movecontroll` WHERE `texture`='".$_SESSION['drop_texture']."'"); if(mysql_num_rows($isw) !== 0) { $iswb = '<a href="me.set.php?set=unblock&t='.$_SESSION['drop_texture'].'"><input type="button" value="'.LNG_ME_TEX_UNBLOCK.'"></a>'; } else { $iswb = '<a href="me.set.php?set=block&t='.$_SESSION['drop_texture'].'"><input type="button" value="'.LNG_ME_TEX_BLOCK.'"></a>'; } $parl = LNG_ME_TEX.': <br><center><img width"32" height="32" src="interface/graphics/map/'.$_SESSION['drop_texture'].'"><br> '.$iswb.' </center>'; } // CURRENT MAP $sql = mysql_query(" SELECT * FROM `map` WHERE `location` = '".$mt."'"); if(!$sql) { echo '<div class="error">Error: '.mysql_error().'</div>'; } else { echo '<div id="left"><div id="caption_l">'.LNG_ME_CAPT_L.'</div>'.$parl; echo '<form method="post" action="me.set.php?set=add_tip">'.LNG_ME_CAPT_TIP.' <input name="map" type="text" value="'.$mt.'"><br> <input class="px" name="map_x" type="text" placeholder="x"> <input class="px" name="map_y" type="text" placeholder="y"><br> <input type="submit" value="'.LNG_ADD.'"> </form>'; echo LNG_ME_CAPT_REDIRECT.' <form method="post" action="me.set.php?set=add_redirect"> <input name="map" type="text" value="'.$mt.'"><br> <input class="px" name="map_x" type="text" placeholder="x"> <input class="px" name="map_y" type="text" placeholder="y"><br> <input type="submit" value="'.LNG_ADD.'"> </form>'; // CHOOSE MAP if(isset($_GET['chose_map'])) { $_SESSION['map'] = $_POST['map']; echo '<script>location = "me.php";</script>'; exit; } // SELECT TEXTURE if(isset($_GET['select'])) { $_SESSION['drop_texture'] = $_GET['t']; echo '<script>location = "me.php";</script>'; exit; } // DROP TEXTURE if(isset($_GET['drop'])) { $m = mysql_query(" SELECT * FROM `map` WHERE '".$_GET['y']."' AND `location` = '".$_SESSION['map']."'"); $xz = mysql_fetch_assoc($m); $zx = explode('|', $xz[$_GET['y']]); $zx[$_GET['x']] = $_SESSION['drop_texture']; $mass = implode('|', $zx); $sql_s = mysql_query(" UPDATE `map` SET `".$_GET['y']."` = '".$mass."' WHERE `location` = '".$_SESSION['map']."'"); if(!$sql_s) echo mysql_error(); else { echo '<script>location="me.php";</script>'; exit; } } // CENTER BLOCK echo '</div><table id="center" align="center" cellspacing="0" cellpadding="0">'; $loc = mysql_fetch_assoc($sql); $msqlc = count($loc)-2; foreach($loc as $k => $v) { if($k !== 'location' and $k !== 'id') { $e = explode('|', $v); $imgpre = '<img src="interface/graphics/map/'; $imgext = '" alt="[]">'; echo '<tr>'; for($i = 0; $i<$msqlc;$i++){ echo ' <td><a href="?drop&x='.$i.'&y='.$k.'">'.$imgpre.''.$e[$i].''.$imgext.'</a></td>';} echo '</tr>'; } } } // RIGHT BLOCK ?> </table><div id="right"><div id="caption_r"><?=LNG_ME_CAPT_R?></div> <?php $d = opendir('interface/graphics/map/'); while($tx = readdir($d)) { if($tx !== '.' AND $tx !== '..') { echo '<a href="?select&t='.$tx.'"><img src="interface/graphics/map/'.$tx.'"></a>'; } } ?> </div> </div> <div class="bottom"><br><?=LNG_ME_DESC?><br>© <?=CFG_COPY?> <?=CFG_DATE?></div> </body> </html>