Advertisement
Guest User

Untitled

a guest
May 19th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 2.79 KB | None | 0 0
  1. <?php
  2. /*
  3.     character.php
  4.     Bryan Abrams, 2010
  5.     Displays information about a character.
  6.     Arugment sent to file by:
  7.     character.php?n=[PLAYER NAME HERE]
  8. */
  9.  
  10. // database connection info
  11. include_once('db_login.php');
  12.  
  13. // Query the table for the character information located in the table 'characters' and place
  14. // the information in an array.
  15. $chara_query = mysql_query('SELECT * FROM characters WHERE char_name = "' . htmlspecialchars($_GET["n"]) . '"');
  16. $chara_result = mysql_fetch_row($chara_query);
  17.  
  18. // Same thing as above except this one is for the character template, only for the class name so far.
  19. $chara_q_class = mysql_query('SELECT * FROM char_templates WHERE ClassId = ' . $chara_result[48]);
  20. $chara_c_result = mysql_fetch_row($chara_q_class);
  21.  
  22. // These are two error checks. The first one makes sure the character you picked exists.
  23. // The second makes sure the classid from your character matches on inside char_templates.
  24. // If neither are ok, the execution stops.
  25. if(!$chara_result) {
  26.     echo("<br><a href='first.php'>Back To Main</a><br>");
  27.     die("<strong>There is no such character in the database. Please confirm the character name and try again. If the problem persists, please contact an administrator.</strong><br>" . mysql_error());
  28. }
  29. elseif(!$chara_c_result) {
  30.     echo("<br><a href='first.php'>Back To Main</a><br>");
  31.     die("<strong>This character's Class ID is invalid. Please contact an administrator.</strong><br>" . mysql_error());
  32. }
  33.  
  34. echo("<strong><i>Character Name</i></strong>: " . $chara_result[2] . ". <strong><i>Level</strong></i>: " . $chara_result[3] . ".<br>");
  35. echo("<strong><i>Status: </i></strong>: ");
  36. switch ($chara_result[56])
  37. {
  38. case 1:
  39.     echo ("<font color='00FF00'><strong>Online!</font></strong><br>");
  40.     break;
  41. default:
  42.     echo ("<font color='FF0000'>Offline</font><br>");
  43. }
  44.  
  45. echo("<strong><i><font color='FF00FF'>PVP Kills</i></strong>: " . $chara_result[43] . "</font>. <strong><i><font color='RED'>PK Kills</i></strong>: " . $chara_result[44] . "</font>.<br>");
  46. echo("<strong><i>PVE Kills</i></strong>: " . $chara_result[41] . ".<br><br>");
  47. echo("<strong><i>Race & Class</i></strong>: ");
  48.  
  49. switch ($chara_result[47]) // RACE ID
  50. {
  51. case 0:
  52.     echo 'Human ';
  53.     break;
  54. case 1:
  55.     echo 'Elven ';
  56.     break;
  57. case 2:
  58.     echo 'Dark Elven ';
  59.     break;
  60. case 3:
  61.     echo 'Orc ';
  62.     break;
  63. case 4:
  64.     echo 'Dwarven ';
  65.     break;
  66. default:
  67.     echo 'Impossible Race, check SQL';
  68. }
  69. echo($chara_c_result[1] . "<br>"); // printing the name of the class this character is.
  70.            
  71. echo("<strong><i>Combat Points</i></strong>: " . $chara_result[6] . ".<br>");
  72. echo("<strong><i>Health Points</i></strong>: " . $chara_result[4] . ".<br>");
  73. echo("<strong><i>Magic Points</i></strong>: " . $chara_result[8] . ".<br>");
  74.  
  75. echo("<br><a href='first.php'>Back To Main</a>");
  76.  
  77. mysql_close($connect);
  78.  
  79. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement