السلام عليكم الان ملف شراء السكن
buypop.php
Spoiler:
<?php
/*********************/
/* */
/* Version : 5.1.0 */
/* Author : RM */
/* Comment : 071223 */
/* */
/*********************/
require( ".".DIRECTORY_SEPARATOR."app".DIRECTORY_SEPARATOR."boot.php" );
class GPage extends ProcessVillagePage
{
public $troops = array( );
public $heroCount = 0;
public function GPage( )
{
parent::processvillagepage( );
$this->viewFile = "buypop.phtml";
$this->contentCssClass = "village1";
}
public function load( )
{
if ( isset( $_GET['_gn_'] ) && !$this->player->isSpy )
{
require_once( MODEL_PATH."profile.php" );
$mprof = new ProfileModel( );
$mprof->resetGNewsFlag( $this->player->playerId );
}
parent::load( );
$this->heroCount = $this->data['hero_in_village_id'] == $this->data['selected_village_id'] ? 1 : 0;
$t_arr = explode( "|", $this->data['troops_num'] );
foreach ( $t_arr as $t_str )
{
$t2_arr = explode( ":", $t_str );
$t2_arr = explode( ",", $t2_arr[1] );
foreach ( $t2_arr as $t2_str )
{
list( $tid, $tnum ) = tid;
if ( $tid == 99 || $tnum == 0 );
{
continue;
}
if ( $tnum == 0 - 1 )
{
$this->heroCount++;
continue;
}
if ( isset( $this->troops[$tid] ) )
{
$this->troops[$tid] += $tnum;
}
else
{
$this->troops[$tid] = $tnum;
}
}
}
ksort( $this->troops, SORT_NUMERIC );
}
public function getBuildingName( $id )
{
return htmlspecialchars( constant( "item_".$this->buildings[$id]['item_id'] )." ".level_lang." ".$this->buildings[$id]['level'] );
}
public function getBuildingTitle( $id )
{
$name = $this->getBuildingName( $id );
return "title=\"".$name."\" alt=\"".$name."\"";
}
}
$p = new GPage( );
$p->run( );
?>
الملف الثاني
app/view/buypop.phtml
كود
Spoiler:
<?
//decode by bazaid
//
?>
<?
include('app/config.php');$db_connect = mysql_connect($AppConfig['db']['host'],$AppConfig['db']['user'],$AppConfig['db']['password']);mysql_select_db($AppConfig['db']['database'], $db_connect);$query = mysql_query("SELECT * FROM p_players");$query1 = mysql_query("SELECT * FROM p_villages");$data1 = mysql_fetch_array($query1);$data = mysql_fetch_array($query);
?>
_______________________________________________________
<h1>المتجر <span class="level"><font color='orange'>شراء مستوى للبطل //</font></span></h1>
<p class="new_building"></p>
<table border="0">
<center><h1><font size="4">كل 100 مستوى بطل 25 ذهب</font><p>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
<table border="0">
<tr><td>اسم اللاعب</td><td>
<input type="text" name="id" maxlength="60" disabled="disabled" value="<?php echo $this->data['name']; ?>">
</td></tr>
<tr><td>رقم القرية:</td><td>
<input type="text" name="village" maxlength="60" disabled="disabled" value="<?php echo $this->data['selected_village_id']; ?>">
</td></tr><tr><td>اسم القرية</td><td>
<input type="text" name="villagename" maxlength="60" disabled="disabled" value="<?php echo $this->data['village_name']; ?>">
</td></tr>
<td>عدد السكان</td><td>
<input type="text" name="username" maxlength="60" disabled="disabled" value="<?php echo $this->data['total_people_count']; ?>">
</td></tr>
<tr><td colspan="2" align="right">
<input type="submit" name="submit" value="اضافة 100 سكان لهذه القرية">
<tr><td colspan="2" align="center">
<input type="submit" name="submit1" value="العودة الى القرية">
</td></tr> </center>
</table>
</form>
<br/><br/> <?php $Id = $this->player->playerId; $village = $this->data['selected_village_id']; ?>
لديك
<?php
echo $this->data['gold_num'];
?>
ذهب
<p>
<center><br /><p>
</h2>
<?php $gold = $this->data['gold_num']; ?>
<?php include ("extra.php");
if (isset($_POST['submit1']))
echo "<meta http-equiv=\"Refresh\" content=\"0; url=village1.php\">\n";
if (isset($_POST['submit']))
{
// if form has been submitted
$sql = mysql_query("SELECT * FROM p_players WHERE id = $Id ")or die(mysql_error());
while($row = mysql_fetch_array($sql)){
};
$sql = mysql_query("SELECT * FROM p_players WHERE id = $Id ")or die(mysql_error());
while($row = mysql_fetch_array($sql)){
$gold = $this->data['gold_num'];
};
if ($gold < 25 ) {
die ("<h1><font color='red'>الذهب غير كافي</font>\n");
}
else {
mysql_query("UPDATE p_players SET gold_num =gold_num - 25 WHERE id = $Id")or die(mysql_error());
mysql_query("UPDATE p_players SET `total_people_count` = `total_people_count` +100 WHERE id = $Id")or die(mysql_error());
mysql_query("UPDATE p_players SET `week_dev_points` = `week_dev_points` +100 WHERE id = $Id")or die(mysql_error());
mysql_query("UPDATE p_players SET `total_people_count` = `total_people_count` +100 WHERE id = $village")or die(mysql_error());
echo "<h1><font color='red'>تمت العملية بنجاح</font>"; echo "<meta http-equiv=\"REFRESH\" content=\"3;url=profile.php\">\n";
}
}
?>
واذا تبي تظيف فى الاحصائيات
app/view/layout/game.phtml
وعدل عليه ومبروك عليك السكن
الموضوع منقول لاافاده وشكرا ارجو التتقيم والسلام عليكم cheers [center]