PDA

View Full Version : درخواست کمک برای نوشتن یک کد



aliforever
دوشنبه 06 شهریور 1391, 17:40 عصر
سلام دوستان .
این کد در رابطه با اسکریپت تراوین هست .
من این کد رو می خوام بنویسم تا ادمین بتونه از داخل کنترل پنلش به بازیکنها نیرو بده :
- من از دو فایل در این اسکریپت استفاده کردم ولی کامل نیست هنوز .
- میخواستم ببینم مشکل این کد چیه ؟؟؟

<?php
//Config File
include("Templates/db/config.php");

if($_POST['submit'] == "submit")
{
$varlegion = $_POST['name'];
$varlegion = $_POST['legion'];
$varmohafez = $_POST['mohafez'];
$varshamshirzan = $_POST['shamshirzan'];
$varjasoos = $_POST['jasoos'];
$varshovalie = $_POST['shovalie'];
$varsezar = $_POST['sezar'];
$vardejkoob = $_POST['dejkoob'];
$varmanjanigh = $_POST['manjanigh'];
$varsenator = $_POST['senator'];
$varmohajer = $_POST['mohajer'];
$errorMessage = "";
// - - - snip - - -
}
$sql="Update p_villages Set troops_num = \-1:1 '$_POST['legion']',2 '$_POST['mohafez']',3 '$_POST['shamshirzan']',4 '$_POST['jasoos']',5 '$_POST['shovalie']',6 '$_POST['sezar']',7 '$_POST['dejkoob']',8 '$_POST['manjanigh']',9 '$_POST['senator']',10 '$_POST['mohajer']',99 0\ Where Name = '$_POST[name]'";
mysql_query($sql);
header("location: ../../?p=troops&gttr=gttr");
?>



اینم کد html فرم هست :

<form action="Templates/troops/roman.php" method="post">
<center><p class="ex"><strong>نژاد رومی ها :</strong></p></center>
<center><p><strong>نام دقیق بازیکن را بدون فاصله وارد کنید :</strong></p></center>
<center>
<input name="name" type="name" style="width: 86px" value="در اینجا وارد کنید" /> <br></center>
<table border="1" align="center">
<tr>
<td style="height: 26px" class="auto-style3"><img alt="لژیون" src="Templates/troops/images/roman/legion.png" title="لژیون"></td>
<td style="height: 26px" class="auto-style3"><img alt="محافظ" src="Templates/troops/images/roman/mohafez.png" title="محافظ"></td>
<td style="height: 26px" class="auto-style3"><img alt="شمشیر زن" src="Templates/troops/images/roman/shamshirzan.png" title="شمشیر زن"></td>
<td style="height: 26px" class="auto-style3"><img alt="جاسوس" src="Templates/troops/images/roman/jasoos.png" title="جاسوس"></td>
<td style="height: 26px" class="auto-style3"><img alt="شوالیه" src="Templates/troops/images/roman/shovalie.png" title="شوالیه"></td>
<td style="height: 26px" class="auto-style3"><img alt="شوالیه سزار" src="Templates/troops/images/roman/sezar.png" title="شوالیه سزار"></td>
<td style="height: 26px" class="auto-style3"><img alt="دژکوب" src="Templates/troops/images/roman/dejkoob.png" title="دژکوب"></td>
<td style="height: 26px" class="auto-style3"><img alt="منجنیق آتشین" src="Templates/troops/images/roman/manjanigh.png" title="منجنیق آتشین"></td>
<td style="height: 26px" class="auto-style3"><img alt="سناتور" src="Templates/troops/images/roman/senator.png" title="سناتور"></td>
<td style="height: 26px" class="auto-style3"><img alt="مهاجر" src="Templates/troops/images/roman/mohajer.png" title="مهاجر"></td>
</tr>
<tr>
<td class="auto-style3"><input name="legion" style="width: 37px" type="text" value="<?=$varlegion;?>" /></td>
<td class="auto-style3"><input name="mohafez" style="width: 37px" type="text" value="<?=$varmohafez;?>" /></td>
<td class="auto-style3"><input name="shamshirzan" style="width: 37px" type="text" value="<?=$varshamshirzan;?>" /></td>
<td class="auto-style3"><input name="jasoos" style="width: 37px" type="text" value="<?=$varjasoos;?>" /></td>
<td class="auto-style3"><input name="shovalie" style="width: 40px" type="text" value="<?=$varshovalie;?>" /></td>
<td class="auto-style3"><input name="sezar" style="width: 37px" type="text" value="<?=$varsezar;?>" /></td>
<td class="auto-style3"><input name="dejkoob" style="width: 37px" type="text" value="<?=$vardejkoob;?>" /></td>
<td class="auto-style3"><input name="manjanigh" style="width: 37px" type="text" value="<?=$varmanjanigh;?>" /></td>
<td class="auto-style3"><input name="senator" style="width: 37px" type="text" value="<?=$varsenator;?>" /></td>
<td class="auto-style3"><input name="mohajer" style="width: 37px" type="text" value="<?=$varmohajer;?>" /></td>
</tr>
</table>
<center><input name="submit" type="submit" value="ذخیره اطلاعات" /></center>
</form>
<?php
if(isset($_POST['Sub'])) header("Location: Templates/troops/roman.php");
if($_GET['gttr'] == gttr) echo "<center><font color = red size = 4><b>دستور با موفقیت انجام شد !";
?>

aliforever
سه شنبه 07 شهریور 1391, 08:45 صبح
یه انجمن php سراغ ندارین یکم زودتر جواب بدن ؟؟
خیلی ضروریه