Just a web script to help track when, where, and what you got from the free treasures scattered about Nightfall in the game Guild Wars.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

70 lines
3.1 KiB

  1. <!DOCTYPE html>
  2. <HTML>
  3. <HEAD>
  4. <link rel="stylesheet" type="text/css" href="gw-style.css">
  5. <TITLE>Character Creation</TITLE>
  6. </HEAD>
  7. <BODY>
  8. <CENTER>
  9. <?php
  10. session_start();
  11. include_once 'gw-connect.php';
  12. $con = new mysqli(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME);
  13. $createnew = mysqli_real_escape_string($con, $_POST['docreate']);
  14. $userid = $_SESSION['userid'];
  15. if ($createnew === "1"){
  16. $cname = mysqli_real_escape_string($con, $_POST['cname']);
  17. $bdate = mysqli_real_escape_string($con, $_POST['bdate']);
  18. $profid = mysqli_real_escape_string($con, $_POST['professionid']);
  19. function getColor() {
  20. return array("#FFF", "#DDD", "#FF8", "#CF9", "#ACF", "#9FC", "#DAF", "#FBB", "#FCE", "#BFF", "#FC9", "#DDF");
  21. }
  22. $profcolor = getColor()[$profid];
  23. list ($y, $m, $d) = explode('-', $bdate);
  24. if (!checkdate($m, $d, $y)) {
  25. echo 'Date is invalid ' . $bdate . '<BR />';
  26. echo 'Date format is YYYY-MM-DD / 2005-04-28<BR />';
  27. echo 'Please click <A HREF="gw-create.php" CLASS="navlink">HERE</A> to try again';
  28. echo '<BR /><BR />Return to <A HREF="gw-index.php" CLASS="navlink">home</A>.</CENTER></BODY></HTML>';
  29. exit();
  30. } else if ($cname === ""){
  31. echo 'Please enter a name for your character<BR />';
  32. echo 'Please click <A HREF="gw-create.php" CLASS="navlink">HERE</A> to try again';
  33. echo '<BR /><BR />Return to <A HREF="gw-index.php" CLASS="navlink">home</A>.</CENTER></BODY></HTML>';
  34. exit();
  35. } else if ($profid === ""){
  36. echo 'Please choose a profession<BR />';
  37. echo 'Please click <A HREF="gw-create.php" CLASS="navlink">HERE</A> to try again';
  38. echo '<BR /><BR />Return to <A HREF="gw-index.php" CLASS="navlink">home</A>.</CENTER></BODY></HTML>';
  39. exit();
  40. }
  41. $sqlcreate = "INSERT INTO `playername` (charname, birthdate, userid, professionid, profcolor) VALUES ('$cname', '$bdate', $userid, $profid, '$profcolor')";
  42. if (!$resultcreate = $con->query($sqlcreate)){
  43. die ('There was an error running the query [' . $con->error . ']');
  44. }
  45. header("refresh:3;url=gw-toon.php");
  46. } else {
  47. echo '<CENTER><FORM METHOD="POST" ACTION="gw-create.php"><INPUT TYPE="HIDDEN" NAME="docreate" VALUE="1">';
  48. echo 'Character name: <INPUT TYPE="TEXT" NAME="cname" MAXLENGTH="19" SIZE="20"><BR />';
  49. echo 'Birthdate: <INPUT NAME="bdate" TYPE="DATE" PLACEHOLDER="2005-04-28"><BR />';
  50. $sqlprofession = "SELECT * FROM (SELECT * FROM listruneprofessions ORDER BY runeprofid DESC LIMIT 10) sub ORDER BY runeprofid ASC";
  51. if (!$result = $con->query($sqlprofession)){
  52. die ('There was an error running the query [' . $con->error . ']');
  53. }
  54. echo 'Profession: <SELECT NAME="professionid">';
  55. echo '<OPTION SELECTED DISABLED>Choose Profession</OPTION>';
  56. while ($row = $result->fetch_array()){
  57. $professionid = $row['runeprofid'];
  58. $profession = $row['runeprofession'];
  59. echo '<OPTION VALUE="' . $professionid . '">' . $profession . '</OPTION>';
  60. }
  61. echo '</SELECT><BR /><BR /> ';
  62. echo '<INPUT TYPE="SUBMIT" VALUE="Create character ..."></FORM>';
  63. }
  64. ?>
  65. <BR /><BR />
  66. Return to <A HREF="gw-index.php" CLASS="navlink">home</A>.
  67. </CENTER>
  68. <BR /><BR /><CENTER><FORM METHOD="POST" ACTION="gw-logout.php"><INPUT TYPE="HIDDEN" NAME="logout"><INPUT TYPE="SUBMIT" VALUE="Logout"></FORM></CENTER>
  69. </BODY>
  70. </HTML>