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.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

28 行
1.2 KiB

  1. <?php
  2. include_once 'gw-connect.php';
  3. $con = new mysqli(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME);
  4. $userid = 1; //need to actually pull this info from cookie/session (preferable)
  5. $whattoon = mysqli_real_escape_string($con, $_POST['cname']);
  6. if ($con->connect_errno > 0){
  7. die ('Unable to connect to database [' . $db->connect_errno . ']');
  8. }
  9. $sql = "SELECT playerid, charname FROM `playername` WHERE `userid` = '1' ORDER BY `charname` ASC"; //need to make userid a variable
  10. if (!$result = $con->query($sql)){
  11. die ('There was an error running the query [' . $con->error . ']');
  12. }
  13. # experimental stuff
  14. if ($whattoon == ""){
  15. echo '<CENTER><FORM METHOD="POST">';
  16. echo '<SELECT NAME="cname" onchange="this.form.submit()">>';
  17. echo '<OPTION SELECTED DISABLED>Select a Character</OPTION>';
  18. while ($row = $result->fetch_array()){
  19. $charid = $row['playerid'];
  20. $charname = $row['charname'];
  21. echo '<OPTION VALUE="' . $charid . '">' . $charname . '</OPTION>';
  22. }
  23. echo '</SELECT><NOSCRIPT><INPUT TYPE="SUBMIT" VALUE="Choose Toon"></NOSCRIPT></FORM></CENTER>';
  24. } else {
  25. echo 'Options for what to do after character selection goes here <BR />';
  26. echo 'Character id selected is ' . $whattoon . '<BR />';
  27. }
  28. ?>