Esempio n. 1
0
     // dup
     list($locid) = $res->fetch_row();
     // 1st one.
     $lo = new PCLocation($db, $locid);
 } else {
     // no dup: create new
     $city = addslashes($loco->city);
     $state = addslashes($loco->state);
     if (!empty($zip) && $state && $state != '--') {
         $sql = "insert into locations (l_city,l_state,l_uid,l_acct,l_zip,exp_date) values('{$city}','{$state}',{$client->uid},{$client->acct},'{$zip}',{$client->exp_date})";
         $result = $db->query($sql);
         if (!$result) {
             throw new Exception(DEBUG ? "{$db->error}: {$sql}" : 'Can not insert locations', __LINE__);
         }
         $locid = $db->insert_id;
         $lo = new PCLocation($db, $locid);
     } else {
         throw new Exception('Can not insert location: ZIP or STATE is missing', __LINE__);
     }
 }
 if ($lo) {
     $lo->l_facility = addslashes(htmlspecialchars(strip_tags($loco->facility)));
     $lo->l_city = addslashes($loco->city);
     $lo->l_state = addslashes($loco->state);
     $lo->l_commu2 = addslashes($loco->commu2);
     $lo->l_inderserved = $loco->underserved ? 1 : 0;
     $descr = addslashes("{$loco->description}");
     $lo->l_description = $descr;
     $commdescr = addslashes("{$loco->commdescr}");
     $lo->l_commdescr = $commdescr;
     $progress .= ' updating...';
         $locations->delpic(2);
     }
     if (strpos($_POST['del_pics'], "3,") !== false) {
         $locations->delpic(3);
     }
     if (strpos($_POST['del_pics'], "4,") !== false) {
         $locations->delpic(4);
     }
     //$locations->delpic($del_pic);
     $next = true;
 }
 // upload_pic_0
 if ($_POST['uppic']) {
     $next = true;
     $numpic = $_REQUEST['num_pic'];
     $locations = new PCLocation($db, $l_id);
     if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
         $file_size = $_FILES['userfile']['size'];
         $file_type = $_FILES['userfile']['type'];
         if (substr($file_type, 0, 6) != 'image/') {
             throw new Exception('Pictures only, please', __LINE__);
         }
         if (!$file_size || $file_size > 65535) {
             $needresize = true;
         }
         if (!$db) {
             $db = db_career();
         }
         list($iw, $ih, $itype) = getimagesize($_FILES['userfile']['tmp_name']);
         $maxwid = $numpic == 4 ? 360 : 520;
         if ($needresize || $iw > $maxwid || $ih > 520) {