Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.17 KB | None | 0 0
  1. <?
  2. session_start();
  3. if(!session_is_registered(myusername)){
  4. header("location:index.php");
  5. }
  6. ?>
  7. <html>
  8. <head>
  9. <link rel="stylesheet" type="text/css" href="style.css" />
  10. <title>
  11. [R.I.P] - Astro/Player Database - Database
  12. </title>
  13.  
  14. <div id="banner">
  15. <img src="graphics/banner.jpeg" alt="banner"/>
  16. </div>
  17. <script language="javascript">
  18. var state = 'hidden';
  19.  
  20. function showhide(layer_ref) {
  21.  
  22. if (state == 'visible') {
  23. state = 'hidden';
  24. }
  25. else {
  26. state = 'visible';
  27. }
  28. if (document.all) { //IS IE 4 or 5 (or 6 beta)
  29. eval( "document.all." + layer_ref + ".style.visibility = state");
  30. }
  31. if (document.layers) { //IS NETSCAPE 4 or below
  32. document.layers[layer_ref].visibility = state;
  33. }
  34. if (document.getElementById && !document.all) {
  35. maxwell_smart = document.getElementById(layer_ref);
  36. maxwell_smart.style.visibility = state;
  37. }
  38. }
  39. //-->
  40. </script>
  41. </head>
  42. <body>
  43. <br>
  44. <br>
  45. <br>
  46. <div id="nav" align="left">
  47. <ul>
  48.     <li><a href="/AE/Home.php">Home</a></li>
  49.     <br>
  50.     <li><a href="/AE/Members.php">Members</a></li>
  51.     <br>
  52.     <li><a href="/AE/Profile.php">Profile</a></li>
  53.     <br>
  54.     <li><a href="/AE/Contact.php">Contact</a></li>
  55. </ul>
  56. </div>
  57. <div id="click" align="right">
  58. <a href="javascript://" onclick="showhide('insert')">Click</a> To Add Member! </div>
  59. <div id="insert" align="right" style="visibility:hidden;">
  60. <b>Insert Player Here!</b>
  61. <form action="insert.php" method="post">
  62. ID <input type="text" name="ID" />
  63. <br>
  64. Name <input type="text" name="Name" />
  65. <br>
  66. Guild <input type="text" name="Guild" />
  67. <br>
  68. Location <input type="text" name="Location" />
  69. <br>
  70. <input type="submit" value="Add to Database" />
  71. </form>
  72. </div>
  73. <div id="Search" div style="position: absolute; top: 350px; right: 530px;">
  74. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<b>Input Guild/ID or Player Name.</b>
  75. <form name="search" method="post" action="<?php $_SERVER[PHP_SELF]?>">
  76.  Seach for: <input type="text" name="find" /> in
  77.  <Select NAME="field">
  78.  <Option VALUE="Name">Name</option>
  79.  <Option VALUE="Guild">Guild</option>
  80.  <Option VALUE="ID">ID</option>
  81.  </Select>
  82.  <input type="hidden" name="searching" value="yes" />
  83.  <input type="submit" name="search" value="Search" />
  84.  </form>
  85.  
  86. <?php
  87.   if ($searching =="yes"){
  88.     echo "<h3>Search Results</h3><p>";
  89.     if ($find == ""){
  90.       echo "<p>Please Enter a search term";
  91.       exit;
  92.     }
  93.    
  94.     mysql_connect("localhost", "AE", "") or die(mysql_error());
  95.     mysql_select_db("ae") or die(mysql_error());
  96.     $find = strtoupper($find);
  97.     $find = strip_tags($find);
  98.     $find = trim ($find);
  99.  
  100.     $query = mysql_query("SELECT * FROM astros WHERE upper($find) LIKE'%$find%'");
  101.     while($result = mysql_fetch_array($query)){
  102.       echo $result['ID'];
  103.       echo " ";
  104.       echo $result['Guild'];
  105.       echo "<br>";
  106.       echo $result['Name'];
  107.       echo "<br>";
  108.       echo "<br>";
  109.     }
  110.  
  111.     $matches=mysql_num_rows($query);
  112.     if ($matches == 0){
  113.       echo "Sorry, we can not find an entry to match your query<br><br>";
  114.     }
  115.  
  116.     echo "<b>Searched For:</b> " .$find;
  117.   }
  118. ?>
  119. </form>
  120. </div>
  121. </body>
  122. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement