here is the add stats that i am using for bkcp
Code:
<?php
//
require("config.php");
$login = stripslashes($_SESSION['user']);
include_once('sql_check.php');
check_inject();
require_once "sql_inject.php";
require_once "sql.class.php";
$bDestroy_session = TRUE;
$url_redirect = 'error.php';
$sqlinject = new sql_inject('sqlinject/log_file_sql.log',$bDestroy_session,$url_redirect) ;
function valid($word)
{
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
for($i=0;$i<strlen($word);$i++)
{
$ch = substr($word,$i,1);
$nol = substr_count($chars,$ch);
if($nol==0)
{
return true;
}
}
return false;
}
function getchar($character)
{
$uid = mssql_fetch_array(mssql_query("SELECT ChaNum FROM RanGame1.dbo.ChaInfo WHERE ChaNum='".$character."'"));
return $uid[0];
}
////////////////////////Get user nick from session id
echo '
<table align=center>
<tr><td><div style="width:546px; margin:0 0 0 10px; padding:10px; border:1px solid #484848; background:#272727; color:#a3a3a3; text-align:center; line-height:18px">
Note: Add Stat Points to your character!</div><br>
<font size=2 color=black>
</div></table>';
echo "
<table width=\"526\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td><div align=\"center\"></div></td>
</tr>
<tr>
<td><div align=\"center\">";
echo "<table align=center><td><div align=\"center\"><form action=\"user.php?op=user&option=addstat\" method=\"post\">";
echo " <table width=\"370\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td width=\"370\"><div align=\"center\">
<table width=\"370\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td width=\"370\"><div align=\"center\">
<table width=\"355\" border=\"0\" cellspacing=\"4\" cellpadding=\"0\">
<tr>";
$stm = mssql_fetch_array(mssql_query("SELECT UserNum FROM RanUser.dbo.UserInfo WHERE UserName='".$login."'"));
$tcats = mssql_query("SELECT ChaNum, ChaName FROM RanGame1.dbo.ChaInfo WHERE UserNum='".$stm[0]."' AND ChaDeleted ='0' ORDER BY ChaNum DESC");
echo "<td width=\"141\" align=\"right\"><font size=2>Character: </td><td width=\"102\"><select name=\"character\">";
while ($tcat=mssql_fetch_array($tcats))
{
echo "<option value=\"$tcat[0]\">$tcat[1]</option>";
}
echo "</select><br/></td>";
echo " </tr>
<tr>
<td align=\"right\"><font size=2>";
echo "<input type=\"hidden\" name=\"ok\" value=\"ok\"/></td>
</tr>
</table>
<table width=\"200\" border=\"0\" cellspacing=\"4\" cellpadding=\"0\">
<tr>
<td width=\"118\"><div align=\"right\">
";
echo "<input type=\"Submit\" name=\"send\" Value=\"Select Character!\"/>
</div></td>
</tr>
</table>
</div></td>
</tr>
</table>
</fieldset>
</div></td>
</tr>
</table></form>
</div></td>
</tr></table>
";
echo " <tr>
<td height=\"10\" align=\"center\">";
$ok = $_POST["ok"];
if($ok==ok)
{
$number = $_POST["number"];
$pin = $_POST["pin"];
$character = $_POST["character"];
$number2=stripslashes(set_sec_see($number));
$sqlinject->test($number2);
$pin2=stripslashes(set_sec_see($pin));
$sqlinject->test($pin2);
$character2=stripslashes(set_sec_see($character));
$sqlinject->test($character2);
echo "<center>";
$whonick = getchar($character2);
if($whonick!="")
{
$item = mssql_fetch_array(mssql_query("SELECT ChaPower, ChaStrong, ChaStrength, ChaSpirit, ChaDex, ChaIntel, ChaNum, ChaStRemain FROM RanGame1.dbo.ChaInfo WHERE ChaNum='".$character2."'"));
echo "<table width=100% ><tr>
<td width=15% bgcolor=#886666> <Font color='#FFFFFF'><strong>Pow</strong></font></td>
<td width=15% bgcolor=#886666> <Font color='#FFFFFF'><strong>Dex</strong></font></td>
<td width=15% bgcolor=#886666> <Font color='#FFFFFF'><strong>Int</strong></font></td>
<td width=15% bgcolor=#886666> <Font color='#FFFFFF'><strong>Vit</strong></font></td>
<td width=15% bgcolor=#886666> <Font color='#FFFFFF'><strong>Stm</strong></font></td>
</tr>
</tr><tr><td align=\"center\">$item[0]</td><td align=\"center\">$item[4]</td><td align=\"center\">$item[3]</td><td align=\"center\">$item[1]</td><td align=\"center\">$item[2]</td>
</tr></tr>
</table>
";
echo "<b>Remaining Points: $item[7]<br/><br/>";
echo "<onevent type=\"onenterforward\">";
echo "<refresh>
<setvar name=\"pow\" value=\"0\"/>
<setvar name=\"dex\" value=\"0\"/>
<setvar name=\"int\" value=\"0\"/>
<setvar name=\"vit\" value=\"0\"/>
<setvar name=\"stm\" value=\"0\"/>
";
echo "</refresh></onevent>";
echo "<center><form action=\"user.php?op=user&option=addstat\" method=\"post\">";
echo "<table cellspacing=0 border=0 cellpadding=0 align=center>";
echo "<tr>";
echo "<td align=right>Pow: <input name=\"pow\" size=\"5\" maxlength=\"5\"/></td></tr>";
echo "<td align=right>Dex: <input name=\"dex\" size=\"5\" maxlength=\"5\"/></td></tr>";
echo "<td align=right>Int: <input name=\"int\" size=\"5\" maxlength=\"5\"/></td></tr>";
echo "<td align=right>Vit: <input name=\"vit\" size=\"5\" maxlength=\"5\"/></td></tr>";
echo "<td align=right>Stm: <input name=\"stm\" size=\"5\" maxlength=\"5\"/></td></tr>";
echo "</table>";
echo "<input type=\"hidden\" name=\"character\" value=\"$item[6]\"/>";
echo "<input type=\"hidden\" name=\"ok2\" value=\"ok2\"/>";
echo "<input type=\"Submit\" name=\"send\" Value=\"Update!\"/></form></center>";
}else{
echo "<strong>Character does not exist</strong><br/>";
}
}
$character = $_POST["character"];
$pow = $_POST["pow"];
$dex = $_POST["dex"];
$int = $_POST["int"];
$vit = $_POST["vit"];
$stm = $_POST["stm"];
$ok2 = $_POST["ok2"];
$character2=stripslashes(set_sec_see($character));
$sqlinject->test($character2);
$pow2=stripslashes(set_sec_see($pow));
$sqlinject->test($pow2);
$dex2=stripslashes(set_sec_see($dex));
$sqlinject->test($dex2);
$int2=stripslashes(set_sec_see($int));
$sqlinject->test($int2);
$vit2=stripslashes(set_sec_see($vit));
$sqlinject->test($vit2);
$stm2=stripslashes(set_sec_see($stm));
$sqlinject->test($stm2);
$much = $pow2+$dex2+$int2+$vit2+$stm2;
if($ok2==ok2)
{
echo "<center>";
if(valid($pow2))
{
echo "<strong>Invalid entry for POW type in digit!</strong>";
}else{
if(valid($dex2))
{
echo "<strong>Invalid entry for DEX type in digit!</strong>";
}else{
if(valid($int2))
{
echo "<strong>Invalid entry for INT type in digit!</strong>";
}else{
if(valid($vit2))
{
echo "<strong>Invalid entry for VIT type in digit!</strong>";
}else{
if(valid($stm2))
{
echo "<strong>Invalid entry for STM type in digit!</strong>";
}else{
$gpst = mssql_fetch_array(mssql_query("SELECT ChaStRemain FROM RanGame1.dbo.ChaInfo WHERE ChaNum='".$character2."'"));
if($gpst[0]>=$much)
{
mssql_query("Update RanGame1.dbo.ChaInfo set ChaStRemain =ChaStRemain-'".$much."', ChaPower=ChaPower+'".$pow2."',ChaStrong=ChaStrong+'".$vit2."',ChaStrength=ChaStrength+'".$stm2."',ChaSpirit=ChaSpirit+'".$int2."',ChaDex=ChaDex+'".$dex2."' where ChaNum= '".$character2."'");
echo "<strong>Successfully Done!</strong><br/>";
}
}
}
}
}
}
}
echo "</td>
</tr>
";
?>