Advertisement
Guest User

Untitled

a guest
Mar 28th, 2018
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 KB | None | 0 0
  1. public function validates($sms) {
  2. try {
  3. $sms = strtolower($sms);
  4. // var_dump($sms);
  5.  
  6. $strUsername = "";
  7. $strPass = "";
  8. $codeUser = "";
  9. $codePass = "";
  10.  
  11. if ($this->startsWith($sms, "username anda")) {
  12. $codeUser = "username anda";
  13. } else if ($this->startsWith($sms, "username akses wifi.id anda adalah")) {
  14. $codeUser = "username akses wifi.id anda adalah";
  15. } else
  16. if ($this->startsWith($sms, "username")) {
  17. $codeUser = "username";
  18. } else if ($this->startsWith($sms, "user")) {
  19. $codeUser = "user";
  20. } else if ($this->startsWith($sms, "usr")) {
  21. $codeUser = "usr";
  22. } else if ($this->startsWith($sms, "usn")) {
  23. $codeUser = "usn";
  24. } else {
  25. throw new Exception("No username found");
  26. }
  27.  
  28. $sms = $this->str_replace_first($codeUser, "", $sms);
  29.  
  30.  
  31. while ($this->charAt($sms, 0) == ' ' || $this->charAt($sms, 0) == ':') {
  32. $sms = substr($sms, 1);
  33. }
  34.  
  35.  
  36.  
  37.  
  38. $i = 0;
  39. while ($this->charAt($sms, $i) != ',' && $this->charAt($sms, $i) != ' ') {
  40.  
  41. $strUsername .= $this->charAt($sms, $i);
  42. $i++;
  43. }
  44.  
  45. $sms = $this->str_replace_first($strUsername, "", $sms);
  46.  
  47.  
  48. while ($this->charAt($sms, 0) == ' ' || $this->charAt($sms, 0) == ',') {
  49. $sms = substr($sms, 1);
  50. }
  51.  
  52.  
  53. if ($this->startsWith($sms, "password")) {
  54. $codePass = "password";
  55. } else if ($this->startsWith($sms, "pwd")) {
  56. $codePass = "pwd";
  57. } else if ($this->startsWith($sms, "psw")) {
  58. $codePass = "psw";
  59. } else if ($this->startsWith($sms, "pass")) {
  60. $codePass = "pass";
  61. } else {
  62. throw new Exception("No password found");
  63. }
  64.  
  65.  
  66.  
  67. $sms = $this->str_replace_first($codePass, "", $sms);
  68.  
  69. while ($this->charAt($sms, 0) == ' ' || $this->charAt($sms, 0) == ':') {
  70. $sms = substr($sms, 1);
  71. }
  72.  
  73. $i = 0;
  74. while ($this->charAt($sms, $i) != ',' && $this->charAt($sms, $i) != ' ' && $this->charAt($sms, $i) != '.' && $this->charAt($sms, $i) != ':') {
  75. $strPass .= $this->charAt($sms, $i);
  76. $i++;
  77.  
  78. if ($i >= strlen($sms))
  79. break;
  80. }
  81.  
  82. // return $strUsername.";".$strPass;
  83. return TRUE;
  84. } catch (Exception $ex) {
  85. return FALSE;
  86. }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement