Sziasztok. Lenne egy kisebb problémám. Ugye meg van a FreeMetin2-es Cucc kreátor. De valamiért a játékosok tudnak optolni bele -párezer optot. PL: -32215. Ezt hogy lehetne megoldani, hogy ne engedje nekik?
Php-k:
Ezt használják a játékosok: item_manager_new
<div id="content"> <div class="postui2 text-title">
<h2>
Cucc Kreátor
</h2>
</div>
<div class="postui2 text-con">
<div class="con-wrap">
<?php
if (isset($_GET["resume"]))
{
$item_name = $_POST['item_name'];
$id = $_POST['id'];
$item_type = $_POST['item_type'];
if ($_SESSION['cuccos'] < "1000"){
include("ck_max_opt.php");
include("ck_limit.php");
}
if ($_SESSION['cuccos'] > "0"){ //<-- nicht vergessen!
$ck_new = $_POST['aktponts']-1;
$cklog = $_POST['ck_log']+1;
$res_update = mysql_query("UPDATE account.account SET web_aktiviert='".$ck_new."', ck_elhasznalt='".$cklog."' WHERE id='".$_SESSION['user_id']."' LIMIT 1");
$con = mysql_connect($db_ip, $db_login, $db_pw);
mysql_select_db("player", $con);
$res_update = mysql_query("UPDATE item SET
attrtype0 = '".$_POST['selected_type_0']."',
attrtype1 = '".$_POST['selected_type_1']."',
attrtype2 = '".$_POST['selected_type_2']."',
attrtype3 = '".$_POST['selected_type_3']."',
attrtype4 = '".$_POST['selected_type_4']."',
attrtype5 = '".$_POST['selected_type_5']."',
attrtype6 = '".$_POST['selected_type_6']."',
attrvalue0 = '".$_POST['selected_value_0']."',
attrvalue1 = '".$_POST['selected_value_1']."',
attrvalue2 = '".$_POST['selected_value_2']."',
attrvalue3 = '".$_POST['selected_value_3']."',
attrvalue4 = '".$_POST['selected_value_4']."',
attrvalue5 = '".$_POST['selected_value_5']."',
attrvalue6 = '".$_POST['selected_value_6']."'
WHERE id = '".$id."'");
echo "
<BR CLEAR=HEIGHT>
<div id='item_manager_new'><form name='post' method='post' action='index.php?s=item_manager_new&resume'>
<table frame='box' width='100%' align='left' class=''>
</table>
</div>";
exit("<center>Sikeresen beállítva! Kiveheted a ".$item_name." -t a raktárból.<br/><a href='index.php?s=user'>Sikeresen Beállítva! Még ".$_SESSION['cuccos']." </a> <a href='index.php?s=item_manager_new&id=".$id."'><< Vissza</a></center>
</div>
</div>
<div class='postui2 text-end'>
</div></div>
</div>
<center><font color='CCC'> Copyright 2011 by BeispielMt2, Design & Code by Stagnis, CMS by Hennink</font></center>
<img src='img/main_bt.png' width='800' height='16' /></div><br />
");
}else{exit("<center><a href='index.php?s=ck_buy'>Nincs elég CK pontod a használathoz!</a> <a href='index.php?s=item_manager_new&id=".$id."'><< Vissza</a></center>
</div>
</div>
<div class='postui2 text-end'>
</div></div>
</div>
<center><font color='CCC'> Copyright 2011 by BeispielMt2, Design & Code by Stagnis, CMS by Hennink</font></center>
<img src='img/main_bt.png' width='800' height='16' /></div><br />
");}
}
if (isset($_GET["id"]))
{
echo "
<BR CLEAR=HEIGHT>
<div id='item_manager_new'><form name='post' method='post' action='index.php?s=item_manager_new&resume'>
<table frame='box' width='100%' align='left' class=''>
</table>
</div>
<br>
<table width='100%' align='left' border=0>
<tr>
<th align='left' height='25px'></th>
</tr>
</table>
<br>
";
$con = mysql_connect($db_ip, $db_login, $db_pw);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("player", $con);
$id = $_GET["id"];
$item_type = $_GET["t"];
$item_subtype = $_GET["st"];
$result_item = mysql_query("SELECT * FROM item WHERE id='".$id."'");
if (mysql_num_rows($result_item) != 1) {exit("A keresett tárgy nem létezik!
</div>
</div>
<div class='postui2 text-end'>
</div></div>
</div>
<center><font color='CCC'> Copyright 2011 by BeispielMt2, Design & Code by Stagnis, CMS by Hennink</font></center>
<img src='img/main_bt.png' width='800' height='16' /></div><br />
");}
while($row = mysql_fetch_array($result_item))
{
echo "
<table frame='box' width='400px' align='left' cellspacing='0' cellpadding='0'>
";
$vnum = $row['vnum'];
$window = $row['window'];
$result_owner = mysql_query("SELECT * FROM account.account WHERE id ='".$row['owner_id']."'") or die("A MySQL error has occurred.<br />Your Query: " . $result_owner . "<br /> Error: (" . mysql_errno() . ") " . mysql_error());
while($row = mysql_fetch_array($result_owner))
{
$owner_name = $row['login'];
$ck_log = $row['ck_elhasznalt'];
$aktponts = $row['web_aktiviert'];
$pont=1;
}
$result_item_name = mysql_query("SELECT * FROM item_proto WHERE vnum ='".$vnum."'");
while($row = mysql_fetch_array($result_item_name))
{
$item_name = $row['locale_name'];
$item_type = $row['type'];
$item_subtype = $row['subtype'];
}
echo "
<tr>
<td>Name:</td>
<td>".$item_name.", ".$item_type.", </td>
<input type='hidden' name='item_name' value='".$item_name."'>
<input type='hidden' name='ck_log' value='".$ck_log."'>
<input type='hidden' name='aktponts' value='".$aktponts."'>
<input type='hidden' name='pont' value='".$pont."'>
<input type='hidden' name='item_type' value='".$item_type."'>
</tr>
<tr>
<td>Tulajdonos:</td>
<td>".$owner_name."</td>
</tr>
<tr>
<td>ID:</th>
<td>".$id."</th>
<input type='hidden' name='id' value='".$id."'>
</tr>
<tr>
<td>vnum:</th>
<td>".$vnum."</th>
</tr>
";
if ($window == "INVENTORY"){$state = "im Inventar";}
if ($window == "MALL"){$state = "Bolt raktárban";}
if ($window == "SAFEBOX"){$state = "Raktárban";}
echo "
<tr>
<td>Status:</th>
<td>".$state."</th>
</tr>
</table>
<br>
<table width='100%' align='left' border=0>
<tr>
<th align='left' height='25px'></th>
</tr>
</table>
<br>
";
show_bonipanel($id);
//echo "<table width='400px' align='right' cellspacing='0' cellpadding='0'><tr><td align='right'><input name='resume' value='Alkalmaz' type='submit' class='button'></td></tr></table>";
}
}
else
{
echo "ERROR: Keine Item-ID!";
}
function show_bonipanel($id)
{
$result_item = mysql_query("SELECT * FROM item WHERE id='".$id."'");
while($row = mysql_fetch_array($result_item))
{
$dropdown_options_0;
$dropdown_options_1;
$dropdown_options_2;
$dropdown_options_3;
$dropdown_options_4;
$dropdown_options_5;
$dropdown_options_6;
$line = 0;
$line_plus = 0;
$vnum = $row['vnum'];
$attrtype0 = $row['attrtype0'];
$attrtype1 = $row['attrtype1'];
$attrtype2 = $row['attrtype2'];
$attrtype3 = $row['attrtype3'];
$attrtype4 = $row['attrtype4'];
$attrtype5 = $row['attrtype5'];
$attrtype6 = $row['attrtype6'];
$attrvalue0 = $row['attrvalue0'];
$attrvalue1 = $row['attrvalue1'];
$attrvalue2 = $row['attrvalue2'];
$attrvalue3 = $row['attrvalue3'];
$attrvalue4 = $row['attrvalue4'];
$attrvalue5 = $row['attrvalue5'];
$attrvalue6 = $row['attrvalue6'];
$result_item_name = mysql_query("SELECT * FROM item_proto WHERE vnum ='".$vnum."'");
while($row = mysql_fetch_array($result_item_name))
{
$item_name = $row['locale_name'];
$item_type = $row['type'];
$item_subtype = $row['subtype'];
}
$attr_list_plus = file("attr_list/attr_list_plus.txt");
if(($item_type == 1) && ($item_subtype != 6)) {
$attr_list = file("attr_list/attr_list_kard.txt");
}
elseif(($item_type == 2) && ($item_subtype == 0)) {
$attr_list = file("attr_list/attr_list_vert.txt");
}
elseif(($item_type == 2) && ($item_subtype == 2)) {
$attr_list = file("attr_list/attr_list_pajzs.txt");
}
elseif(($item_type == 2) && ($item_subtype == 4)) {
$attr_list = file("attr_list/attr_list_cipo.txt");
}
elseif(($item_type == 2) && ($item_subtype == 1)) {
$attr_list = file("attr_list/attr_list_sisak.txt");
}
elseif(($item_type == 2) && ($item_subtype == 5)) {
$attr_list = file("attr_list/attr_list_nyaklanc.txt");
}
elseif(($item_type == 2) && ($item_subtype == 3)) {
$attr_list = file("attr_list/attr_list_karkoto.txt");
}
elseif(($item_type == 2) && ($item_subtype == 6)) {
$attr_list = file("attr_list/attr_list_fulbevalo.txt");
}
else{
exit("Nem módosíthatod ezt a tárgyat: ".$item_name."
</div>
</div>
<div class='postui2 text-end'>
</div></div>
</div>
<center><font color='CCC'> Copyright 2011 by BeispielMt2, Design & Code by Stagnis, CMS by Hennink</font></center>
<img src='img/main_bt.png' width='800' height='16' /></div><br />
");
}
//while($line < key($attr_list)+1)
while($attr_list[$line])
{
$exploded = explode(" - ", $attr_list[$line]);
$type_id = $exploded[0];
$type_name = $exploded[1];
if ($type_id == $attrtype0){$dropdown_options_0 = $dropdown_options_0."<option value ='".$type_id."' selected='selected'>".$type_name."</option>";}else{$dropdown_options_0 = $dropdown_options_0."<option value ='".$type_id."'>".$type_name."</option>";}
if ($type_id == $attrtype1){$dropdown_options_1 = $dropdown_options_1."<option value ='".$type_id."' selected='selected'>".$type_name."</option>";}else{$dropdown_options_1 = $dropdown_options_1."<option value ='".$type_id."'>".$type_name."</option>";}
if ($type_id == $attrtype2){$dropdown_options_2 = $dropdown_options_2."<option value ='".$type_id."' selected='selected'>".$type_name."</option>";}else{$dropdown_options_2 = $dropdown_options_2."<option value ='".$type_id."'>".$type_name."</option>";}
if ($type_id == $attrtype3){$dropdown_options_3 = $dropdown_options_3."<option value ='".$type_id."' selected='selected'>".$type_name."</option>";}else{$dropdown_options_3 = $dropdown_options_3."<option value ='".$type_id."'>".$type_name."</option>";}
if ($type_id == $attrtype4){$dropdown_options_4 = $dropdown_options_4."<option value ='".$type_id."' selected='selected'>".$type_name."</option>";}else{$dropdown_options_4 = $dropdown_options_4."<option value ='".$type_id."'>".$type_name."</option>";}
while($attr_list_plus[$line_plus])
{
$exploded_plus = explode(" - ", $attr_list_plus[$line_plus]);
$type_id_plus = $exploded_plus[0];
$type_name_plus = $exploded_plus[1];
if ($type_id_plus == $attrtype5){$dropdown_options_5 = $dropdown_options_5."<option value ='".$type_id_plus."' selected='selected'>".$type_name_plus."</option>";}else{$dropdown_options_5 = $dropdown_options_5."<option value ='".$type_id_plus."'>".$type_name_plus."</option>";}
if ($type_id_plus == $attrtype6){$dropdown_options_6 = $dropdown_options_6."<option value ='".$type_id_plus."' selected='selected'>".$type_name_plus."</option>";}else{$dropdown_options_6 = $dropdown_options_6."<option value ='".$type_id_plus."'>".$type_name_plus."</option>";}
$line_plus++;
}
$line++;
}
echo "
<table frame='box' width='400px' align='left' cellspacing='0' cellpadding='0'>
<tr>
<td>1.</td>
<td><select name = selected_type_0>".$dropdown_options_0."</select></td>
<td><input type='text' name='selected_value_0' value='".$attrvalue0."' maxlength='6' class='textbox' style='width: 100px;'></td>
</tr>
<tr>
<td>2.</td>
<td><select name = selected_type_1>".$dropdown_options_1."</select></td>
<td><input type='text' name='selected_value_1' value='".$attrvalue1."' maxlength='6' class='textbox' style='width: 100px;'></td>
</tr>
<tr>
<td>3.</td>
<td><select name = selected_type_2>".$dropdown_options_2."</select></td>
<td><input type='text' name='selected_value_2' value='".$attrvalue2."' maxlength='6' class='textbox' style='width: 100px;'></td>
</tr>
<tr>
<td>4.</td>
<td><select name = selected_type_3>".$dropdown_options_3."</select></td>
<td><input type='text' name='selected_value_3' value='".$attrvalue3."' maxlength='6' class='textbox' style='width: 100px;'></td>
</tr>
<tr>
<td>5.</td>
<td><select name = selected_type_4>".$dropdown_options_4."</select></td>
<td><input type='text' name='selected_value_4' value='".$attrvalue4."' maxlength='6' class='textbox' style='width: 100px;'></td>
</tr>
<tr>
<td>6.</td>
<td><select name = selected_type_5>".$dropdown_options_5."</select></td>
<td><input type='text' name='selected_value_5' value='".$attrvalue5."' maxlength='6' class='textbox' style='width: 100px;'></td>
</tr>
<tr>
<td>7.</td>
<td><select name = selected_type_6>".$dropdown_options_6."</select></td>
<td><input type='text' name='selected_value_6' value='".$attrvalue6."' maxlength='6' class='textbox' style='width: 100px;'></td>
</tr>
<tr>
<td></td>
<td>______________________________________</td>
</tr>
<tr>
<td></td>
<td align='right'><input name='resume' value='Alkalmaz (Csak egyszer nyomd meg!)' type='submit' class='button'></td>
</tr>
</table>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
</div>
</div>
<div class='postui2 text-end'>
</div></div>
";
}
}
?>
Ebben mit kellene átírni hogy ne tudjanak mínusz optot belerakni?
Nem is gondoltam volna hogy ilyen egyszerű megoldani, ha valakinek kellene ebben segítség, írjon privátot nyugodtan.
Kiindulási pont: MySQL