Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.62 KB | None | 0 0
  1. <?php
  2.     $servername = "";
  3.     $username = "";
  4.     $password = "";
  5.     $dbname = "";
  6.     $dbport = "";
  7.     $current = file_get_contents("history.txt");
  8.     $history = fopen("history.txt", "w+") or die("Unable to open file!");
  9.    
  10.     // Create connection
  11.     $conn = new mysqli($servername, $username, $password, $dbname, $dbport);
  12.     // Check connection
  13.     if ($conn->connect_error) {
  14.         die("Connection failed: " . $conn->connect_error);
  15.     }
  16.  
  17.          
  18.  
  19.     preg_match("/^Bet ID: ([0-9]+)/", $current, $match);
  20.  
  21.  
  22.  
  23. $currentsql = "SELECT current FROM info WHERE id = 1";
  24. $current=$conn->query($currentsql);
  25.    if ($current->num_rows > 0) {
  26.         while($row = $current->fetch_assoc()) {
  27.         $roundid = $row["current"]
  28.         $roundsql = "SELECT totalItems,totalPrice FROM Round WHERE id =".$roundid;
  29. }
  30.  
  31. echo $roundsql;
  32.  
  33.     $sql = "SELECT * FROM Item WHERE id>0". $match[1] . " ORDER BY id DESC";
  34.  
  35.  
  36.    $result = $conn->query($sql);
  37.    
  38.     if ($result->num_rows > 0) {
  39.         $txt = "";
  40.         while($row = $result->fetch_assoc()) {
  41.             $txt = $txt ."Bet ID: " . $row["id"].  "<br>
  42.         <img src=\"". $row["img"]. "\" alt=\"Profile Pic\" style=\"width:30px;height:30px;\">
  43.  
  44.  
  45. - SteamID: " . $row["sid"]." Name: ". $row["name"] ." - Items On Bet: " . $row["amount"] ." -Items Price: ".$row["price"]."<br>";
  46.              }
  47.         $toWrite = str_replace("Resource id #4", "", $txt . $current);
  48.         echo $toWrite;
  49.         fwrite($history, $toWrite);
  50.     } else {
  51.         echo "0 new results <br>";
  52.         fwrite($history, $current);
  53.     }
  54.    
  55.     fclose($history);
  56.     $conn->close();
  57. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement