Advertisement
Guest User

Untitled

a guest
Jun 14th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.19 KB | None | 0 0
  1. <?
  2.  
  3. function rand_str($length = 16, $chars = 'bdfhkmnrstuvwxyz23456789')
  4. {
  5. // Length of character list
  6. $chars_length = (strlen($chars) - 1);
  7. // Start our string
  8. $string = $chars{rand(0, $chars_length)};
  9. // Generate random string
  10. for ($i = 1; $i < $length; $i = strlen($string))
  11. {
  12. // Grab a random character from our list
  13. $r = $chars{rand(0, $chars_length)};
  14. // Make sure the same two characters don't appear next to each other
  15. if ($r != $string{$i - 1}) $string .= $r;
  16. }
  17. // Return the string
  18. return $string;
  19. }
  20.  
  21.  
  22. $hostname = "localhost";
  23. $username = "btroot";
  24. $password = "dgdg";
  25. $dbName = "btsms";
  26. $logtable = "log";
  27. $keytable = "activation";
  28. $number = 1121;
  29. $numberlvl2 = 1151;
  30. $smsid=$_GET['smsid'];
  31. $num=$_GET['num'];
  32. $user_id=$_GET['user_id'];
  33. $cost=$_GET['cost'];
  34. $msg=$_GET['msg'];
  35.  
  36. mysql_connect($hostname,$username,$password) OR DIE("smsid:$smsid\nstatus:reply\ncontent-type:text/plan\n\nProizoshla oshibka. Obraties k administratoru");
  37. mysql_select_db($dbName) or die(mysql_error());
  38. $query = "INSERT INTO $logtable (smsid,num,user_id,cost,msg,date) VALUES('$smsid','$num', '$user_id','$cost','$msg','".time()."')";
  39. mysql_query($query) or die(mysql_error());
  40. mysql_close();
  41.  
  42. if ($num == $number) {
  43. mysql_connect('bt.ivnet.ru','btsms','pass') OR DIE("smsid:$smsid\nstatus:reply\ncontent-type:text/plan\n\nProizoshla oshibka. Obraties k administratoru");
  44. mysql_select_db('bt') or die(mysql_error());
  45. $query = "SELECT num FROM invites where num=$user_id";
  46. $res = mysql_query($query) or die(mysql_error());
  47. if (mysql_num_rows($res)>0) {
  48. echo "smsid:$smsid\n";
  49. echo "status:reply\n";
  50. echo "content-type:text/plan\n";
  51. echo "\n";
  52. echo "Vy uzhe poluchali invite\n";
  53. } else {
  54. // $invite_code = substr(md5(time()), rand(1, 14), 16);
  55. $invite_code = rand_str();
  56. $query = "INSERT INTO invites (user_id,invite_code,active,generation_date,activation_date,num) VALUES ('-1','".$invite_code."','1',".time().",'0','$user_id')";
  57. mysql_query($query) or die("smsid:$smsid\nstatus:reply\ncontent-type:text/plan\n\nProizoshla oshibka. Obraties k administratoru");
  58. echo "smsid:$smsid\n";
  59. echo "status:reply\n";
  60. echo "content-type:text/plan\n";
  61. echo "\n";
  62. echo "Kod invite: $invite_code\n";
  63. echo "Level 1\n";
  64.  
  65. }
  66. } else {
  67. if ($num == $numberlvl2) {
  68. // $invite_code = substr(md5(time()), rand(1, 14), 16);
  69. $invite_code = rand_str();
  70. mysql_connect('bt.ivnet.ru','btsms','pass') OR DIE("smsid:$smsid\nstatus:reply\ncontent-type:text/plan\n\nProizoshla oshibka. Obraties k administratoru");
  71. mysql_select_db('bt') or die(mysql_error());
  72.  
  73. $query = "INSERT INTO invites (user_id,invite_code,active,generation_date,activation_date,num,level) VALUES ('-1','".$invite_code."','1',".time().",'0','$user_id','2')";
  74. mysql_query($query) or die("smsid:$smsid\nstatus:reply\ncontent-type:text/plan\n\nProizoshla oshibka. Obraties k administratoru");
  75. echo "smsid:$smsid\n";
  76. echo "status:reply\n";
  77. echo "content-type:text/plan\n";
  78. echo "\n";
  79. echo "Kod: $invite_code\n";
  80. echo "Level 2\n";
  81. }
  82. else
  83. {
  84. echo "smsid:$smsid\n";
  85. echo "status:reply\n";
  86. echo "content-type:text/plan\n";
  87. echo "\n";
  88. echo "Spasibo\n";
  89. }
  90. }
  91.  
  92. mysql_close();
  93.  
  94. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement