Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function validates($sms) {
- try {
- $sms = strtolower($sms);
- // var_dump($sms);
- $strUsername = "";
- $strPass = "";
- $codeUser = "";
- $codePass = "";
- if ($this->startsWith($sms, "username anda")) {
- $codeUser = "username anda";
- } else if ($this->startsWith($sms, "username akses wifi.id anda adalah")) {
- $codeUser = "username akses wifi.id anda adalah";
- } else
- if ($this->startsWith($sms, "username")) {
- $codeUser = "username";
- } else if ($this->startsWith($sms, "user")) {
- $codeUser = "user";
- } else if ($this->startsWith($sms, "usr")) {
- $codeUser = "usr";
- } else if ($this->startsWith($sms, "usn")) {
- $codeUser = "usn";
- } else {
- throw new Exception("No username found");
- }
- $sms = $this->str_replace_first($codeUser, "", $sms);
- while ($this->charAt($sms, 0) == ' ' || $this->charAt($sms, 0) == ':') {
- $sms = substr($sms, 1);
- }
- $i = 0;
- while ($this->charAt($sms, $i) != ',' && $this->charAt($sms, $i) != ' ') {
- $strUsername .= $this->charAt($sms, $i);
- $i++;
- }
- $sms = $this->str_replace_first($strUsername, "", $sms);
- while ($this->charAt($sms, 0) == ' ' || $this->charAt($sms, 0) == ',') {
- $sms = substr($sms, 1);
- }
- if ($this->startsWith($sms, "password")) {
- $codePass = "password";
- } else if ($this->startsWith($sms, "pwd")) {
- $codePass = "pwd";
- } else if ($this->startsWith($sms, "psw")) {
- $codePass = "psw";
- } else if ($this->startsWith($sms, "pass")) {
- $codePass = "pass";
- } else {
- throw new Exception("No password found");
- }
- $sms = $this->str_replace_first($codePass, "", $sms);
- while ($this->charAt($sms, 0) == ' ' || $this->charAt($sms, 0) == ':') {
- $sms = substr($sms, 1);
- }
- $i = 0;
- while ($this->charAt($sms, $i) != ',' && $this->charAt($sms, $i) != ' ' && $this->charAt($sms, $i) != '.' && $this->charAt($sms, $i) != ':') {
- $strPass .= $this->charAt($sms, $i);
- $i++;
- if ($i >= strlen($sms))
- break;
- }
- // return $strUsername.";".$strPass;
- return TRUE;
- } catch (Exception $ex) {
- return FALSE;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement