Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.64 KB | None | 0 0
  1. <?php
  2.     require ('steamauth/steamauth.php');
  3.     # You would uncomment the line beneath to make it refresh the data every time the page is loaded
  4.     // unset($_SESSION['steam_uptodate']);
  5. ?>
  6.  
  7. <div id="page-wrap">
  8. <?php
  9. error_reporting(0);
  10. ini_set("display_errors", 0);
  11. //if we got something through $_POST
  12. if (isset($_POST['search'])) {//load database connection
  13.     $host = "vweb18.nitrado.net";
  14.     $user = "XXXXXX";
  15.     $password = "XXXXXX";
  16.     $database_name = "ni15790_1sql1";
  17.     $pdo = new PDO("mysql:host=$host;dbname=$database_name", $user, $password, array(
  18.     PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
  19.     ));
  20. // Search from MySQL database table
  21. $search=$_POST['search'];
  22. $stat=$_POST['stat'];
  23. $query = $pdo->prepare("SELECT itemname, itemprice, itemupdate, itemstat FROM pricedata WHERE itemname Like ? AND itemstat=? ORDER BY itemprice DESC LIMIT 15");
  24. $query->bindValue(1, "%$search%", PDO::PARAM_STR);
  25. $query->bindValue(2, $stat);
  26. $query->execute();
  27. // Display search result
  28.          if (!$query->rowCount() == 0) {
  29.                 echo $stat;
  30.                 echo $search;
  31.                 echo "<table class=\"table-fill\">";    
  32.                 echo "<thead>";
  33.                 echo "<tr>";
  34.                 echo "<th class=\"text-left\">StatTrak</th>";
  35.                 echo "<th class=\"text-left\">Name and wear</th>";
  36.                 echo "<th class=\"text-left\">Price</th>";
  37.                 echo "<th class=\"text-left\">Update</th>";
  38.                 echo "</tr>";
  39.                 echo "</thead>";
  40.  
  41.             while ($results = $query->fetch()) {
  42.                 echo "<tbody class=\"table-hover\">";
  43.                
  44.                 echo "<tr><td align=\"right\">";          
  45.                 echo $results['itemstat'];
  46.                 echo "</td><td align=\"left\">";          
  47.                 echo $results['itemname'];
  48.                 echo "</td><td align=\"center\">";
  49.                 echo $results['itemprice'];
  50.                 echo "</td><td align=\"center\">";
  51.                 echo $results['itemupdate'];
  52.                 echo "</td></tr>";              
  53.             }
  54.                 echo "</tbody>";
  55.                 echo "</table>";               
  56.         } else {
  57.                 echo $stat;
  58.                 echo $search;
  59.             echo 'Nothing found';
  60.         }
  61. }
  62.  
  63.  
  64.  
  65. if(isset($_SESSION['steamid'])) {
  66. include ('steamauth/userInfo.php');
  67. echo "<div class=\"rightbar\">";
  68. echo '<h2>'.$steamprofile['personaname'].'</h2>';
  69. echo '<center><a href="'.$steamprofile['profileurl'].'"><img id="profile" src="'.$steamprofile['avatarfull'].'" alt="profilepicture"></img></a></center>';
  70. echo '<br>';
  71. echo '<center>';
  72. logoutbutton();
  73. echo '<br><br><br>';
  74. echo 'Changelog';
  75. echo '<div id="news">';
  76. include 'changelog.php';
  77. echo '</div>';
  78. echo '</center>';
  79. echo "</div>";
  80. }    
  81. ?>
  82.  
  83.  
  84. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement