Buenas, que tal, queria saber si me pueden dar una mano.
e editado el archivo del modulo exchangue , lo modifique para que solamente pueda dar creditos por reset y horas jugadas, el tema es que quisiera ponerle algunos scripts de seguridad para que no me jodan la DB... alguien me puede ayudar a ponerle un par de codes para que prohíba caracteres? y si se puede y alguien sabe algunos scripts de seguridad de más??
les dejo el code:
<?php
$exchange_settings = simplexml_load_file('engine/config_mods/exchange.xml');
$cred = $exchange_settings->cash;
$resets_need = $exchange_settings->resets_need;
$online_hour_need = $exchange_settings->online_hour_need;
$onlinecheck1 = mssql_query("SELECT ConnectStat from MEMB_STAT where memb___id='$user_auth_id'");
$onlinecheck = mssql_fetch_row($onlinecheck1);
$character = HTMLSpecialChars(trim($_POST['character']), ENT_QUOTES);
if($onlinecheck[0] != 0)
{
echo msg('0','You are in game.');
}
else
{
if (isset($_POST['movecoin']))
{
$changec = htmlspecialchars($_POST['changec'],ENT_QUOTES);
$amount = htmlspecialchars($_POST['coin_amount'],ENT_QUOTES);
$character = htmlspecialchars(trim($_POST['character']), ENT_QUOTES);
$cred = mssql_query("SELECT cash FROM MEMB_INFO WHERE memb___id='$user_auth_id'");
$kredit = mssql_fetch_array($cred);
$online1 = mssql_query("SELECT OnlineHours from MEMB_STAT where memb___id='$user_auth_id'");
$online = mssql_fetch_row($online1);
$hours = floor($online[0] / 60);
$resets1 = mssql_query("SELECT RESETS from Character where AccountID='$user_auth_id' and Name = '$character'");
$resets = mssql_fetch_row($resets1);
if($changec == 'resets')
{
if (!eregi("^[0-9\]{1,11}$", $amount))
{
echo msg('0','Valor incorrecto');
}
elseif ($amount > $resets[0])
{
echo msg('0','No tiene suficientes resets');
}
elseif (($amount % $resets_need) != 0)
{
echo msg('0','Introduce el valor que se puede dividir por '.$resets_need.'');
}
else
{
$new_cred = ($amount/$resets_need)+$kredit[0];
$new_resets = $resets[0]-$amount;
mssql_query("UPDATE MEMB_INFO SET cash='$new_cred' WHERE memb___id='$user_auth_id'");
mssql_query("UPDATE Character SET RESETS='$new_resets' WHERE Name='$character'");
echo msg('1','El intercambio tuvo éxito');
}
}
if($changec == 'online')
{
if (!eregi("^[0-9\]{1,11}$", $amount))
{
echo msg('0','Valor incorrecto');
}
elseif ($amount > $hours)
{
echo msg('0','No hay suficientes horas en línea');
}
elseif (($amount % $online_hour_need) != 0)
{
echo msg('0','Introduce el valor que se puede dividir por '.$online_hour_need.'');
}
else
{
$new_cred = ($amount/$online_hour_need)+$kredit[0];
$new_time = ($hours-$amount) * 60;
mssql_query("UPDATE MEMB_INFO SET cash='$new_cred' WHERE memb___id='$user_auth_id'");
mssql_query("UPDATE MEMB_STAT SET OnlineHours='$new_time' WHERE memb___id='$user_auth_id'");
echo msg('1','El intercambio tuvo éxito');
}
}
}
$cred = mssql_query("SELECT cash FROM MEMB_INFO WHERE memb___id='$user_auth_id'");
$kredit = mssql_fetch_array($cred);
$online2 = mssql_query("SELECT OnlineHours from MEMB_STAT where memb___id='$user_auth_id'");
$online3 = mssql_fetch_row($online2);
$hours1 = floor($online3[0] / 60);
echo '<br><font color="white"><b>Creditos: '.number_format($kredit[0]).'</b><br>';
echo '<b>Tus Horas Online: '.number_format($hours1).'</b></font><br><br>';
?>
<form action="" method="post" onsubmit="request("form_vip","sh_","POST","getpage.php?cat=EX-change"); return false;">
<br><br>
<table>
<tr>
<td>
<b>Que deseas cambiar por creditos?</b>
</td>
<td align="right">
<select class="iRg_input" style="width: 100px" name="changec">
<!--<option value="cred_zen">Zen</option>-->
<option value="resets">Resets</option>
<option value="online">Horas ON</option>
<!--<option value="joc">JoC</option>-->
</select>
</td>
<td align="right">
<?php
$query = mssql_query("select [Name],[Class] from [Character] where [AccountID]='".$user_auth_id."'");
$i = 0;
$mychars= '';
while($i<mssql_num_rows($query)) {
$char = mssql_fetch_array($query);
$i++;
$mychars.="<option class=\"clchg\" value=\"".htmlspecialchars($char['Name'])."\">".$char['Name']."</option>";
}
?>
<select class="iRg_input" style="width: 100px" name="character">
<optgroup label="Select a character">
<?php echo $mychars; ?>
</select></td>
</tr>
<tr>
<td><b>Importe a canjear</b>
</td>
<td align="right"><input type="text" class="iRg_input" size="11" maxlength="11" name="coin_amount" value="0" />
</td>
</tr>
<tr><td><input type="submit" class="button-gray" name="movecoin" value="Canjear" /></td></tr>
</table>
<br><br>
<font color="white">*Nota*:<br>
<font color="yellow" >*Precios de intercambio:<br>
Horas / creditos: <?echo $online_hour_need;?> obtienes 20 creditos.<br>
Resets / Creditos: <?echo $resets_need;?> obtienes 25 creditos.
</font>
<?php
}
?>