$img_w = $img_info[0] + 20;
		$img_h = $img_info[1] + 60;
		echo "<script language=\"javascript\">WinOpen('/_php/viewer.php?path=".$pic_ref."&id=".$img_nam."','viewer',".$img_w.",".$img_h.")</script>";
	}
}

for ($x = 0; $x < 6; $x++) {
	if (${"f_upl_".$x}) {
		if (${"f_pic_".$x}) {
			if (!$id) {
				$idx = get_newid("referenz");
				$img_nam = $idx."_".$x;
			} else {
				$img_nam = $id."_".$x;
			}
			$pic = img_upload($img_ref,${"f_pic_".$x},${"f_pic_".$x."_name"});
			img_resize($img_ref,$pic,$img_nam,$img_w_sm,$img_w_lg);
			if ($picstr) {
				$pics = explode("#",$picstr);
			}
			for ($y = 0; $y < 6; $y++) {
				if (!$pics[$y]) {
					$pics[$y] = "-";
				}
			}
			$pics[$x] = $pic;
			$picstr = implode("#",$pics);
			unset($add_img[$x]);
		}
	}
}
Example #2
0
 private function saving($mode = '', $id = '', $image_name = '')
 {
     $img_src = $_FILES['image']['tmp_name'];
     $img_name = $_FILES['image']['name'];
     $img_type = $_FILES['image']['type'];
     $img_size = $_FILES['image']['size'];
     $rand = rand(00, 999999);
     $uniq_file_name = $rand . $img_name;
     if (empty($img_src)) {
         $image = $image_name;
     } else {
         $image = $uniq_file_name;
     }
     if ($mode == 'new') {
         $query = $this->product->save_product($image);
     } else {
         if ($mode == 'update') {
             $query = $this->product->update_product($id, $image);
         }
     }
     if ($query) {
         if (!empty($img_src)) {
             img_upload($img_src, $this->img_dir, $image, 'thumb');
         }
         parent::alert('success', 'Berhasil !', 'Data produk berhasil disimpan ! 
                         <a href=' . $this->base_link . '>Klik disini</a> untuk kembali');
     } else {
         parent::alert('error', 'Gagal !', 'Data produk gagal disimpan !');
     }
 }
Example #3
0
//Making form data adjustments
$name = $fName . " " . $lName;
$phone = "(" . substr($pNumber, 0, 3) . ") " . substr($pNumber, 3, 3) . "-" . substr($pNumber, 6);
//validating zip code.
//validate email.
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
} else {
    die(header("location:index.php?formerror=true&reason=Please use correct email form."));
}
//adding timestamp
//$timestamp = date('g:iA FdS\, Y');
$timestamp = date('Y-m-d g:i:s');
//Form
if ($_POST['submit']) {
    //Uplading image using imag upload function created in init/functions.php
    $upload = img_upload($file);
    if ($upload == True) {
        //could place a success message
        //image path
        $img_path = realpath('img/uploads/' . $_FILES['ft_img']['name']);
    }
    //====================================================================
    //Creating array with information from form data.
    $form_data = array('created_at' => $timestamp, 'name' => $fName . " " . $lName, 'phn_number' => $phone, 'email' => $email, 'address_1' => $address_1, 'address_2' => $address_2, 'zip' => $zip, 'city' => $city, 'state' => $state, 'img_path' => $img_path);
    //=====================================================================
    //Created the csv file for the user.
    $file = fopen("csv/user.csv", "w");
    foreach ($form_data as $line) {
        fputcsv($file, explode(',', $line));
    }
    fclose($file);
Example #4
0
 private function saving($mode = '', $id = '', $image_name = '')
 {
     $img_src = $_FILES['image']['tmp_name'];
     $img_name = $_FILES['image']['name'];
     $img_type = $_FILES['image']['type'];
     $img_size = $_FILES['image']['size'];
     $rand = rand(00, 999999);
     $uniq_file_name = $rand . $img_name;
     if (empty($img_src)) {
         $image = $image_name;
     } else {
         $image = $uniq_file_name;
     }
     if ($mode == 'new') {
         $query = $this->hs->save_home_slider($image);
     } else {
         if ($mode == 'update') {
             $query = $this->hs->update_home_slider($id, $image);
         }
     }
     if ($query) {
         if (!empty($img_src)) {
             img_upload($img_src, $this->img_dir, $image, 'slider', 962, 356);
             unlink($this->img_dir . $image);
         }
         parent::alert('success', 'Berhasil !', 'Data home slider berhasil disimpan ! 
                         Silahkan tambah data lagi atau <a href=' . $this->base_link . '>Klik disini</a> 
                         untuk kembali');
     } else {
         parent::alert('error', 'Gagal !', 'Data home slider gagal disimpan !');
     }
 }
Example #5
0
     }
     if ($error) {
         header("Location: ../add-project.php?status=error");
     } else {
         $id = proj_add($request["projname"], $request['category'], $request["abstract"], $request["description"], $members, isset($request['tags']) ? $request['tags'] : null);
         //upload images
         $images = array();
         $imgCtr = count($_FILES['images']['name']);
         echo "IMGCTR: {$imgCtr}<br/>";
         for ($i = 0; $i < $imgCtr; $i++) {
             $image = array("name" => $_FILES["images"]["name"][$i], "type" => $_FILES["images"]["type"][$i], "tmp_name" => $_FILES["images"]["tmp_name"][$i], "error" => $_FILES["images"]["error"][$i], "size" => $_FILES["images"]["size"][$i]);
             $images[] = $image;
         }
         echo $id;
         //save images in db
         proj_add_images($id, img_upload($id, $images));
     }
     header("Location: ../add-project.php");
     break;
 case "add_user":
     if (validateEmail($request['input_email'])) {
         if (preg_match("/^[A-Za-z](([A-Za-z\\s] | -[A-Za-z])|\"([A-Za-z\\s] | -[A-Za-z])*\")*\$/", $request['input_firstname'] . " " . $request['input_lastname'])) {
             $fName = $request['input_firstname'];
             $lName = $request['input_lastname'];
             $password = $request['input_password'];
             $email = $request['email'];
             $type = $request['type'];
             if (usr_add($email, $password, $fName, $lName, $type)) {
                 header("Location: ../add_user.php?status=success");
             } else {
                 header("Location: ../add_user.php?status=failure");
Example #6
0
 private function edit_brand()
 {
     $brand = $this->brand->get_brand($_GET['id']);
     if ($_POST) {
         $img_src = $_FILES['image']['tmp_name'];
         $img_name = $_FILES['image']['name'];
         $img_type = $_FILES['image']['type'];
         $img_size = $_FILES['image']['size'];
         $dir = $this->img_dir;
         $rand = rand(00, 999999);
         $uniq_file_name = $rand . $img_name;
         if (empty($img_src)) {
             $image = $brand['image'];
         } else {
             $image = $uniq_file_name;
         }
         $query = $this->brand->update_brand($_GET['id'], $image);
         if ($query) {
             if (!empty($img_src)) {
                 img_upload($img_src, $dir, $image, 'thumb');
             }
             parent::alert('success', 'Berhasil !', 'Data brand berhasil diubah !');
         } else {
             parent::alert('error', 'Gagal !', 'Data brand gagal diubah !');
         }
     }
     if ($brand['publish'] == 'Y') {
         $publish = $this->radio_config('publish', 'checked', '');
     } else {
         $publish = $this->radio_config('publish', '', 'checked');
     }
     $brand_data = $this->brand_data($_GET['id'], $brand['name'], $brand['image'], $brand['description']);
     $brand_config = $this->brand_config($publish, $brand['meta_desc'], $brand['meta_key']);
     $this->form_data('Ubah data brand', $brand_data, $brand_config);
 }
Example #7
0
 private function edit_pcategory()
 {
     $pcategory = $this->pcategory->get_pcategory($_GET['id']);
     if ($_POST) {
         $img_src = $_FILES['image']['tmp_name'];
         $img_name = $_FILES['image']['name'];
         $img_type = $_FILES['image']['type'];
         $img_size = $_FILES['image']['size'];
         $dir = $this->img_dir;
         $rand = rand(00, 999999);
         $uniq_file_name = $rand . $img_name;
         if (empty($img_src)) {
             $image = $pcategory['image'];
         } else {
             $image = $uniq_file_name;
         }
         $query = $this->pcategory->update_pcategory($_GET['id'], $image);
         if ($query) {
             if (!empty($img_src)) {
                 img_upload($img_src, $dir, $image, 'thumb');
             }
             parent::alert('success', 'Berhasil !', 'Data kategori produk berhasil disimpan ! 
                              Silahkan tambah data lagi atau <a href=' . $this->base_link . '>Klik disini</a> 
                              untuk kembali');
         } else {
             parent::alert('error', 'Gagal !', 'Data kategori produk gagal disimpan !');
         }
     }
     if ($pcategory['publish'] == 'Y') {
         $publish = $this->radio_config('publish', 'checked', '');
     } else {
         $publish = $this->radio_config('publish', '', 'checked');
     }
     $pcategory_data = $this->pcategory_data($_GET['id'], $_GET['id'], $pcategory['name'], $pcategory['image'], $pcategory['description']);
     $pcategory_config = $this->pcategory_config($publish, $pcategory['meta_desc'], $pcategory['meta_key']);
     $this->form_data('Ubah data kategori produk', $pcategory_data, $pcategory_config);
 }