Jump to content

entity

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

About entity

  • Birthday 11/09/1988

Contact Methods

  • MSN
    metalnaffman@hotmail.com

Profile Information

  • Gender
    Male
  • Location
    England, UK

entity's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. (Sorry for the double post) It seems I have solved this problem through the idea that kenrbnsn gave and my friend also suggested the same route. Thanks for all the help!
  2. When it works I'll be putting it into an equipment file where this and some more code is included. So you think I should have another include when I want this to happen instead of using the eval() function? As that's fine as well, I just thought it would save having more than one file, but I'd be okay with an include I suppose.
  3. I'd never let it have input from a user, if that's what you mean by dangerous? Well, because then then the main battle file would become so huge if I added a new set of code for each and every piece of equipment. I've used it before with fopen() and it worked okay, but now it gives me errors and no matter how hard I check I can't see a single error. I've escaped everything properly. The latest one where the file is considering the <?php at the start of the file to be an error.
  4. Hi, I've began using the language construct eval() and have hit a snag. I'm trying to use it to insert some code if a certain requirement is met. It didn't work, I have properly escaped all the characters that needed escaping. But the thing is, I'm getting really bizzare errors now. I made a totally empty file and tried making it work as well so it didn't rely on anything like ifs just in case that was affecting my results somehow. Here is my totally bizzare error: Interesting as the VERY FIRST line is the opening <?php thing... Weird eh? I've also received several escaped character errors which were actually correctly escaped. If you'd like you can view the source of what code I'm trying to eval() <?php $CweaponMi = 3; $CweaponMa = 44; $user_accMa = 20; $user_magic = 20; $CweaponType = "Magic"; $CweaponElem = "Freeze"; $monster_m_def = 0; $monster_stored_attack[0] = 100; $monster_stored_attack[1] = 2; $range_type = "Ranged"; $magic_type = "Magic"; $melee_type = "Melee"; $default_elem = "Flame"; $after_monster .= "\$random = rand(0, 100); if(\$random > 0) { \$count_the_attacks = 0; foreach(\$monster_stored_attack as \$darnacus) { if(\$darnacus > 0) { \$count_the_attacks++; } } if(\$count_the_attacks == count(\$monster_stored_attacks)) { \$log_message .= \"You are dealing a counter attack!<br />\"; if(\$CweaponType == \"Magic\") { \$use_stat = \$user_magic; \$use_stat2 = \$user_accMa; \$mon_defence = \$monster_m_def; \$CweaponType = \$magic_type; } elseif(\$CweaponType == \"Melee\") { \$use_stat = \$user_melee; \$use_stat2 = \$user_accMe; \$mon_defence = \$monster_me_def; \$CweaponType = \$melee_type; } elseif(\$CweaponType == \"Ranged\") { \$use_stat = \$user_ranged; \$use_stat2 = \$user_accRa; \$mon_defence = \$monster_r_def; \$CweaponType = \$range_type; } else { \$use_stat = \$user_melee; \$use_stat2 = \$user_accMe; \$mon_defence = \$monster_me_def; \$CweaponType = \$melee_type; } \$stat = \$use_stat; \$stat2 = \$use_stat2; \$random_dmg = (\$CweaponMa + \$stat) - \$CweaponMi; \$attack = rand(\$CweaponMi, (\$CweaponMa + rand(0, \$random_dmg))); \$CweaponCri = (\$CweaponCri > 100) ? 100 : \$CweaponCri; \$work_crit = 100 - \$CweaponCri; \$do_crit = rand(0, 100); if(\$work_crit <= \$do_crit) { \$log_message .= \"<span class=\"critical\">CRITICAL HIT!</span><br />\"; \$str_crit_bonus = (\$str > 200) ? 200 : \$str; \$str_crit_bonus = (\$str_crit_bonus == 0) ? 10 : \$str_crit_bonus; \$times = 1 + round(\$str_crit_bonus * 0.005); } else { \$times = 1; } \$attack *= \$times; \$CweaponElem = (\$CweaponElem == \"\") ? \$default_elem : \$CweaponElem; \$defended_damage = \$attack; if(\$MonsterElements['MonsterFlame'] <= 0 && \$CweaponElem == \"Flame\") { if(\$mf == 0) { \$heal_opponent = 1; } } elseif(\$MonsterElements['MonsterFreeze'] <= 0 && \$CweaponElem == \"Freeze\") { \$heal_opponent = 1; } elseif(\$MonsterElements['MonsterLiquid'] <= 0 && \$CweaponElem == \"Liquid\") { \$heal_opponent = 1; } elseif(\$MonsterElements['MonsterEarth'] <= 0 && \$CweaponElem == \"Earth\") { \$heal_opponent = 1; } elseif(\$MonsterElements['MonsterWind'] <= 0 && \$CweaponElem == \"Wind\") { \$heal_opponent = 1; } elseif(\$MonsterElements['MonsterEnergy'] <= 0 && \$CweaponElem == \"Energy\") { \$heal_opponent = 1; } elseif(\$MonsterElements['MonsterHoly'] <= 0 && \$CweaponElem == \"Holy\") { \$heal_opponent = 1; } elseif(\$MonsterElements['MonsterUnholy'] <= 0 && \$CweaponElem == \"Unholy\") { \$heal_opponent = 1; } if(\$heal_opponent == 0) { \$defended_damage = str_replace('-', '', \$defended_damage); } if(\$mf > 0) { \$character_acc = 10000; \$monster_dodge = 0; } else { \$total_accuracy = \$use_stat2 + \$CweaponAq; \$total_defence = \$mon_defence + round((\$mon_luk / 20) + (\$mon_dex / 10)); \$character_acc = rand(round(\$total_accuracy / , \$total_accuracy) + rand(1, 30); \$monster_dodge = rand(round(\$total_defence / , \$total_defence) + rand(1, 30); } if(\$heal_opponent == 1) { if(\$character_acc >= \$monster_dodge) { \$monster_lf -= \$defended_damage; if(\$monster_lf > \$monster_mlf) { \$monster_lf = \$monster_mlf; } \$log_message .= \"Hit \".(\$aimer + 1).\" healed <span class=\"\".strtolower(\$CweaponElem).\"\">\$defended_damage \$CweaponElem \$CweaponType</span> <strong>Life Force</strong> to <font class=\"\$monster_elem2\">\$monster_elem</font>. It now has <strong>\$monster_lf Life Force</strong>.<br />\"; } else { \$log_message .= \"Hit 1 missed <font class=\"\$monster_elem2\">\$monster_name</font>.<br />\"; } } else { if(\$character_acc >= \$monster_dodge) { \$monster_lf -= \$defended_damage; \$log_message .= \"Hit 1 dealt <span class=\"\".strtolower(\$CweaponElem).\"\">\$defended_damage \".\$CweaponElem.\" \$CweaponType</span> damage to <font class=\"\$monster_elem2\">\$monster_name</font>. It now has <strong>\$monster_lf Life Force</strong> left over.<br />\"; \$connect_status = TRUE; } else { \$log_message .= \"Hit 1 missed <font class=\"$monster_elem2\">\$monster_name</font>.<br />\"; } } } } "; eval($after_monster); echo ("$log_message"); ?> If any one can help me with this, I'd be forever great full! As I am well and truly stumped on this.
  5. That does seem like the best way of doing it. Maybe you could have pagination and a search function, so that the user can find their friend easier? Thats how I would probably go about it anyway.
  6. Done it now, thanks for the help! Was helpful as heck!
  7. Hey! I've recently decided to make my site a newsletter because it just seems cool. Anyway I've encountered a small problem. Well I've have people register an e-mail under a choosen user to be more specific about things. But when I go to send an e-mail it gives the username of the very first user, not the user specific to that e-mail and user combination. I'm using a str_replace() function so that when it finds {username} or {email} it will replace those with that users email and username in both the subject and message. Like so $message = str_replace("{username}", "$user", "$message"); $message = str_replace("{email}", $email", "$message"); And the same for $subject just replace $message with $subject ;) Now I've tried a few things, the last one was to reset those variables mail(//all the mail stuff here ^_^); $user =""; $email = ""; (this is all in a while loop, mind you!) but still it uses the very first user that the e-mails are allowed to be sent to! (Where recieve = 1 ;)) Now this is the code used to send the newsletter. [code=php:0] $do = $_GET['version']; if((isset($do))&&($do=="do")) { $message = $_POST['message']; $subject = $_POST['subject']; $from = $_POST['from']; // Write News Letter to database $sql="INSERT INTO past_newsletters(content,subject,written) VALUES('$message','$subject',NOW())"; if(!mysqli_query($con,$sql)){  die('Error: ' . mysqli_error()); } $result99 = mysqli_query($con, "SELECT user, email FROM newsletter WHERE recieve='1' AND black='0'"); $count = 0; while ($row99 = mysqli_fetch_array($result99)) { $user = $row99['user']; $email = $row99['email']; $message = str_replace("{username}", $user, $message); $message = str_replace("{email}", $email, $message); $message = stripslashes($message); $subject = str_replace("{username}", $user, $subject); $subject = str_replace("{email}", $email, $subject); $subject = stripslashes($subject); mail("$email", "$subject", "$message", "From: Entitys Arena <$from>"); $email = ""; $user = ""; $count = $count + 1; } echo "Emails sent sucessfully.<br />Sent to: <b>$count</b> users."; } [/code] If there is [b]anyone[/b] who can help with this I will be majorly greatful! Thanks in advance! Entity ;)
  8. Hi there. Recently I have been developing My MySQL and PHP skills, and so far so good. Well I've come across a little problem while trying to write a little script that counts my affiliates hits in and out. Well I've done the code so it sends the members out and in with special links, but for some reason it just wont update the amount of hits in or out! This is where I need a little help. I am currently working with MySQL version 5.0.18 and have been used to v4 for too long, I've had to go through a lot of things and add the connection code to queries and add an i after every single mysql. Anyway, here is the code, please help me! [code] <html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">   <head>   <title>Entitys Arena &raquo; Re-Directing &raquo; Your Source For Final Fantasy!</title>   <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />   <meta name="author" content="entity" />   <meta name="robots" content="index,follow,all">   <meta name="description" content="Entitys Arena is a site dedicated to several things, Final Fantasy, Transformers and other such things. Always updating and expanding we hope to become one of the most reliable and most used websites for our catergory!" />   <meta name="keywords" content="Final Fantasy, Transformers, Webdesign, Graphics, Images, Tutorials, Downloads, Media, Final Fantasy Images, Transformers Images, Final Fantasy VII, Final Fantasy VIII, Final Fantasy IX, Final Fantasy X, Final Fantasy XII, Final Fantasy XIII, Materia, Eidolons, Aeons, Bahamut, Sephiroth, Cloud, Final Fantasy VII: Advent Children, Advent Children, Magic, Skills, Items, Weapons, Armour, Monsters, Strategy Guides" />   <meta http-equiv="imagetoolbar" content="no" />   <link rel="stylesheet" type="text/css" href="http://entitys-arena.co.uk/stylesheets/ne/style.css" />   <script language="Javascript" type="text/javascript">   window.defaultStatus = " Entitys Arena -->> Affiliate Redirection. "   </script>   <?php   // include the connect.php   require_once("./inc/config.php");   // count clicks   $mode = $_GET['mode'];   $id = htmlspecialchars($_GET[id]);   // get the mode   // a switch is like a series of ifs and elses, but in less space, and more efficent   if($mode == "in") {           $id = htmlspecialchars($_GET[id]);           // for incomming hits, log and redirect to site index           $NEED = mysqli_query($con, "SELECT * FROM affiliates WHERE id='$id' LIMIT 1") or die (mysql_error()); //just need to count()           while($get = mysqli_fetch_array($NEED)) {           $id = $get['id'];             $in = $get['in'];           $out = $get['out'];           $url = $get['url'];           $name = stripslashes($get['name']);           $img = stripslashes($get['banner']);           $user = $get['user'];           $insert = mysqli_query($con, "UPDATE affiliates SET in=(in+1) WHERE id='$id'");           echo("<meta http-equiv=\"refresh\" content=\"3; URL=http://entitys-arena.co.uk\" />\n");           echo("</head>\n");           echo("<body>\n");           echo("<br /><br /><br /><br /><br /><br />\n");           echo("<div align=\"center\">\n");           echo("<table cellpadding=\"0\" cellspacing=\"0\" class=\"infotable\">\n");           echo("<tr class=\"infohead\"><td>Entitys Arena Affiliate Redirection ~ $mode</td></tr>\n");           echo("<tr><td>\n");           echo("Redirecting from <a href=\"$url\">$name</a><br />\n");           echo("<div align=\"center\"><img src=\"$img\" alt=\"$name\" /></div>\n");           echo("</tr></td>\n");           echo("<tr class=\"infofoot\"><td>Hits In: $in | Hits Out: $out | User: $user</td></tr>\n");           echo("</table>\n");           echo("</div>\n");           echo("</body>\n");           }   }   elseif($mode == "out") {           $id = htmlspecialchars($_GET[id]);           // for outbound hits, log and redirect to affiliates site           $NEED = mysqli_query($con, "SELECT * FROM affiliates WHERE id='$id' LIMIT 1") or die (mysql_error());  //just need to count()           while($get = mysqli_fetch_array($NEED)) {         $id = $get['id'];             $mode = $_GET['mode'];           $out = $get['out'];           $in = $get['in'];           $url = $get['url'];           $name = stripslashes($get['name']);           $img = stripslashes($get['banner']);           $user = $get['user'];           $insert = mysqli_query($con, "UPDATE affiliates SET out=(out+1) WHERE id='$id'");           echo("<meta http-equiv=\"refresh\" content=\"3; URL=$url\" />\n");           echo("</head>\n");           echo("<body>\n");           echo("<br /><br /><br /><br /><br /><br />\n");           echo("<div align=\"center\">\n");           echo("<table cellpadding=\"0\" cellspacing=\"0\" class=\"infotable\">\n");           echo("<tr class=\"infohead\"><td>Entitys Arena Affiliate Redirection ~ $mode</td></tr>\n");           echo("<tr><td>\n");           echo("Redirecting to <a href=\"$url\">$name</a><br />\n");           echo("<div align=\"center\"><img src=\"$img\" alt=\"$name\" /></div>\n");           echo("</tr></td>\n");           echo("<tr class=\"infofoot\"><td>Hits In: $in | Hits Out: $out | User: $user</td></tr>\n");           echo("</table>\n");           echo("</div>\n");           echo("</body>\n");           }           // header("Location: $url");   } ?> [/code] Thank you very much! Made a newer style for it, still doesn't work though!
  9. Well within a few weeks I've decided to script a login script as part of my news script (please bare in mind I've only just started with MySQL this week) and I've finally come to a brick wall. Each and everytime I edit this script it seems to result in undesirable effects. My login script is based around Cookies and MySQL (I find MySQL easier than a Flat File login script... I can't handle those damn writing permissions ^_^) Anyway, my first problem is the login verification file (loginV.php), everytime I use it it logs me in, but in the meta tag redirector it wont echo the variables although meta tag redirection supports variable URLs (which the header() command doesn't seem to from my experience), here is my loginV.php file anyway: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] <?php if($submit == "") { echo("<div class=\"warning\">Fatal Error Script Ended</div>"); } elseif($submit == "submitted") { require_once("config.php"); $username = $_POST['user']; //pulls the username from the form $password = $_POST['password']; //pulls the pass from the form $password2 = md5($password); //makes our password an md5 //selects info from our table if the row has the same user and pass that our form does $login = mysql_query("SELECT * FROM users WHERE `user` = '$username' AND `password` = '$password'"); if(!mysql_num_rows($login)) //if the username and pass are wrong { echo("Password or username is wrong, try again!\n"); echo("<meta http-equiv=\"refresh\" content=\"0; URL=http://eagame.entitys-arena.co.uk/V2LC/index.php?eagame=login\">"); //redirects to our login page } else { $results = mysql_query("SELECT * FROM users WHERE `user` = '$username' AND `password` = '$password'"); $row = mysql_fetch_array($results); //sets our user cookie $rk = $row['rank']; $username = $row['user']; $navID = $row['id']; setcookie("user", $username, time()+3600); //sets our pass cookie setcookie("pass", $password2, time()+3600); //instead of yourpage.php it would be your protected page echo("Thank you $username, you are being redirected to the news center!"); echo("$rk $un $navID"); echo("<meta http-equiv=\"refresh\" content=\"5; URL=http://eagame.entitys-arena.co.uk/V2LC/index.php?eagame=news&action=users&uid=$navID&un=$un&rank=$rk\">"); //redirects to our login page } } ?> [/quote] What the file does is set two cookies, one for the password and one for the username that works fine, but then something REALLY annoying happens, I have three users, I have logged in as each as them and it happens with each one. First off the navigation.php file is supposed to change dynamically if the username and password cookies exist if they do it includes the extra navigation once thats done it checks to see which rank that the user is if the user is an Administrator or a Co-Administrator then they would get more options than someone who is just a News Editor or News Reporter. Well what used to happen is each time I logged in even if it was as say Bob instead of Entity it would still login as Entity which isn't very useful or safe. Now what happens is everytime I log in the navigation gets every users menu and displays it, I think this is mostly due to the while() code I'm using, but I've run out of ideas and I really cannot seem to do anything to make this right. Here is navigation.php [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] <table width="100%"> <tr><td>Navigation</td></tr> <tr> <td class="navigation"> <ul> <li><a href="/V2LC/index.php">Index</a></li> <li><a href="index.php?eagame=info">Information</a></li> <li><a href="index.php?eagame=about">About</a></li> </ul> <?php // Check if cookie exists... if(isset($_COOKIE['user']) && isset($_COOKIE['pass'])) { require_once("config.php"); echo("<ul>"); $navID = $_GET['$navID']; $navRank = $_GET['$rk']; $username = $_GET['$un']; $result = mysql_query("SELECT * FROM users"); echo mysql_error($con); while($row = mysql_fetch_array($result)) { $navID = $row['id']; $navRank = $row['rank']; $username = $row['user']; echo("Welcome $username\n<br />\nRank: $navRank\n"); if($navRank == "Administrator") { echo("<li><a href=\"index.php?eagame=news&action=userCP&uid=$navID\">User Control Panel</a></li>\n"); echo("<li><a href=\"index.php?eagame=news&action=register\">Register A User</a></li>\n"); echo("<li><a href=\"index.php?eagame=news&action=users\">Views Users</a></li>\n"); echo("<li><a href=\"index.php?eagame=news&action=addartcile\">Add Article</a></li>\n"); echo("<li><a href=\"index.php?eagame=news&action=logout\">Log Out</a></li>\n"); } elseif($navRank == "Co-Administrator") { echo("<li><a href=\"index.php?eagame=news&action=userCP&id=$id\">User Control Panel</a></li>\n"); echo("<li><a href=\"index.php?eagame=news&action=register\">Register A User</a></li>\n"); echo("<li><a href=\"index.php?eagame=news&action=users\">Views Users</a></li>\n"); echo("<li><a href=\"index.php?eagame=news&action=addartcile\">Add Article</a></li>\n"); echo("<li><a href=\"index.php?eagame=news&action=logout\">Log Out</a></li>\n"); } elseif($navRank == "News Editor") { echo("<li><a href=\"index.php?eagame=news&action=userCP&id=$id\">User Control Panel</a></li>\n"); echo("<li><a href=\"index.php?eagame=news&action=addartcile\">Add Article</a></li>\n"); echo("<li><a href=\"index.php?eagame=news&action=logout\">Log Out</a></li>\n"); } elseif($navRank == "News Reporter") { echo("<li><a href=\"index.php?eagame=news&action=userCP&id=$id\">User Control Panel</a></li>\n"); echo("<li><a href=\"index.php?eagame=news&action=addartcile\">Add Article</a></li>\n"); echo("<li><a href=\"index.php?eagame=news&action=logout\">Log Out</a></li>\n"); } echo("</ul>"); } } elseif(empty($_COOKIE['user']) && empty($_COOKIE['pass'])) { echo("<ul>"); echo("<li><a href=\"index.php?eagame=login\">Staff Login</a></li>\n"); echo("</ul>"); } ?> </td> </tr> </table> [/quote] Also, something may be wrong with my log out script that may not be deleting my cookies fully, but from the looks of things, everything seems OK. But here is logout.php [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] <?php $username = ""; $password2 = ""; //sets our user cookie setcookie("user", $username); //sets our pass cookie setcookie("pass", $password2); echo("$username; You have been logged out, redirecting to home page!"); echo("<meta http-equiv=\"refresh\" content=\"5; URL=http://eagame.entitys-arena.co.uk/V2LC/index.php\">"); //redirects to our login page ?> [/quote] So far with this news script I have successfully made a user list where I can see they're details (e.g password, email, name, id) and I can also delete or edit these users, then just for a bit of fun I've added an ORDER BY with variables to order the content... Anyway, if anyone can help me with this problem, I would be very very happy! And I can continue on with life normally! Regards, entity.
  10. Well, I'm still hving problems, I can't seem to find a way to implement Crayon Violent's idea, I'll post the code and could you try and see how it could be fixed? Cheers ^_^ PS: Sorry for all the double posting by the way!
  11. Well thanks for the help I've got that working now; I've just gotta get Crayon Violent's thing working now, hopefully!
  12. Sorry about the double post guys, but thing is I've just noticed something about my script and I've been working on this for aggggges; well I'm doing quite a few calculations in there, but quite a few seem to come out wrong, [code] $SBtH = round($dex / 16 + $str / 16 + $luck / 20); [/code] Well what is supposed to happen there is this: $dex, $str and $luck are all brought from a form, well their numbers are $dex = 100 $str = 100 $luck = 20 so what happens is: 100 divided by 16 = 6.25 + 100 divided by 16 = 6.25 + 20 divided by 20 = 1 once added altogether this should equal 8.50 rounded up to 9 but what I get is 17 which is wrong but so is the nine... what it is supposed to be is 14... what is going on here? Can anyone give me a few hints please?
  13. Lol, it isn't my game, I'm just making a fan based web site and this going to be one of the codes that I use Well I'll try this out! &_&
  14. Well that is pretty cool, would it help if I posted the code up? I'll do it anyways: [code] <?php // // Stats Calculator // entity@entitys-arena.co.uk // MWA HA HA // Version 1.0 // Melee Attack Equation: // (DEX / 16) + (STR / 16) + (LUK / 20) // Ranged Attack Equation: // (DEX / 8) + (LUK / 20) // Magic Attack Equation: // (DEX / 16) + (INT / 16) + (LUK / 20) // Melee Attacks: STR / 8 // Ranged Attacks: (STR / 16) + (LUK / 20) // Magic Attacks: INT / 8 // $MStats = $str + $dex + $int + $end + $cha + $luck; if(($str == "")||($dex == "")||($int == "")||($end == "")||($cha == "")||($luck == "")||($level == "")) { echo("Please fill in all sections even if its just a zero ^_^\n"); } elseif($level > "125") { echo("You cannot go over the level of 125 at this time.\n"); } elseif($account == "agx") {     $account_type = "Adventurer/Guardian/X-Guardian";     if(($str > "175")||($dex > "175")||($int > "175")||($end > "175")||($cha > "175")||($luck > "175")) {     echo("Your stats do not go above 175, please go back and correct this.\n");     }     elseif($MStats > "625") {     echo("You will not gain more than 625 stat points unless you are a staff member ¬_¬.\n");     }     else{     // This section calculates your BtH for each weapon type     // It will also work out BtH for pets ^_^     // BtH - Str - Melee     $SBtH = round(($dex / 16) + ($str / 16) + ($luck / 20));     // BtH - Dex - Ranged     $DBtH = round(($dex / 8) + ($luck / 20));     // BtH - Int - Magic     $IBtH = round(($dex / 16) + ($int / 16) + ($luck / 20));     // BtH - Cha - Pets     $CBtH = round($cha / 15 + 5);     // This section calculates extra random damage gained for MRM & Pets     // Xtra - Str - Melee     $XStr = round($str / 8);     // Xtra - Dex - Ranged     $XDex = round($dex / 16 + $str / 16);     // Xtra - Int - Magic     $XInt = round($int / 8);     // Xtra - Cha - Pets     $XCha = round($cha / 15);     // This part works out the chance you have to block with your current stats     $CtB = round($dex / 10 + $luck / 20);     // Now to work out the treasure chest you'll be getting!     $WTcT = ($level + $luck / 5);     if($WTcT < 30) {     $TcT = "Small Treasure Chest - 125 Gold\n";     }     elseif(($WTcT >= 30)&&($WTcT <= 49)) {     $TcT = "Treasure Chest - 275 Gold\n";     }     elseif(($WTcT >= 50)&&($WTcT <= 64)) {     $TcT = "Big Treasure Chest - 425 Gold\n";     }     elseif(($WTcT >= 65)&&($WTcT <= 84)) {     $TcT = "Huge Treasure Chest - 650 Gold\n";     }     elseif($WTcT >= 85) {     $TcT = "Treasure Hoard - 800 Gold\n";     }     // Working out HP & MP     $HP = round(($level * 5 + 100) * (1+($end / 100)));     $MP = round(($level * 5 + 100) * (1+($int / 100)));     // Working out weapon average     $average = round(($base + $max) / 2);     // Working out weapon random     $random = $max - $base;     echo("<table>");     echo("<tr>");     echo("<td colspan=\"2\">Account Details</td>");     echo("</tr>");     echo("<tr>");     echo("<td><b>Account Type:</b></td>");     echo("<td>$account_type</td>");     echo("</tr>");     echo("</table>");     echo("<br /><br />");     echo("<!-- BtH Start -->");     echo("<table>\n");     echo("<tr>\n");     echo("<td colspan=\"2\">Bonus to Hit</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Melee BtH</b></td>\n");     echo("<td>$SBtH%</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Ranged BtH</b></td>\n");     echo("<td>$DBtH%</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Magic BtH</b></td>\n");     echo("<td>$IBtH%</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Pet BtH</b></td>\n");     echo("<td>$CBtH%</td>\n");     echo("</tr>\n");     echo("</table>\n");     echo("<!-- BtH End -->\n");     echo("<!-- Added Damage Section Start -->\n");     echo("<br /><br />\n");     echo("<table>\n");     echo("<tr>\n");     echo("<td colspan=\"2\">Added Damage</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Melee Damage</b></td>\n");     echo("<td>+$XStr</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Ranged Damage</b></td>\n");     echo("<td>+$XDex</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Magic Damage</b></td>\n");     echo("<td>+$XInt</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Pet Damage</b></td>\n");     echo("<td>+$XCha</td>\n");     echo("</tr>\n");     echo("</table>\n");     echo("<!-- Added Damage Section End -->\n");     echo("<!-- Random Section Start -->\n");     echo("<br /><br />\n");     echo("<table>\n");     echo("<tr>\n");     echo("<td colspan=\"2\">Chance to block</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Defence:</b></td>\n");     echo("<td>$CtB%</td>\n");     echo("</tr>\n");     echo("</table>\n");     echo("<br /><br />\n");     echo("<table>\n");     echo("<tr>\n");     echo("<td colspan=\"2\">Treasure Chests</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>L Value:</b></td>\n");     echo("<td>$level</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Treasure Chest:</b></td>\n");     echo("<td>$TcT</td>\n");     echo("</tr>\n");     echo("</table>\n");     echo("<br /><br />\n");     echo("<table>\n");     echo("<tr>\n");     echo("<td colspan=\"2\">Weapon Averages and Random Damage</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Weapon Average:</b></td>\n");     echo("<td>$max + $base / 2 = $average</td>\n");     echo("</tr\n>");     echo("<tr>\n");     echo("<td><b>Weapon Random Damage:</b></td>\n");     echo("<td>$max - $base = $random</td>\n");     echo("</tr>\n");     echo("</table>\n");     echo("<br /><br />\n");     echo("<table>\n");     echo("<tr>\n");     echo("<td colspan=\"2\">HP & MP</td>\n");     echo("</tr>\n");     echo("<tr>");     echo("<td><b>HP:</b></td>\n");     echo("<td>$HP</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>MP:</b></td>\n");     echo("<td>$MP</td>\n");     echo("</tr>\n");     echo("<!-- Random Section End -->\n");     } } elseif($account == "staff") {     $account_type = "Staff";     // This section calculates your BtH for each weapon type     // It will also work out BtH for pets ^_^     // BtH - Str - Melee     $SBtH = round(($dex / 16) + ($str / 16) + ($luck / 20));     // BtH - Dex - Ranged     $DBtH = round(($dex / 8) + ($luck / 20));     // BtH - Int - Magic     $IBtH = round(($dex / 16) + ($int / 16) + ($luck / 20));     // BtH - Cha - Pets     $CBtH = round($cha / 15 + 5);     // This section calculates extra random damage gained for MRM & Pets     // Xtra - Str - Melee     $XStr = round($str / 8);     // Xtra - Dex - Ranged     $XDex = round($dex / 16 + $str / 16);     // Xtra - Int - Magic     $XInt = round($int / 8);     // Xtra - Cha - Pets     $XCha = round($cha / 15);     // This part works out the chance you have to block with your current stats     $CtB = round($dex / 10 + $luck / 20);     // Now to work out the treasure chest you'll be getting!     $WTcT = ($level + $luck / 5);     if($WTcT < 30) {     $TcT = "Small Treasure Chest - 125 Gold\n";     }     elseif(($WTcT >= 30)&&($WTcT <= 49)) {     $TcT = "Treasure Chest - 275 Gold\n";     }     elseif(($WTcT >= 50)&&($WTcT <= 64)) {     $TcT = "Big Treasure Chest - 425 Gold\n";     }     elseif(($WTcT >= 65)&&($WTcT <= 84)) {     $TcT = "Huge Treasure Chest - 650 Gold\n";     }     elseif($WTcT >= 85) {     $TcT = "Treasure Hoard - 800 Gold\n";     }     // Working out HP & MP     $HP = round(($level * 5 + 100) * (1+($end / 100)));     $MP = round(($level * 5 + 100) * (1+($int / 100)));     // Working out weapon average     $average = round(($base + $max) / 2);     // Working out weapon random     $random = $max - $base;     echo("<table>");     echo("<tr>");     echo("<td colspan=\"2\">Account Details</td>");     echo("</tr>");     echo("<tr>");     echo("<td><b>Account Type:</b></td>");     echo("<td>$account_type</td>");     echo("</tr>");     echo("</table>");     echo("<br /><br />");     echo("<!-- BtH Start -->");     echo("<table>\n");     echo("<tr>\n");     echo("<td colspan=\"2\">Bonus to Hit</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Melee BtH</b></td>\n");     echo("<td>$SBtH%</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Ranged BtH</b></td>\n");     echo("<td>$DBtH%</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Magic BtH</b></td>\n");     echo("<td>$IBtH%</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Pet BtH</b></td>\n");     echo("<td>$CBtH%</td>\n");     echo("</tr>\n");     echo("</table>\n");     echo("<!-- BtH End -->\n");     echo("<!-- Added Damage Section Start -->\n");     echo("<br /><br />\n");     echo("<table>\n");     echo("<tr>\n");     echo("<td colspan=\"2\">Added Damage</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Melee Damage</b></td>\n");     echo("<td>+$XStr</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Ranged Damage</b></td>\n");     echo("<td>+$XDex</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Magic Damage</b></td>\n");     echo("<td>+$XInt</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Pet Damage</b></td>\n");     echo("<td>+$XCha</td>\n");     echo("</tr>\n");     echo("</table>\n");     echo("<!-- Added Damage Section End -->\n");     echo("<!-- Random Section Start -->\n");     echo("<br /><br />\n");     echo("<table>\n");     echo("<tr>\n");     echo("<td colspan=\"2\">Chance to block</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Defence:</b></td>\n");     echo("<td>$CtB%</td>\n");     echo("</tr>\n");     echo("</table>\n");     echo("<br /><br />\n");     echo("<table>\n");     echo("<tr>\n");     echo("<td colspan=\"2\">Treasure Chests</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>L Value:</b></td>\n");     echo("<td>$level</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Treasure Chest:</b></td>\n");     echo("<td>$TcT</td>\n");     echo("</tr>\n");     echo("</table>\n");     echo("<br /><br />\n");     echo("<table>\n");     echo("<tr>\n");     echo("<td colspan=\"2\">Weapon Averages and Random Damage</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>Weapon Average:</b></td>\n");     echo("<td>$max + $base / 2 = $average</td>\n");     echo("</tr\n>");     echo("<tr>\n");     echo("<td><b>Weapon Random Damage:</b></td>\n");     echo("<td>$max - $base = $random</td>\n");     echo("</tr>\n");     echo("</table>\n");     echo("<br /><br />\n");     echo("<table>\n");     echo("<tr>\n");     echo("<td colspan=\"2\">HP & MP</td>\n");     echo("</tr>\n");     echo("<tr>");     echo("<td><b>HP:</b></td>\n");     echo("<td>$HP</td>\n");     echo("</tr>\n");     echo("<tr>\n");     echo("<td><b>MP:</b></td>\n");     echo("<td>$MP</td>\n");     echo("</tr>\n");     echo("<!-- Random Section End -->\n"); } ?> [/code] It's pretty simple (and admittedly quite chunky) but it works well; I just need a little help with the finishing touches! ^_^
  15. Hi, I've only just joined; but I've been a part of the PHP phenomena for quite a while now. Well I've been scripting a code for an Online RPG (Adventure Quest); this code allows you to work out stats. Anyway, I've been working quite hard on this code but I have finally come to a full stop on it. My problem is that stats can only be in 5's so 5 all the way up to 175 (unless your a staff member you can get anything as long as it is a multiple of five), my problem is I don't know how to make a validation code that will only allow multiples of five. Any help on this would be greatly appriciated as this is the first code I've written without copying parts here and there. Thank you very much. - entity
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.