Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- character.php
- Bryan Abrams, 2010
- Displays information about a character.
- Arugment sent to file by:
- character.php?n=[PLAYER NAME HERE]
- */
- // database connection info
- include_once('db_login.php');
- // Query the table for the character information located in the table 'characters' and place
- // the information in an array.
- $chara_query = mysql_query('SELECT * FROM characters WHERE char_name = "' . htmlspecialchars($_GET["n"]) . '"');
- $chara_result = mysql_fetch_row($chara_query);
- // Same thing as above except this one is for the character template, only for the class name so far.
- $chara_q_class = mysql_query('SELECT * FROM char_templates WHERE ClassId = ' . $chara_result[48]);
- $chara_c_result = mysql_fetch_row($chara_q_class);
- // These are two error checks. The first one makes sure the character you picked exists.
- // The second makes sure the classid from your character matches on inside char_templates.
- // If neither are ok, the execution stops.
- if(!$chara_result) {
- echo("<br><a href='first.php'>Back To Main</a><br>");
- 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());
- }
- elseif(!$chara_c_result) {
- echo("<br><a href='first.php'>Back To Main</a><br>");
- die("<strong>This character's Class ID is invalid. Please contact an administrator.</strong><br>" . mysql_error());
- }
- echo("<strong><i>Character Name</i></strong>: " . $chara_result[2] . ". <strong><i>Level</strong></i>: " . $chara_result[3] . ".<br>");
- echo("<strong><i>Status: </i></strong>: ");
- switch ($chara_result[56])
- {
- case 1:
- echo ("<font color='00FF00'><strong>Online!</font></strong><br>");
- break;
- default:
- echo ("<font color='FF0000'>Offline</font><br>");
- }
- 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>");
- echo("<strong><i>PVE Kills</i></strong>: " . $chara_result[41] . ".<br><br>");
- echo("<strong><i>Race & Class</i></strong>: ");
- switch ($chara_result[47]) // RACE ID
- {
- case 0:
- echo 'Human ';
- break;
- case 1:
- echo 'Elven ';
- break;
- case 2:
- echo 'Dark Elven ';
- break;
- case 3:
- echo 'Orc ';
- break;
- case 4:
- echo 'Dwarven ';
- break;
- default:
- echo 'Impossible Race, check SQL';
- }
- echo($chara_c_result[1] . "<br>"); // printing the name of the class this character is.
- echo("<strong><i>Combat Points</i></strong>: " . $chara_result[6] . ".<br>");
- echo("<strong><i>Health Points</i></strong>: " . $chara_result[4] . ".<br>");
- echo("<strong><i>Magic Points</i></strong>: " . $chara_result[8] . ".<br>");
- echo("<br><a href='first.php'>Back To Main</a>");
- mysql_close($connect);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement