Advertisement
Guest User

Untitled

a guest
Nov 13th, 2016
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1.  
  2. <?php
  3. // MySQL connection
  4. $host = "localhost";
  5. $user = "*****";
  6. $pass = "******";
  7. $data = "****";
  8.  
  9. $connection = mysql_connect($host,$user,$pass)
  10. or die("Could not connect: ".mysql_error());
  11. mysql_select_db($data,$connection)
  12. or die("Error in selecting the database:".mysql_error());
  13.  
  14. $Query1 = mysql_Query("SELECT * FROM catalog_items WHERE daily_gift = '1' ORDER BY RAND() LIMIT 1");
  15.  
  16. IF($gift = mysql_fetch_array($Query1)){
  17. $user = mysql_real_escape_string($gift['user_id']);
  18. $item = mysql_real_escape_string($gift['item_id']);
  19. $name = mysql_real_escape_string($gift['catalog_name']);
  20.  
  21.  
  22. $sql1 = mysql_Query("INSERT INTO `items` (user_id, base_item) VALUES ('".$_SESSION['user']['id']."', '"$gift['item_id']"')") or die(mysql_error());
  23. echo "<div style='padding:10px;background-color:green;border-radius:3px;font-family:arial;font-size:12px;color:#FFF;text-align:center;'>You have been given a <b>" . $name . "</b>!</div>";
  24.  
  25. }
  26. sleep(86400);
  27. if (sleep = 0)
  28. echo 'Reload this page'
  29. else (
  30. echo 'You must wait till tomorrow to open another gift'
  31. }
  32. exit();
  33. else {
  34.  
  35. }
  36. ?>
  37. </div>
  38. </div>
  39. </div>
  40.  
  41. <?php include "templates/footer.php"; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement