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)) { $_SESSION["frame_id"] = intval($final_res["id"]); } } else { if ($_REQUEST["frame_id"] == 'FUF') { $sql = $QUERIES->getFirstUntaggedFrameId($_SESSION['user'], $_SESSION['camera_id']); $result_2 = mysql_query($sql) or $to_return = false;