It is necessary to work with it where it would be a mistake!
This feature ensures distribution points
PHP Code:
function add_stats()
{
global $maxstats;
$character = secure($_POST['character']);
$account = secure($_POST['login']);
$password = secure($_POST['password']);
$strength = secure($_POST['strength']);
$agility = secure($_POST['agility']);
$vitality = secure($_POST['vitality']);
$energy = secure($_POST['energy']);
$command = secure($_POST['command']);
$stats = $strength + $agility + $vitality + $energy + $command;
check_inject();
$query = mssql_query("Select class,LevelUpPoint,Strength,Dexterity,Vitality,Energy,LeaderShip From Character where name='$character'");
$row = mssql_fetch_row($query);
$strengthold = fix($row[2]);
$agilityold = fix($row[3]);
$vitalityold = fix($row[4]);
$energyold = fix($row[5]);
$commandold = fix($row[6]);
$strengthnew = $strengthold + $strength;
$agilitynew = $agilityold + $agility;
$vitalitynew = $vitalityold + $vitality;
$energynew = $energyold + $energy;
$commandnew = $commandold + $command;
$newleveluppoints = $row[1] - $stats;
$queryaccount = mssql_query("Select * from MEMB_INFO where memb___id='$account'");
$accountcheck = mssql_num_rows($queryaccount);
$queryonline = mssql_query("Select * from MEMB_STAT where memb___id='$account' and connectstat='1'");
$onlinecheck = mssql_num_rows($queryonline);
$querypassword = mssql_query("Select * from MEMB_INFO where memb___id='$account' and memb__pwd='$password'");
$passwordcheck = mssql_num_rows($querypassword);
$querychar = mssql_query("Select * from Character where Name='$character'");
$charcheck = mssql_num_rows($querychar);
if(empty($character) or empty($account) or empty($password)) { echo"<font color='red'>You cannot leave any fields blank!</font><br>"; $error=1; }
elseif($accountcheck <= 0) { echo"<font color='red'>Your Login does not exist in our database. Please go back and try again!</font><br>"; $error=1; }
elseif($passwordcheck <= 0) { echo"<font color='red'>Your Password does not exist in our database. Please go back and try again!</font><br>"; $error=1; }
elseif($charcheck <= 0) { echo"<font color='red'>Your Character does not exist in our database. Please go back and try again!</font><br>"; $error=1; }
else
{
if($stats > $row[1]) { echo"<font color='red'>Character $character does not have enough points !</font><br>"; $error=1; }
elseif($strengthnew > $maxstats or $agilitynew > $maxstats or $vitalitynew > $maxstats or $energynew > $maxstats or $commandnew > $maxstats) { echo"<font color='red'>You can't add more than $maxstats stats</font><br>"; $error=1;}
if($onlinecheck >= 1) { echo"<font color='red'>Account $account is online!Please LogOff First!</font><br>"; $error=1;}
if($error != 1)
{
echo"<font color='green'>Points succesfully added.$character now have:</font><br>$strengthnew Strength , $agilitynew Agility , $vitalitynew Vitality , $energynew Energy , $commandnew Command and $newleveluppoints points left to add!";
$a = mssql_query("Update Character set LevelUpPoint='$newleveluppoints',Strength='$strengthnew',Dexterity='$agilitynew',Vitality='$vitalitynew',Energy='$energynew',LeaderShip='$commandnew' where name='$character'");
}
}
}
And now once again write exactly what happens when you add points, how many points you have at the beginning, some screens.