Advertisement
Guest User

Untitled

a guest
May 27th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.30 KB | None | 0 0
  1. <?php
  2.  
  3. //-----------------Database values------------------------------
  4.  
  5. $databasehost = "localhost";
  6. $databaseuser = "topic_topic";
  7. $databasepass = "taktak";
  8.  
  9. $database = "topic_12";
  10. $databasetable = "topic";
  11.  
  12. //--------------------------------------------------------------
  13.  
  14. //---------------Instructional Text----------------------------
  15.  
  16. //This is in html.
  17. $howitworks = "<p>
  18. <b>How can we give away tons of free Microsoft Points, or XBOX Live?</b><br/>
  19. You invite your friends. See the number on the locks? Invite that<br/>
  20. number of friends to unlock the prize. Copy the link inside the textbox,<br/>
  21. post it on your Facebook, Twitter, Youtube, anywhere. <br/>
  22. We get money from visitors. You get Free Xbox Live Stuff. <br/><br/>
  23.  
  24. We all win. Have fun, and see you on Live.
  25. </p>
  26. </div>";
  27.  
  28. //If you are using CSS, use this. Otherwise, comment this out.
  29. $divtag = "<div id=\"howitworks\">";
  30.  
  31. //-------------------------------------------------------------
  32.  
  33.  
  34.  
  35.  
  36.  
  37. $ipaddr = $_SERVER["REMOTE_ADDR"];
  38. $referral = $_GET["id"];
  39.  
  40. $newvisitor = False;
  41. $yourid = -1;
  42. $yourvisitors = 0;
  43.  
  44. $db = mysql_connect($databasehost, $databaseuser, $databasepass);
  45.  
  46. $selected = mysql_select_db($databasetable) or die("Unable to connect");
  47. $query = "SELECT * from ".$databasetable." WHERE ip = '$ipaddr'";
  48. $result = mysql_query($query);
  49.  
  50. $returned_rows = mysql_num_rows($result);
  51.  
  52. if($returned_rows == 0)
  53. {
  54.     $insertquery = "INSERT INTO ".$databasetable." (ip) VALUES ('$ipaddr')";
  55.     mysql_query($insertquery);
  56.         $result = mysql_query($query);
  57.         $newvisitor = True;
  58.  
  59. }
  60.     $row = mysql_fetch_array($result);
  61.     $yourvisitors = intval($row["visits"]);
  62.     $yourid = intval($row["id"]);
  63.  
  64.  
  65.  
  66.  
  67. if(isset($referral))
  68. {
  69.     $refquery = "SELECT * from ".$databasetable." WHERE id = '$referral'";
  70.     $refresult = mysql_query($refquery);
  71.  
  72.     $returned_rows = mysql_num_rows($refresult);
  73.  
  74.     if($returned_rows == 0)
  75.     {
  76.        
  77.     }
  78.     else
  79.     {
  80.         $row = mysql_fetch_array($refresult);
  81.        
  82.        
  83.         if($row["ip"] != $ipaddr && $row["lastip"] != $ipaddr && $newvisitor == True)
  84.         {
  85.         $visitors = intval($row["visits"]);
  86.         $newvisitors = $visitors + 1;
  87.         $updatequery = "UPDATE ".$databasetable." SET visits = '$newvisitors', lastip = '$ipaddr' WHERE id = '$referral'";
  88.         mysql_query($updatequery);
  89.         }
  90.     }
  91.  
  92. }
  93.  
  94. mysql_close($db);
  95.  
  96.  
  97.  
  98. //-----------EDIT LINKS TO IMAGES BELOW--------------
  99.  
  100.  
  101. //These 4 should be the "LOCKED" images.
  102. $image1 = "51600ptsLocked.png";
  103. $image2 = "104200ptsLocked.png";
  104. $image3 = "1512moliveLocked.png";
  105. $image4 = "25blackopsLocked.png";
  106.  
  107. //These 4 are the links of the "LOCKED" images
  108. $link1 = "/index.html";
  109. $link2 = "/index.html";
  110. $link3 = "/index.html";
  111. $link4 = "/index.html";
  112.  
  113.  
  114. //Change the numbers (in the if-statements) to how many visitors you need.
  115. //Change the images to the "UNLOCKED" images.
  116. //Change the links to the redemption link
  117. if($yourvisitors >= 5)
  118. {
  119. $image1 = "UN-"."$image1";
  120. $link1 = "/redeem.php?p=1&c=46813";
  121. }
  122. if($yourvisitors >= 10)
  123. {
  124. $image2 = "UN-"."$image2";
  125. $link2 = "/redeem.php?p=2&v=94653";
  126. }
  127. if($yourvisitors >= 15)
  128. {
  129. $image3 = "UN-"."$image3";
  130. $link3 = "/redeem.php?p=3&x=16579";
  131. }
  132. if($yourvisitors >= 25)
  133. {
  134. $image4 = "UN-"."$image4";
  135. $link4 = "/redeem.php?p=4&q=84621";
  136. }
  137.  
  138.  
  139. //---------------------------------------------------
  140.  
  141. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement