Exemplo n.º 1
0
  * - Insert person into the database
  * **/
 case "add-person":
     $bb = $config->bb;
     $bbV = $config->bbV;
     //Query indicator: if true the query has been done
     $done = true;
     if (isset($_REQUEST["people_id"])) {
         //Retrieve person color
         $sql = $QUERIES->getPersonColor($_REQUEST['people_id'], $_SESSION['camera_id']);
         $result = mysql_query($sql) or $done = false;
         $hex = "";
         while ($row = mysql_fetch_array($result)) {
             $hex = $row['color'];
         }
         $sql = $QUERIES->insertPerson($_REQUEST['people_id'], $_SESSION['frame_id'], $_SESSION['camera_id'], $bb->x, $bb->y, $bb->width, $bb->height, $bbV->x, $bbV->y, $bbV->width, $bbV->height, 'null', 'null', 'null', 'null', $hex, 0, $_SESSION['user'], 0);
         $result = mysql_query($sql) or $done = false;
         if ($done) {
             $person = array("id" => $_REQUEST["people_id"], "color" => $hex, "angle_face" => null, "angle_face_z" => null, "angle_body" => null, "angle_body_z" => null, "group" => 0, "artwork" => 0, "prev_frame" => true, "bb" => array($bb->x, $bb->y, $bb->width, $bb->height), "bbV" => array($bbV->x, $bbV->y, $bbV->width, $bbV->height));
         }
     } else {
         //Generate random HEX color
         $hex = getRandomColorHEX();
         $sql = $QUERIES->insertGroup(0, 'No group', 0, $_SESSION['user']);
         $result = mysql_query($sql);
         $sql = $QUERIES->insertAvatar(0, 0, $config->realPeopleDefaultImg);
         $result = mysql_query($sql) or $done = false;
         if ($done) {
             $my_id = mysql_insert_id();
             $sql = $QUERIES->insertPerson($my_id, $_SESSION['frame_id'], $_SESSION['camera_id'], $bb->x, $bb->y, $bb->width, $bb->height, $bbV->x, $bbV->y, $bbV->width, $bbV->height, 'null', 'null', 'null', 'null', $hex, 0, $_SESSION['user'], 0);
             $result = mysql_query($sql) or $done = false;