-
Oct 22nd, 2013, 03:15 PM
#1
Thread Starter
Fanatic Member
Little bug in file
Hello, i have a little bug in the function
This script is for MuOnline, add stats module, so i will explane, when you put on Commands : -999 points to add (even if you are not DL class you can use this) and it gives them the points their points + 999 points , how to fix it?
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_stats($row[2]); $agilityold = fix_stats($row[3]); $vitalityold = fix_stats($row[4]); $energyold = fix_stats($row[5]); $commandold = fix_stats($row[6]);
$strengthnew = $strengthold + $strength; $agilitynew = $agilityold + $agility; $vitalitynew = $vitalityold + $vitality; $energynew = $energyold + $energy; $commandnew = $commandold + $command; $newleveluppoints = $row[1] - $stats;
$queryonline = mssql_query("Select * from MEMB_STAT where memb___id='$account' and ConnectStat='1'"); $onlinecheck = mssql_num_rows($queryonline);
$querychar = mssql_query("Select * from Character where Name='$character'"); $charcheck = mssql_num_rows($querychar);
if($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"<td align='center' class='modules'><span class='online'>Points succesfully added.$character now have:</font><br>$strengthnew Strength , $agilitynew Agility , $vitalitynew Vitality , $energynew Energy , $commandnew Command and $newleveluppoints points left to add!</span></td></tr>"; $a = mssql_query("Update Character set LevelUpPoint='$newleveluppoints',Strength='$strengthnew',Dexterity='$agilitynew',Vitality='$vitalitynew',Energy='$energynew',LeaderShip='$commandnew' where name='$character'"); } } }
If its possible if the class is not Dark Lord not to allow them to write in Command field:
Here is class for all characters, Only 1 hero use Command and its Dark Lord !
Code:
if ($row[2] == 0) { $row[2] = "Dark Wizard"; }
if ($row[2] == 1) { $row[2] = "Soul Master"; }
if ($row[2] == 2) { $row[2] = "Grand Master"; }
if ($row[2] == 3) { $row[2] = "Grand Master"; }
if ($row[2] == 16) { $row[2] = "Dark Knight"; }
if ($row[2] == 17) { $row[2] = "Blade Knight"; }
if ($row[2] == 18) { $row[2] = "Blade Master"; }
if ($row[2] == 19) { $row[2] = "Blade Master"; }
if ($row[2] == 32) { $row[2] = "Elf"; }
if ($row[2] == 33) { $row[2] = "Muse Elf"; }
if ($row[2] == 34) { $row[2] = "High Elf"; }
if ($row[2] == 35) { $row[2] = "High Elf"; }
if ($row[2] == 48) { $row[2] = "Magic Gladiator"; }
if ($row[2] == 50) { $row[2] = "Duel Master"; }
if ($row[2] == 64) { $row[2] = "Dark Lord"; }
if ($row[2] == 66) { $row[2] = "Lord Emperor"; }
if ($row[2] == 80) { $row[2] = "Summoner"; }
if ($row[2] == 81) { $row[2] = "Bloody Summoner"; }
if ($row[2] == 82) { $row[2] = "Dimension Master"; }
if ($row[2] == 83) { $row[2] = "Dimension Master"; }
if ($row[2] == 96) { $row[2] = "Rage Fighter"; }
if ($row[2] == 97) { $row[2] = "Fist Master"; }
if ($row[2] == 98) { $row[2] = "Fist Master"; }
-
Oct 22nd, 2013, 05:05 PM
#2
Thread Starter
Fanatic Member
Re: Little bug in file
okey how to make here then when select character to display or hide Command line
Example i pick Dark Lord Name: Test , and to show me Command line, if i select Soul Master it will hide the Command line:
PHP Code:
<? if (eregi("modules/", $_SERVER['SCRIPT_NAME'])) { header("Location: ../?op=news"); } ?> <?php $username = secure($_SESSION['user']); include ("config.php"); if ($add_stats_enable == '0') { echo ('For the moment this page is closed. Please come back later.'); } else { ?> <form action='' name='' method='post'> <table align='center' width='400' class='maintable'> <thead> <tr> <td align='center' class='asd'>Stats Adder</td> </tr> </thead> <tr> <td> </td> </tr> <tr> <td align='center' class='maintable'>Select Character:
<select class='maintable' name='character'><optgroup label='Select a character'> <?php
$charq = mssql_query("Select name,leveluppoint from Character where AccountID='$username'");
for($i=0;$i < mssql_num_rows($charq);++$i) { $row = mssql_fetch_row($charq);
echo" <option value='$row[0]'><span class='maintable'><b>$row[0] [$row[1]]</span></option> "; } ?> </select>
</td> </tr> <tr><td align='center'><table width='400' align='center'> <tr> <td align='right' width='50%' class='asd'>Strength:</td> <td align='left' class='maintable'><input type='text' class='register_field' maxlength='5' name='strength'></td> </tr> <tr> <td align='right' class='asd'>Agility:</td> <td align='left' class='maintable'><input type='text' class='register_field' maxlength='5' name='agility'></td> </tr> <tr> <td align='right' class='asd'>Vitality:</td> <td align='left' class='maintable'><input type='text' class='register_field' maxlength='5' name='vitality'></td> </tr> <tr> <td align='right' class='asd'>Energy:</td> <td align='left' class='maintable'><input type='text' class='register_field' maxlength='5' name='energy'></td> </tr> <tr> <td align='right' class='asd'>Command:</td> <td align='left' class='maintable'><input type='text' class='register_field' maxlength='5' name='command'></td> </tr>
</table></td></tr> </tr> <td align='center'><input type='submit' name='addstats' class='button' value='Add Stats'></td> </tr> </tr> <?php if(isset($_POST['addstats'])) {add_stats(); } ?>
</table> </form><? } ?>
-
Oct 22nd, 2013, 05:12 PM
#3
Thread Starter
Fanatic Member
Re: Little bug in file
or other option is to disable - or + in code..so when they write -20 it will say error dont use symbols
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|