Ejemplo n.º 1
0
  * 
  * @return boolean : true if user can proceed
  */
 case "check-gt-login":
     $to_return = true;
     if (!isset($_SESSION["user"])) {
         if ($_REQUEST["user"] != "" && $_REQUEST["camera_id"] != "" && $_REQUEST["password"] != "" && ($_REQUEST["frame_id"] != "number" || $_REQUEST["frame_number"] != "")) {
             $sql = $QUERIES->getUserIdFromName($_REQUEST['user'], $_REQUEST["password"]);
             $result = mysql_query($sql) or $to_return = false;
             if (mysql_num_rows($result) == 0) {
                 $to_return = false;
             } else {
                 while ($row = mysql_fetch_array($result)) {
                     $_SESSION["user"] = $row["userid"];
                     $_SESSION["camera_id"] = $_REQUEST["camera_id"];
                     $sql = $QUERIES->countNoGroupsByUserName($_REQUEST['user']);
                     $result_zero = mysql_query($sql) or $to_return = false;
                     if (mysql_num_rows($result_zero) == 0) {
                         $sql_1 = $QUERIES->getUserIdFromName($_REQUEST['user']);
                         $result_1 = mysql_query($sql_1) or $to_return = false;
                         while ($returned_id = mysql_fetch_array($result_1)) {
                             $sql_2 = $QUERIES->insertGroup(0, 'No group', 0, $returned_id["userid"]);
                             $final_result = mysql_query($sql_2) or $to_return = false;
                         }
                     }
                 }
             }
             if ($_REQUEST["frame_id"] == 'first') {
                 $sql = $QUERIES->getFirstFrameId($_SESSION['camera_id']);
                 $result_2 = mysql_query($sql) or $to_return = false;
                 while ($final_res = mysql_fetch_array($result_2)) {