Advertisement
Guest User

Untitled

a guest
Apr 11th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. function pendaftaranUser($iduser,$nrp,$pas){
  2. global $koneksi;
  3.  
  4. $hasil = '';
  5.  
  6. //melakukan pengecekan nrp dan password
  7. $querycekAuth = mysql_query("select nrp from user_login where nrp ='$nrp' and password='$pas' ");
  8. $cekAuth = mysql_num_rows($querycekAuth);
  9. if($cekAuth != 0)
  10. {
  11. //melakukan pengecekan apakah id Telegram sudah terdaftar atau belum
  12. $querycekUser = mysql_query("select nrp from userbot where idTelegram = '$iduser'");
  13. $cekUser = mysql_num_rows($querycekUser);
  14. if($cekUser == 0)
  15. {
  16. $queryTambah = mysql_query("insert into userbot(idTelegram,nrp) values($iduser,$nrp)");
  17. $hasil .= "šŸŽŠ Selamat NRP $nrp berhasil didaftar.";
  18.  
  19. }
  20. else
  21. {
  22. while($row = mysql_fetch_array($querycekUser))
  23. {
  24. $hasil .= "šŸš« ID Telegram anda telah terdaftar sebagai ".$row['nrp'];
  25. $hasil .= "nšŸŽÆ 1 ID hanya dapat mendaftarkan 1 User saja.";
  26. }
  27. }
  28. }
  29. else
  30. {
  31. $hasil .= "ā›”ļø Gagal!nn NRP dan Password tidak sesuai.";
  32. }
  33.  
  34. return $hasil;
  35. }
  36.  
  37. case 'daftar':
  38. sendApiAction($idchat);
  39. if(isset($pecah[1]) && isset($pecah[2])){
  40. $nrp = $pecah[1];
  41. $pas = $pecah[2];
  42. $text = pendaftaranUser($iduser,$nrp,$pas);
  43.  
  44. //if $text value is 'ā›”ļø Gagal...' i want the sendApiMsg is called.
  45. if(pendaftaranUser($iduser,$nrp,$pas) === 'ā›”ļø Gagal!nn NRP dan Password tidak sesuai.'){
  46. sendApiMsg($idchat, $text);
  47. }
  48. //this condition if $text value is 'šŸŽŠ Selamat NRP....' and called funtion apiRequestJson
  49. else {
  50. apiRequestJson("sendMessage", array('chat_id' => $idchat, "text" => $text, 'reply_markup'=>$keyboard_full));
  51. }
  52.  
  53.  
  54. } else {
  55. $text = "Pendaftaran akun Anda Gagal.nn";
  56. $text .= "Contoh: daftar [NRP] [Kata Sandi]";
  57. sendMessage($idpesan, $idchat, $text);
  58. }
  59. break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement