Advertisement
Guest User

Untitled

a guest
Aug 28th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. <?php
  2.  
  3. ini_set("session.use_cookies","1");
  4. ini_set("session.use_only_cookies","1");
  5. ini_set("session.use_trans_sid","0");
  6. session_start();
  7.  
  8. $codetime = 240; // Cada cuantos minutos se puede usar la pag.
  9. $szBuffer = "amx codes";
  10. $gCanUse = 1;
  11.  
  12. if( isset($_SESSION["amxxcodes"]))
  13. {
  14. if( ($_SESSION["amxxcodes"]+($codetime*60)) > time() )
  15. {
  16. $szBuffer = "Aún no puedes revelar el código, intenta más tarde";
  17. $gCanUse = 0;
  18. }
  19. else
  20. {
  21. unset($_SESSION["amxxcodes"]);
  22. }
  23. }
  24.  
  25. if( $gCanUse )
  26. {
  27. $db_host = "localhost"; // SQL HOST
  28. $db_user = "test"; // SQL USER
  29. $db_pass = "test"; // SQL PASS
  30. $db_name = "Codes"; // SQL Database Name
  31. $db_table = "data"; // SQL Table name
  32.  
  33. $APS_MIN = 1; // Monto minimo de aps que se pueden otorgar
  34. $APS_MAX = 3; // Monto maximo de aps que se pueden otorgar
  35.  
  36. $conexion = mysqli_connect($db_host, $db_user, $db_pass, $db_name);
  37.  
  38. if (!$conexion)
  39. {
  40. die("Connection failed: " . mysqli_connect_error());
  41. }
  42.  
  43. $code = generateRandomString( rand(12,25) );
  44. $aps = rand( $APS_MIN , $APS_MAX );
  45. $query = 'INSERT INTO `'.$db_table.'` (Code, Aps, Used) VALUES ("'.$code.'", '.$aps.', 0)';
  46.  
  47. if (mysqli_query($conexion, $query) )
  48. {
  49. $szBuffer = "amx_code ". $code;
  50. $_SESSION["amxxcodes"] = time();
  51. }
  52. else
  53. {
  54. echo "Error en consulta: " . mysqli_error($conexion);
  55. }
  56.  
  57. mysqli_close($conexion);
  58. }
  59.  
  60. function generateRandomString($length = 10) {
  61. return substr(str_shuffle(str_repeat($x='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil($length/strlen($x)) )),1,$length);
  62. }
  63. ?>
  64.  
  65.  
  66. <!DOCTYPE html>
  67. <html lang="en-us">
  68. <head>
  69. <style>
  70. .text {
  71. color: rgb(255, 225, 0);
  72. text-shadow: 0px 0px 4px rgb(255, 108, 0);
  73. }
  74. </style>
  75. </head>
  76. <body bgcolor="#212121">
  77.  
  78. <center>
  79. <table border="0" cellpadding="5" cellspacing="0" style="box-shadow: 0px 0px 8px white; border-radius: 5px; width: 50%;min-width: 50%;">
  80. <tbody style="text-align:center;color:white;">
  81. <tr style="font-weight: bold;background-color: black;">
  82. <td>
  83. <?php
  84. if($gCanUse)
  85. {
  86. echo "AMXX Code escrito por Kikizon
  87. <br><br>
  88. Usa el siguiente código en consola del servidor y obten puntos napalm
  89. <br><br><br><br><br><br><br><br><br>
  90. <div class='text'>
  91. ".$szBuffer."
  92. </div>
  93. <br><br><br><br><br>";
  94. }
  95. else
  96. echo $szBuffer;
  97. ?>
  98. </td>
  99. </tr>
  100. </tbody>
  101. </table>
  102. </center>
  103.  
  104. </body>
  105. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement