public function Scan() { $userId = $_GET["user_id"]; $qr = $_GET["QR"]; $qrs = new QRModel(); //////validate QR Code $resQrs = $qrs->getWhere("textQR='{$qr}'"); if (count($resQrs) == 1) { if ($resQrs[0]->status == 0) { $this->error("Unasigned QR Code!"); } } else { $this->error("Wrong QR Code!"); } ///////fetch user details $user = new UserModel(); $user->getByID($userId); // pr($user); if ($user->user_name == null || $user->user_name == "") { $this->error("Who Are You ?!"); } ///////validate Table $ta = new MasterTableModel(); $arr = $ta->getWhere("QR='{$qr}'"); if (count($arr) == 1) { //status 0 = OCCUPIED if ($arr[0]->status == 0) { if ($arr[0]->id_order == 0) { $this->error("Empty Order ID"); } else { $this->requestJoinTable($user, $arr[0]->id_order); } } else { $this->requestRestoPermission($user, $arr[0]); } } else { $this->error("Wrong Table!"); } die; }
public static function isQRValid($QR) { $objQR = new QRModel(); $arrQR = $objQR->getWhere("textQR='{$QR}'"); if (count($arrQR) == 0) { return false; } else { return true; } }
public static function isQRValid($QR) { $objQR = new QRModel(); $arrQR = $objQR->getWhere("textQR='{$QR}'"); return count($arrQR) >= 1; }