Postado Outubro 20, 2016 8 anos Please changue PHP znote for PHP Gesior <?php require_once 'engine/init.php'; include 'layout/overall/header.php'; protect_page();?> <div class="news_info"> <div><!--<img src="layout/images/rl/titles/buycoins.gif">--></div> </div> <div class="news_message"> <div class="news_body"> <h2>Castle System:</h2><br> <?php function castleIsAvailable($castle_id){ $castle = mysql_select_single("SELECT `castle_id` FROM `castle_rented` WHERE `castle_id`=".$castle_id); if(!$castle){ return true; } return false; } function getPlayerId($account_id){ $acc = mysql_select_single("SELECT `id` FROM `players` WHERE `account_id` = ".$account_id); if($acc){ return (int)$acc['id']; } return false; } function setPlayerCastle($cid, $castleid, $time){ $playerid = getPlayerId($cid); print($time); mysql_insert("INSERT INTO `castle_rented` (`id`, `castle_id`, `player_id`, `time`, `castle_invited`) VALUES ('', '".$castleid."', '".$playerid."', '".$time."', '1')"); } function getNameByPlayerId($player_id){ $name = mysql_select_single("SELECT `name` FROM `players` WHERE `id`=".$player_id); if($name){ return $name['name']; } return false; } if (isset($_POST['castle']) && isset($_POST['castleid'])){ $castleID = (int)$_POST['castleid']; if(castleIsAvailable($castleID)){ $castleDB = mysql_select_single("SELECT `price`, `time_rented` FROM `castle` WHERE `id` = ".$castleID); if ($castleDB != false) { $castlePrice = (int)$castleDB['price']; $castleTime = $castleDB['time_rented']; $time = time(); $player_points = (int)$user_znote_data['points']; $cid = (int)$user_data['id']; if($player_points >= $castlePrice){ $data = mysql_select_single("SELECT `points` FROM `znote_accounts` WHERE `account_id`='$cid';"); $old_points = $data['points']; if ((int)$old_points != (int)$player_points) die("1: Failed to equalize your points."); // Remove points if they can afford // Give points to user $expense_points = $castlePrice; $new_points = $old_points - $expense_points; $update_account = mysql_update("UPDATE `znote_accounts` SET `points`='$new_points' WHERE `account_id`='$cid'"); setPlayerCastle($cid, $castleID, time()+$castleTime); echo "<b>En hora buena, usted a obtenido su castillo con respawn, para entrar al castillo utilize el comando \"!castle goto\" en el juego.</b><br><br>"; }else{ echo "<b>Usted no cuenta con los suficientes puntos para comprar este castillo.</b><br><br>"; } //print($cid); }else{ echo "<b>El castillo no existe. comuniquese con el administrador.</b><br><br>"; } }else{ echo "<b>El castillo ya esta ocupado.</b><br><br>"; } } ?> <?php echo " <b>Comandos que puedes utilizar:</b><br><br> <b>!castle goto</b>: te teletransporta a ti o a los miembros de tu guild al castillo.<br> <b>!castle on</b>: Activa las visitas a tu castillo, todos los miembros de tu guild pueden visitar tu castillo.<br> <b>!castle off</b>: Desactiva las visitas a tu castillo. nadie excepto tú puede entrar.<br><br> <b>Nota:</b> Si usted quiere cambiar el respawn comuniquise con el adm.<br><br> "; $castles = mysql_select_multi("SELECT * FROM `castle`"); echo "<table class='table table-condensed table-content table-striped'> <tr> <td style='text-align:center;width:7%;'><b>Castle:</b></td> <td style='text-align:center;width:7%;'><b>Points:</b></td> <td style='text-align:center;width:36%;'><b>respawn:</b></td> <td style='text-align:center;width:10%;'><b>time:</b></td> <td style='text-align:center;width:20%;'><b>Action:</b></td> </tr> "; foreach ($castles as $castle) { $castles_rented = mysql_select_single("SELECT `player_id`, `time` FROM `castle_rented` WHERE `castle_id` = ".$castle['id']); $expire = date('d/m/Y H:i:s', $castles_rented['time']); echo " <tr> <td style='text-align:center;vertical-align: middle;'>#".$castle['id']."</td> <td style='text-align:center;vertical-align: middle;'>".$castle['price']."</td> <td style='text-align:center;vertical-align: middle;'>".$castle['respawn']."</td> <td style='text-align:center;vertical-align: middle;'>".(intval($castle['time_rented'])/24/60/60)." DAYS.</td>"; if ($castles_rented['player_id']){ echo "<td style='text-align:center;vertical-align: middle;'>Owner By:<br><b>".getNameByPlayerId($castles_rented['player_id'])."</b><br><font style='font-size:10px;font-family: monospace;'>expire: ".$expire."<font></td>"; }else{ echo " <td style='text-align:center;'> <form action='' method='post'> <input type='submit' name='castle' value='BUY NOW' style='margin: auto;'> <input type='hidden' name='castleid' value='".$castle['id']."'> </form> </td>"; } echo "</tr>"; } echo "</table>"; ?> </div> </div> <?php include 'layout/overall/footer.php'; ?> Editado Outubro 20, 2016 8 anos por methemia (veja o histórico de edições)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.