<? session_start();
include 'cnn.php';
@$login = $_SESSION['login'];
@$senha = $_SESSION['senha'];
if(!isset($_SESSION['login'])) { echo "<strong>Para acessar essa pagina é preciso esta logado</strong>"; }
else{
$vip=mssql_fetch_row(mssql_query("select vip from memb_info where memb___id='".$login."'"));
if($vip[0] == 0) { echo "<strong>Para acessar essa pagina é preciso ser Silver Vip</strong>"; }
else{
?>
<h1>Mover Personagem</h1>
<form name="form1" method="post" action="">
<div class="quadros">
<label>Personagem:</label>
<select name="char" id="char">
<?
$Chars = mssql_query("select name from character where accountid='".$login."'");
for($p=0;$p<mssql_num_rows($Chars);$p++) {
$Char=mssql_fetch_row($Chars);
echo '<option value='.$Char[0].'>'.$Char[0].'</option>';
}
?>
</select>
<label>Mapa: </label>
<select name="mapa" size="1" id="mapa">
<option value="0">Lorencia</option>
<option value="2">Devias</option>
<option value="3">Noria</option>
<option value="4">LostTower</option>
<option value="1">Dungeon</option>
<option value="7">Atlans</option>
<option value="8">Tarkan</option>
<option value="10">Icarus</option>
</select>
<label>Coordenadas: </label>
<label>X: <input name="x" type="text" id="x" size="5" maxlength="3" class="submit"></label>
<label>Y: <input name="y" type="text" id="y" size="5" maxlength="3" class="submit"></label>
<br />
<br />
<input name="prossegue" type="submit" class="submit" id="prossegue" value="Mover">
</div>
</form>
<?
if($_POST['prossegue']) {
$char=$_POST['char'];
$mapa=$_POST['mapa'];
$x=$_POST['x'];
$y=$_POST['y'];
$VerificaStatus = mssql_fetch_row(mssql_query("select connectstat from memb_stat where memb___id='".$login."'"));
$VerificaChar = mssql_num_rows(mssql_query("select name from character where name='".$char."' and accountid='".$login."'"));
if($VerificaChar <= 0) { 
echo "<script>alert('Personagem incorreto'); 
location='javascript:history.back()'</script>"; 
}
elseif($VerificaStatus[0] >= 1){
echo "<script>alert('Desconecte a conta'); 
location='javascript:history.back()'</script>";
}
else{
if(empty($x) || empty($y)) {
echo "<script>alert('Digite as coordenadas'); 
location='javascript:history.back()'</script>"; 
}
else{
mssql_query("update character set mapnumber='".$mapa."',mapposx='".$x."',mapposy='".$y."' where name='".$char."'");
echo "<script>alert('Movido com sucesso'); 
location='javascript:history.back()'</script>"; 
} } }
 } } 
 
?>