function addBookCp($getdata, $postdata) { global $db; require 'image_upload.php'; $description = $postdata['description']; $bid = $getdata['bid']; $path = imageUpload('data/bcopy_images/', 'bcopyimage'); $stmt = mysqli_prepare($db, 'INSERT INTO bcopies SET bid = ?, uid = ?, description = ?, image = ?'); mysqli_stmt_bind_param($stmt, 'iiss', $bid, $_SESSION['userid'], htmlspecialchars($description), $path); mysqli_execute($stmt); $bcid = mysqli_insert_id($db); $success = mysqli_affected_rows($db); if ($success) { return $bcid; } return false; }
function addEdit() { global $db_name; $edit = isset($_POST['edit']); $type = $_REQUEST['type']; $errors = array(); $db = $edit ? R::load($db_name, (int) $_POST['edit']) : R::dispense($db_name); foreach ($_POST as $key => $val) { if (substr($key, 0, 3) != 'db_') { continue; } $db->{substr($key, 3)} = $val; } $filename = pickFilename(array($_POST['db_sponsor_name'], $_POST['db_title'])); $max_width = 0; if ($type == 'videos') { $max_width = 150; } else { if ($type == 'channels') { $max_width = 230; } } $image_url = imageUpload($filename, $max_width); if ($image_url) { $db->image_url = $image_url; } else { $errors[] = 'Image upload failed.'; } if ($type == 'channels') { $db->video_list = json_encode($_REQUEST['video_urls']); } if (!$edit) { $db->created_on = R::isoDateTime(); } else { $db->updated_on = R::isoDateTime(); } $id = R::store($db); $returnArr = $db->export(); if (!empty($errors)) { $returnArr['errors'] = $errors; } jsonForAjax($returnArr); }
function register_user($data) { global $db; $username = $data['username']; $first_name = $data['first_name']; $last_name = $data['last_name']; $email = $data['email']; $path = imageUpload('data/profile_imgs/', 'profileimg'); $hash = hash_fun($data['password']); //hash with salt at the end list($passhash, $salt) = explode("^", $hash); echo "TI"; $stmt = mysqli_prepare($db, "INSERT INTO users SET username = ? , password = ? , salt = ? , firstname = ? , lastname = ? , email = ?, profileimg = ? "); mysqli_stmt_bind_param($stmt, "sssssss", $username, $passhash, $salt, $first_name, $last_name, $email, $path); mysqli_stmt_execute($stmt); mysqli_stmt_store_result($stmt); var_dump($stmt); if (mysqli_affected_rows($db) != 1) { return false; } else { return mysqli_insert_id($db); } }
$mke = cookInput($_POST['mke']); $trans = cookInput($_POST['trans']); $price = cookInput($_POST['price']); $addDate = cookInput($_POST['addDate']); $vin = cookInput($_POST['vin']); $rego = cookInput($_POST['rego']); $condition = cookInput($_POST['condition']); $desc = cookInput($_POST['desc']); $sup = cookInput($_POST['supplier']); $_SESSION['editData'] = ['yr' => "{$yr}", 'brd' => "{$brd}", 'mdl' => "{$mdl}", 'mke' => "{$mke}", 'trans' => "{$trans}", 'price' => "{$price}", 'addDate' => "{$addDate}", 'vin' => "{$vin}", 'rego' => "{$rego}", 'condition' => "{$condition}", 'desc' => "{$desc}", 'sup' => "{$sup}"]; // Prepare SQL $edit_car_sql = "UPDATE `car` SET `mke`='{$mke}',`mdl`='{$mdl}',`brd`='{$brd}',`yr`='{$yr}',`vin`='{$vin}',`rego`='{$rego}',`cond`='{$condition}',`desr`='{$desc}',`date`='{$addDate}',`tran`='{$trans}',`price`='{$price}',`u_id`='{$sup}' WHERE c_id='{$id}';"; // Insert data if (mysqli_query($con, $edit_car_sql)) { if (is_uploaded_file($_FILES['carImg']['tmp_name'])) { $uploadResults = imageUpload($id); if ($uploadResults['upload'] == 1) { unset($_SESSION['editData']); exitError("manage/cars.php?c={$id}"); } elseif ($uploadResults['upload'] == 0) { unset($_SESSION['editData']); $_SESSION['editErr'] = $uploadResults['result']; exitError("manage/cars.php?c={$id}"); } } else { unset($_SESSION['editData']); exitError("manage/cars.php?c={$id}"); } } else { $_SESSION['editErr'] = 'There was an error updating the customer details, please try again.'; exitError("manage/cars.php?c={$id}");
private function override_mode($imageproxy = FALSE) { $tokenfile = glob('oauth/' . $this->password . '.*'); if (!empty($tokenfile)) { $access_token = @file_get_contents($tokenfile[0]); } if (empty($access_token)) { header('HTTP/1.1 401 Unauthorized'); header('WWW-Authenticate: Basic realm="Twip4 Override Mode"'); echo 'You are not allowed to use this API proxy'; exit; } $access_token = unserialize($access_token); $this->access_token = $access_token; if (preg_match('!oauth/access_token\\??!', $this->request_uri)) { $this->echo_token(); return; } if ($imageproxy) { if ($this->method == 'POST') { echo imageUpload($this->oauth_key, $this->oauth_secret, $this->access_token); } else { echo 'The image proxy needs POST method.'; } return; } if ($this->request_uri == null) { echo 'click <a href="' . $this->base_url . 'oauth.php">HERE</a> to get your API url'; return; } $this->parameters = $this->get_parameters(); $this->uri_fixer(); $this->connection = new TwitterOAuth($this->oauth_key, $this->oauth_secret, $this->access_token['oauth_token'], $this->access_token['oauth_token_secret']); if (preg_match('/^[^?]+\\.json/', $this->request_uri)) { $type = 'json'; } else { $type = 'xml'; } if (!isset($_REQUEST['include_entities'])) { if (preg_match('/^[^?]+\\?/', $this->request_uri)) { $this->request_uri .= '&include_entities=true'; } else { $this->request_uri .= '?include_entities=true'; } } switch ($this->method) { case 'POST': echo $this->parse_entities($this->connection->post($this->request_uri, $this->parameters), $type); break; case 'DELETE': echo $this->parse_entities($this->connection->delete($this->request_uri, $this->parameters), $type); break; default: echo $this->parse_entities($this->connection->get($this->request_uri), $type); break; } }
$trans = cookInput($_POST['trans']); $price = cookInput($_POST['price']); $addDate = cookInput($_POST['addDate']); $vin = cookInput($_POST['vin']); $rego = cookInput($_POST['rego']); $condition = cookInput($_POST['condition']); $desc = cookInput($_POST['desc']); $sup = cookInput($_POST['supplier']); $_SESSION['createData'] = ['yr' => "{$yr}", 'brd' => "{$brd}", 'mdl' => "{$mdl}", 'mke' => "{$mke}", 'trans' => "{$trans}", 'price' => "{$price}", 'addDate' => "{$addDate}", 'vin' => "{$vin}", 'rego' => "{$rego}", 'condition' => "{$condition}", 'desc' => "{$desc}", 'sup' => "{$sup}"]; // Prepare SQL $cre_car_sql = "INSERT INTO `car`(`mke`, `mdl`, `brd`, `yr`, `vin`, `rego`, `cond`, `desr`, `date`, `tran`, `price`, `u_id`) VALUES ('{$mke}','{$mdl}','{$brd}','{$yr}','{$vin}','{$rego}','{$condition}','{$desc}','{$addDate}','{$trans}','{$price}','{$sup}');"; // Insert data if (mysqli_query($con, $cre_car_sql)) { $car_ID = mysqli_insert_id($con); if (is_uploaded_file($_FILES['carImg']['tmp_name'])) { $uploadResults = imageUpload($car_ID); if ($uploadResults['upload'] == 1) { unset($_SESSION['createData']); exitError("manage/cars.php?c={$car_ID}"); } elseif ($uploadResults['upload'] == 0) { unset($_SESSION['createData']); $_SESSION['creErr'] = $uploadResults['result']; exitError("manage/cars.php?c={$car_ID}"); } } else { unset($_SESSION['createData']); exitError("manage/cars.php?c={$car_ID}"); } } else { $_SESSION['creErr'] = 'There was an issue listing the car, please try again.'; exitError('manage/cars.php');
$file_ext = pathinfo($file_name, PATHINFO_EXTENSION); //USE BUILT IN FUNCTION WHERE POSSIBLE $file_size = $_FILES['txtimage']['size']; $file_tmp = $_FILES['txtimage']['tmp_name']; //TMP NAME ALLOCATED WHILE FILE IS SITTING IN THE BROWSER TEMP MEMORY $file_error = $_FILES['txtimage']['error']; //echo $vid; exit; if ($file_name !== '') { //USE GETIMAGESIZE() FUNCTION TO VERIFY THAT IT IS INDEED AN IMAGE AS EXTENSIONS CAN BE EASILY CHANGED BY USER $imagesize = getimagesize($file_tmp); if (!$imagesize) { header('Location: album-add-new.php?key=notanimage'); exit; } else { //CALL THE IMAGEUPLOAD() TO PROCESS AND UPLOAD THE ORIGINAL IMAGE TO A SERVER LOCATION TO KEEP AS A GENERIC IMAGE $vimgoriginal = imageUpload($file_name, $file_ext, $file_size, $file_tmp, $file_error); //DEFINE THE ORIGINAL IMAGE PATH THAT HAS PASSED ALL THE TESTS FROM THE SERVER LOCATION SO WE CAN MANIPULATE IT $vimgpathoriginal = 'uploaded-images/projects/' . str_replace(' ', '-', strtolower($vtitle)) . '/' . $vimgoriginal; //echo $vimgoriginal; exit(); if ($file_ext === 'jpeg' || $file_ext === 'jpg') { //RESIZE AND SAVE IN SERVER FOLDER $jpegimagefrmsrc = imagecreatefromjpeg($file_tmp); //CREATE A NEW JPEG IMAGE FILE $newimg = imageResize($jpegimagefrmsrc); //WE CALL THE IMAGE RESIZE FUNCTION imagejpeg($newimg, $vimgpathoriginal, 100); //THIS WRITES THE NEW JPEG IMAGE TO A FILE WITH 100% QUALITY //CLEAN UP TMP FILES AND OBJECTS NO LONGER REQUIRED TO SAVE STORAGE SPACE imagedestroy($jpegimagefrmsrc); } elseif ($file_ext === 'png') { $pngimagefrmsrc = imagecreatefrompng($file_tmp);
private function override_mode($imageproxy = FALSE) { $tokenfile = glob('oauth/' . $this->password . '.*'); if (!empty($tokenfile)) { $access_token = @file_get_contents($tokenfile[0]); } if (empty($access_token)) { header('HTTP/1.1 401 Unauthorized'); header('WWW-Authenticate: Basic realm="Twip4 Override Mode"'); echo 'You are not allowed to use this API proxy'; exit; } $access_token = unserialize($access_token); $this->access_token = $access_token; $this->has_get_token = isset($access_token['oauth_token_get']); if ($imageproxy) { if ($this->method == 'POST') { echo imageUpload($this->oauth_key, $this->oauth_secret, $this->access_token); } else { echo 'The image proxy needs POST method.'; } return; } if ($this->request_uri == null) { echo 'click <a href="' . $this->base_url . 'oauth.php">HERE</a> to get your API url'; return; } $this->parameters = $this->get_parameters(); foreach (array('pc', 'earned') as $param) { unset($this->parameters[$param]); } $this->connection = new TwitterOAuth($this->oauth_key, $this->oauth_secret, $this->access_token['oauth_token'], $this->access_token['oauth_token_secret']); $this->connection_get = $this->has_get_token ? new TwitterOAuth($this->oauth_key_get, $this->oauth_secret_get, $this->access_token['oauth_token_get'], $this->access_token['oauth_token_secret_get']) : $this->connection; $filterName = Twip::encode_uri($this->forwarded_request_uri); if (!array_key_exists($filterName, $this->filters)) { $filterName = '_default'; } $parts = parse_url($this->forwarded_request_uri); $raw_response = $this->filters[$filterName](array('path' => $parts['path'], 'method' => $this->method, 'params' => $this->parameters, 'self' => $this)); echo $this->parse_entities($raw_response); return; }
//exit(); $cfg['menu'] = 'config'; $action = getpost('action'); $flag = (int) getpost('flag'); if (PHP_SAPI == 'cli') { cliUpdate(); } elseif ($action == 'update') { update(); } elseif ($action == 'imageUpdate') { imageUpdate($flag); } elseif ($action == 'saveImage') { saveImage($flag); } elseif ($action == 'selectImageUpload') { selectImageUpload($flag); } elseif ($action == 'imageUpload') { imageUpload($flag); } else { message(__FILE__, __LINE__, 'error', '[b]Unsupported input value for[/b][br]action'); } exit; // +------------------------------------------------------------------------+ // | Update | // +------------------------------------------------------------------------+ function update() { global $cfg, $db, $lastGenre_id, $getID3, $dirsCounter, $filesCounter, $curFilesCounter, $curDirsCounter; authenticate('access_admin', false, true); require_once 'getid3/getid3/getid3.php'; require_once 'include/play.inc.php'; // Needed for mpdUpdate() $cfg['cli_update'] = false;
function subEditBorrower() { global $session, $form; $id = $session->userid; $_POST_ORG = $_POST; //Logger_Array("FB LOG - updateprocess start",'fb_data', serialize($_POST['fb_data']).$_POST["busername"]); $_POST = sanitize_custom($_POST); for ($i = 1; $i <= 10; $i++) { $endorser_name[] = $_POST['endorser_name' . $i]; $endorser_email[] = $_POST['endorser_email' . $i]; $endorser_id[] = $_POST['endorser_id' . $i]; } if ($_POST['before_fb_data'] == '1') { $_SESSION['fb_data'] = $_POST; header('Location: index.php?p=13&fb_data=1#FB_cntct'); } else { if (isset($_FILES['front_national_id']['tmp_name']) && !is_uploaded_file($_FILES['front_national_id']['tmp_name']) && !empty($_POST['isFrntNatid'])) { $_FILES['front_national_id']['tmp_name'] = $_POST['isFrntNatid']; $_FILES['front_national_id']['name'] = end(explode("/", $_POST['isFrntNatid'])); } if (isset($_FILES['back_national_id']['tmp_name']) && !is_uploaded_file($_FILES['back_national_id']['tmp_name']) && !empty($_POST['isbcktnatid'])) { $_FILES['back_national_id']['tmp_name'] = $_POST['isbcktnatid']; $_FILES['back_national_id']['name'] = end(explode("/", $_POST['isbcktnatid'])); } if (isset($_FILES['address_proof']['tmp_name']) && !is_uploaded_file($_FILES['address_proof']['tmp_name']) && !empty($_POST['isaddrprf'])) { $_FILES['address_proof']['tmp_name'] = $_POST['isaddrprf']; $_FILES['address_proof']['name'] = end(explode("/", $_POST['isaddrprf'])); } if (isset($_FILES['legal_declaration']['tmp_name']) && !is_uploaded_file($_FILES['legal_declaration']['tmp_name']) && !empty($_POST['islgldecl'])) { $_FILES['legal_declaration']['tmp_name'] = $_POST['islgldecl']; $_FILES['legal_declaration']['name'] = end(explode("/", $_POST['islgldecl'])); } if (isset($_FILES['legal_declaration2']['tmp_name']) && !is_uploaded_file($_FILES['legal_declaration2']['tmp_name']) && !empty($_POST['islgldecl2'])) { $_FILES['legal_declaration2']['tmp_name'] = $_POST['islgldecl2']; $_FILES['legal_declaration2']['name'] = end(explode("/", $_POST['islgldecl2'])); } $photo = $_POST['isPhoto_select']; if (is_uploaded_file($_FILES['bphoto']['tmp_name'])) { $photo = $_FILES['bphoto']['tmp_name']; } if (!isset($_POST['repaidpast'])) { $repaidPast = 0; } else { $repaidPast = $_POST['repaidpast']; } if (!isset($_POST['debtfree'])) { $debtFree = 0; } else { $debtFree = $_POST['debtfree']; } if (!isset($_POST['share_update'])) { $share_update = 0; } else { $share_update = $_POST['share_update']; } if (!empty($_POST["uploadfileanchor"])) { $result = 2; } else { Logger_Array("FB LOG - updateprocess", 'fb_data', serialize($_POST['fb_data']) . $_POST["busername"]); $result = $session->editprofile_b($_POST["busername"], $_POST["bfname"], $_POST["blname"], $_POST["bpass1"], $_POST["bpass2"], $_POST["bpostadd"], $_POST["bcity"], $_POST["bcountry"], $_POST["bemail"], $_POST["bmobile"], $_POST["reffered_by"], $_POST["bincome"], $_POST["babout"], $_POST["bbizdesc"], $photo, $id, $_POST["bnationid"], $_POST["labellang"], $_POST["community_name_no"], $_FILES, $_POST["abletocomplete"], $_POST["repaidpast"], $_POST["debtfree"], $_POST["share_update"], $_POST["borrower_behalf"], $_POST["behalf_name"], $_POST["behalf_number"], $_POST["behalf_email"], $_POST["behalf_town"], $_POST["borrower_behalf_id"], $_POST['submitform'], $_POST['uploadedDocs'], $_POST['bfamilycont1'], $_POST['bfamilycont2'], $_POST['bfamilycont3'], $_POST['bneighcont1'], $_POST['bneighcont2'], $_POST['bneighcont3'], $_POST['home_no'], $_POST['rec_form_offcr_name'], $_POST['rec_form_offcr_num'], $_POST['refer_member'], $_POST['volunteer_mentor'], $_POST['cntct_type'], $_POST['fb_data'], $endorser_name, $endorser_email, $endorser_id); } if ($result == 0) { require "editables/register.php"; $path = getEditablePath('register.php'); require "editables/" . $path; if ($_POST['submitform'] != trim($lang['register']['RegisterComplete'])) { $_SESSION['bedited'] = true; } if (is_uploaded_file($_FILES['bphoto']['tmp_name'])) { $img_file = $_FILES['bphoto']['tmp_name']; $ext = split('/', $_FILES['bphoto']['type']); imageUpload($img_file, $ext, $id); } else { if (!empty($_POST['isPhoto_select'])) { $img_file = TMP_IMAGE_DIR . $_POST['isPhoto_select']; $ext[1] = end(explode(".", $img_file)); imageUpload($img_file, $ext, $id); } } if (isset($_POST["labellang"]) && $_POST["labellang"] != "en") { $url = SITE_URL . $_POST["labellang"] . "/index.php?p=13"; } else { if (isset($_GET["language"])) { $language = $_GET["language"]; $url = SITE_URL . $language . "/index.php?p=13"; } else { $url = SITE_URL . "index.php?p=13"; } } if ($_POST['submitform'] == trim($lang['register']['RegisterComplete'])) { $url = SITE_URL . "index.php?p=50"; } header("Location: {$url}"); } else { $_SESSION['value_array'] = $_POST_ORG; $_SESSION['error_array'] = $form->getErrorArray(); $errurl1 = $_SERVER['HTTP_REFERER']; if (strstr($errurl1, "fb_join")) { $errurl = $errurl1; } else { $errurl = $errurl1 . "&fb_join=1"; } $supported = array("image/gif", "image/jpeg", "image/pjpeg", "image/png", "image/x-png", "application/pdf"); if (isset($_FILES['bphoto']['type'])) { $phototype = $_FILES['bphoto']['type']; } if (isset($_FILES['front_national_id']['type'])) { $frntidtype = $_FILES['front_national_id']['type']; } if (isset($_FILES['back_national_id']['type'])) { $bkidtype = $_FILES['back_national_id']['type']; } if (isset($_FILES['address_proof']['type'])) { $addrsype = $_FILES['address_proof']['type']; } if (isset($_FILES['legal_declaration']['type'])) { $legalype = $_FILES['legal_declaration']['type']; } if (isset($_FILES['legal_declaration2']['type'])) { $legl2type = $_FILES['legal_declaration2']['type']; } if (isset($_FILES['bphoto']['tmp_name']) && !empty($_FILES['bphoto']['tmp_name']) && in_array($phototype, $supported)) { chmod($_FILES['bphoto']['tmp_name'], 0644); $time = time(); if ($_FILES['bphoto']['tmp_name'] == "image/gif") { $photo = $time . ".gif"; } else { if ($_FILES['bphoto']['tmp_name'] == "image/jpeg" || $_FILES['bphoto']['tmp_name'] == "image/pjpeg") { $photo = $time . ".jpeg"; } else { if ($_FILES['bphoto']['tmp_name'] == "image/png" || $_FILES['bphoto']['tmp_name'] == "image/x-png") { $photo = $time . ".png"; } else { $photo = $_FILES['bphoto']['name']; } } } move_uploaded_file($_FILES['bphoto']['tmp_name'], TMP_IMAGE_DIR . $photo); $_SESSION['value_array']['isPhoto_select'] = $photo; } if (isset($_FILES['front_national_id']['tmp_name']) && !empty($_FILES['front_national_id']['tmp_name']) && in_array($frntidtype, $supported)) { chmod($_FILES['front_national_id']['tmp_name'], 0644); $time = time(); if ($_FILES['front_national_id']['tmp_name'] == "image/gif") { $frntnatid = $time . ".gif"; } else { if ($_FILES['front_national_id']['tmp_name'] == "image/jpeg" || $_FILES['front_national_id']['tmp_name'] == "image/pjpeg") { $frntnatid = $time . ".jpeg"; } else { if ($_FILES['front_national_id']['tmp_name'] == "image/png" || $_FILES['front_national_id']['tmp_name'] == "image/x-png") { $frntnatid = $time . ".png"; } else { $frntnatid = $_FILES['front_national_id']['name']; } } } move_uploaded_file($_FILES['front_national_id']['tmp_name'], TMP_IMAGE_DIR . $frntnatid); $_SESSION['value_array']['isFrntNatid'] = TMP_IMAGE_DIR . $frntnatid; } if (isset($_FILES['back_national_id']['tmp_name']) && !empty($_FILES['back_national_id']['tmp_name']) && in_array($bkidtype, $supported)) { chmod($_FILES['back_national_id']['tmp_name'], 0644); $time = time(); if ($_FILES['back_national_id']['tmp_name'] == "image/gif") { $bcktnatid = $time . ".gif"; } else { if ($_FILES['back_national_id']['tmp_name'] == "image/jpeg" || $_FILES['back_national_id']['tmp_name'] == "image/pjpeg") { $bcktnatid = $time . ".jpeg"; } else { if ($_FILES['back_national_id']['tmp_name'] == "image/png" || $_FILES['back_national_id']['tmp_name'] == "image/x-png") { $bcktnatid = $time . ".png"; } else { $bcktnatid = $_FILES['back_national_id']['name']; } } } move_uploaded_file($_FILES['back_national_id']['tmp_name'], TMP_IMAGE_DIR . $bcktnatid); $_SESSION['value_array']['isbcktnatid'] = TMP_IMAGE_DIR . $bcktnatid; } if (isset($_FILES['address_proof']['tmp_name']) && !empty($_FILES['address_proof']['tmp_name']) && in_array($addrsype, $supported)) { chmod($_FILES['address_proof']['tmp_name'], 0644); $time = time(); if ($_FILES['address_proof']['tmp_name'] == "image/gif") { $addrprf = $time . ".gif"; } else { if ($_FILES['address_proof']['tmp_name'] == "image/jpeg" || $_FILES['address_proof']['tmp_name'] == "image/pjpeg") { $addrprf = $time . ".jpeg"; } else { if ($_FILES['address_proof']['tmp_name'] == "image/png" || $_FILES['address_proof']['tmp_name'] == "image/x-png") { $addrprf = $time . ".png"; } else { $addrprf = $_FILES['address_proof']['name']; } } } move_uploaded_file($_FILES['address_proof']['tmp_name'], TMP_IMAGE_DIR . $addrprf); $_SESSION['value_array']['isaddrprf'] = TMP_IMAGE_DIR . $addrprf; } if (isset($_FILES['legal_declaration']['tmp_name']) && !empty($_FILES['legal_declaration']['tmp_name']) && in_array($legalype, $supported)) { chmod($_FILES['legal_declaration']['tmp_name'], 0644); $time = time(); if ($_FILES['legal_declaration']['tmp_name'] == "image/gif") { $lgldecl = $time . ".gif"; } else { if ($_FILES['legal_declaration']['tmp_name'] == "image/jpeg" || $_FILES['legal_declaration']['tmp_name'] == "image/pjpeg") { $lgldecl = $time . ".jpeg"; } else { if ($_FILES['legal_declaration']['tmp_name'] == "image/png" || $_FILES['legal_declaration']['tmp_name'] == "image/x-png") { $lgldecl = $time . ".png"; } else { $lgldecl = $_FILES['legal_declaration']['name']; } } } move_uploaded_file($_FILES['legal_declaration']['tmp_name'], TMP_IMAGE_DIR . $lgldecl); $_SESSION['value_array']['islgldecl'] = TMP_IMAGE_DIR . $lgldecl; } if (isset($_FILES['legal_declaration2']['tmp_name']) && !empty($_FILES['legal_declaration2']['tmp_name']) && in_array($legl2type, $supported)) { chmod($_FILES['legal_declaration2']['tmp_name'], 0644); $time = time(); if ($_FILES['legal_declaration2']['tmp_name'] == "image/gif") { $lgldecl2 = $time . ".gif"; } else { if ($_FILES['legal_declaration2']['tmp_name'] == "image/jpeg" || $_FILES['legal_declaration2']['tmp_name'] == "image/pjpeg") { $lgldecl2 = $time . ".jpeg"; } else { if ($_FILES['legal_declaration2']['tmp_name'] == "image/png" || $_FILES['legal_declaration2']['tmp_name'] == "image/x-png") { $lgldecl2 = $time . ".png"; } else { $lgldecl2 = $_FILES['legal_declaration2']['name']; } } } move_uploaded_file($_FILES['legal_declaration2']['tmp_name'], TMP_IMAGE_DIR . $lgldecl2); $_SESSION['value_array']['islgldecl2'] = TMP_IMAGE_DIR . $lgldecl2; } if ($result == 1) { if (!empty($_SESSION['error_array']['repaidpast'])) { $errurl = 'index.php?p=13' . "#repaidpasterr"; } else { if (!empty($_SESSION['error_array']['debtfree'])) { $errurl = 'index.php?p=13' . "#debtfreeerr"; } else { if (!empty($_SESSION['error_array']['share_update'])) { $errurl = 'index.php?p=13' . "#share_updateerr"; } else { if (!empty($_SESSION['error_array']['behalf_name'])) { $errurl = 'index.php?p=13' . "#behalf_nameerr"; } else { if (!empty($_SESSION['error_array']['behalf_number'])) { $errurl = 'index.php?p=13' . "#behalf_numbererr"; } else { if (!empty($_SESSION['error_array']['behalf_email'])) { $errurl = 'index.php?p=13' . "#behalf_emailerr"; } else { if (!empty($_SESSION['error_array']['behalf_town'])) { $errurl = 'index.php?p=13' . "#behalf_townerr"; } else { if (!empty($_SESSION['error_array']['busername'])) { $errurl = 'index.php?p=13' . "#busernameerr"; } else { if (!empty($_SESSION['error_array']['bpass1'])) { $errurl = 'index.php?p=13' . "#bpass1err"; } else { if (!empty($_SESSION['error_array']['bfname'])) { $errurl = 'index.php?p=13' . "#bfnameerr"; } else { if (!empty($_SESSION['error_array']['blname'])) { $errurl = 'index.php?p=13' . "#blnameerr"; } else { if (!empty($_SESSION['error_array']['bphoto'])) { $errurl = 'index.php?p=13' . "#bphotoerr"; } else { if (!empty($_SESSION['error_array']['bpostadd'])) { $errurl = 'index.php?p=13' . "#bpostadderr"; } else { if (!empty($_SESSION['error_array']['bcity'])) { $errurl = 'index.php?p=13' . "#bcityerr"; } else { if (!empty($_SESSION['error_array']['bcountry'])) { $errurl = 'index.php?p=13' . "#bcountryerr"; } else { if (!empty($_SESSION['error_array']['bnationid'])) { $errurl = 'index.php?p=13' . "#bnationiderr"; } else { if (!empty($_SESSION['error_array']['bemail'])) { $errurl = 'index.php?p=13' . "#bemailerr"; } else { if (!empty($_SESSION['error_array']['bmobile'])) { $errurl = 'index.php?p=13' . "#bmobileerr"; } else { if (!empty($_SESSION['error_array']['babout'])) { $errurl = 'index.php?p=13' . "#babouterr"; } else { if (!empty($_SESSION['error_array']['bbizdesc'])) { $errurl = 'index.php?p=13' . "#bbizdescerr"; } else { if (!empty($_SESSION['error_array']['referrer'])) { $errurl = 'index.php?p=13' . "#referrererr"; } else { if (!empty($_SESSION['error_array']['front_national_id'])) { $errurl = 'index.php?p=13' . "#front_national_iderr"; } else { if (!empty($_SESSION['error_array']['back_national_id'])) { $errurl = 'index.php?p=13' . "#back_national_iderr"; } else { if (!empty($_SESSION['error_array']['address_proof'])) { $errurl = 'index.php?p=13' . "#address_prooferr"; } else { if (!empty($_SESSION['error_array']['legal_declaration'])) { $errurl = 'index.php?p=13' . "#legal_declarationerr"; } else { if (!empty($_SESSION['error_array']['home_no'])) { $errurl = 'index.php?p=13' . "#home_noerr"; } else { if (!empty($_SESSION['error_array']['bfamilycont1'])) { $errurl = 'index.php?p=13' . "#bfamilycontact1"; } else { if (!empty($_SESSION['error_array']['bfamilycont2'])) { $errurl = 'index.php?p=13' . "#bfamilycontact2"; } else { if (!empty($_SESSION['error_array']['bfamilycont3'])) { $errurl = 'index.php?p=13' . "#bfamilycontact3"; } else { if (!empty($_SESSION['error_array']['bneighcont1'])) { $errurl = 'index.php?p=13' . "#bneighcontact1"; } else { if (!empty($_SESSION['error_array']['bneighcont2'])) { $errurl = 'index.php?p=13' . "#bneighcontact2"; } else { if (!empty($_SESSION['error_array']['bneighcont3'])) { $errurl = 'index.php?p=13' . "#bneighcontact3"; } else { if (!empty($_SESSION['error_array']['refer_member'])) { $errurl = 'index.php?p=13' . "#refer_membererr"; } else { if (!empty($_SESSION['error_array']['volunteer_mentor'])) { $errurl = 'index.php?p=13' . "#volunteer_mentorerr"; } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } header("Location: {$errurl}"); } else { $url = $_SERVER['HTTP_REFERER']; if (strstr($url, "fb_join")) { header("Location: {$url}" . $_POST["uploadfileanchor"]); } else { // redirect to borrower form after file upload. $_POST["uploadfileanchor"] contains an anchor header("Location: {$url}&fb_join=1" . $_POST["uploadfileanchor"]); } } //header('Location: index.php?p=13&err=1007'); } } }
function subRegBorrower() { global $session, $database, $form; $_POST_ORG = $_POST; $_POST = sanitize_custom($_POST); $id = 0; $user_guess = ''; for ($i = 1; $i <= 10; $i++) { $endorser_name[] = $_POST['endorser_name' . $i]; $endorser_email[] = $_POST['endorser_email' . $i]; } if ($_POST['before_fb_data'] == '1') { $_SESSION['fb_data'] = $_POST; header('Location: index.php?p=1&sel=1&fb_data=1#FB_cntct'); exit; } else { if (isset($_POST['recaptcha_response_field'])) { $user_guess = $_POST['recaptcha_response_field']; } if (!is_uploaded_file($_FILES['front_national_id']['tmp_name']) && !empty($_POST['isFrntNatid'])) { $_FILES['front_national_id']['tmp_name'] = $_POST['isFrntNatid']; $_FILES['front_national_id']['name'] = end(explode("/", $_POST['isFrntNatid'])); } if (!is_uploaded_file($_FILES['back_national_id']['tmp_name']) && !empty($_POST['isbcktnatid'])) { $_FILES['back_national_id']['tmp_name'] = $_POST['isbcktnatid']; $_FILES['back_national_id']['name'] = end(explode("/", $_POST['isbcktnatid'])); } if (!is_uploaded_file($_FILES['address_proof']['tmp_name']) && !empty($_POST['isaddrprf'])) { $_FILES['address_proof']['tmp_name'] = $_POST['isaddrprf']; $_FILES['address_proof']['name'] = end(explode("/", $_POST['isaddrprf'])); } if (!is_uploaded_file($_FILES['legal_declaration']['tmp_name']) && !empty($_POST['islgldecl'])) { $_FILES['legal_declaration']['tmp_name'] = $_POST['islgldecl']; $_FILES['legal_declaration']['name'] = end(explode("/", $_POST['islgldecl'])); } if (!is_uploaded_file($_FILES['legal_declaration2']['tmp_name']) && !empty($_POST['islgldecl2'])) { $_FILES['legal_declaration2']['tmp_name'] = $_POST['islgldecl2']; $_FILES['legal_declaration2']['name'] = end(explode("/", $_POST['islgldecl2'])); } $photo = $_POST['isPhoto_select']; if (is_uploaded_file($_FILES['bphoto']['tmp_name'])) { $photo = $_FILES['bphoto']['tmp_name']; } if (!isset($_POST['repaidpast'])) { $repaidPast = 0; } else { $repaidPast = $_POST['repaidpast']; } if (!isset($_POST['debtfree'])) { $debtFree = 0; } else { $debtFree = $_POST['debtfree']; } if (!isset($_POST['share_update'])) { $share_update = 0; } else { $share_update = $_POST['share_update']; } if (isset($_POST['bcountry']) && !empty($_POST['bcountry'])) { $language = $database->getLanguage($_POST['bcountry']); } else { $language = 'en'; } if (!empty($_POST["uploadfileanchor"])) { $result = 2; } else { $result = $session->register_b($_POST["busername"], $_POST["bfname"], $_POST["blname"], $_POST["bpass1"], $_POST["bpass2"], $_POST["bpostadd"], $_POST["bcity"], $_POST["bcountry"], $_POST["bemail"], $_POST["bmobile"], $_POST["reffered_by"], $_POST["bincome"], $_POST["babout"], $_POST["bbizdesc"], $photo, $share_update, $user_guess, $id, $_POST["bnationid"], $language, $_POST["referrer"], $_POST["community_name_no"], $_FILES, $_POST['submitform'], $repaidPast, $debtFree, $_POST["borrower_behalf"], $_POST["behalf_name"], $_POST["behalf_number"], $_POST["behalf_email"], $_POST["behalf_town"], $_POST['bfamilycont1'], $_POST['bfamilycont2'], $_POST['bfamilycont3'], $_POST['bneighcont1'], $_POST['bneighcont2'], $_POST['bneighcont3'], $_POST['home_no'], $_POST['rec_form_offcr_name'], $_POST['rec_form_offcr_num'], $_POST['refer_member'], $_POST['volunteer_mentor'], $_POST['cntct_type'], $_POST['fb_data'], $endorser_name, $endorser_email); } if ($result == 0) { if (is_uploaded_file($_FILES['bphoto']['tmp_name'])) { $img_file = $_FILES['bphoto']['tmp_name']; $ext = split('/', $_FILES['bphoto']['type']); imageUpload($img_file, $ext, $id); } else { if (!empty($_POST['isPhoto_select'])) { $img_file = TMP_IMAGE_DIR . $_POST['isPhoto_select']; $ext[1] = end(explode(".", $img_file)); imageUpload($img_file, $ext, $id); } } $_POST["username"] = $_POST["busername"]; $_POST["password"] = $_POST["bpass1"]; $this->subLogin(); header('Location: index.php?p=50'); exit; } else { $supported = array("image/gif", "image/jpeg", "image/pjpeg", "image/png", "image/x-png", "application/pdf"); $_SESSION['value_array'] = $_POST_ORG; $phototype = $_FILES['bphoto']['type']; $frntidtype = $_FILES['front_national_id']['type']; $bkidtype = $_FILES['back_national_id']['type']; $addrsype = $_FILES['address_proof']['type']; $legalype = $_FILES['legal_declaration']['type']; $legl2type = $_FILES['legal_declaration2']['type']; if (!empty($_FILES['bphoto']['tmp_name']) && in_array($phototype, $supported)) { chmod($_FILES['bphoto']['tmp_name'], 0644); $time = time(); if ($_FILES['bphoto']['tmp_name'] == "image/gif") { $photo = $time . ".gif"; } else { if ($_FILES['bphoto']['tmp_name'] == "image/jpeg" || $_FILES['bphoto']['tmp_name'] == "image/pjpeg") { $photo = $time . ".jpeg"; } else { if ($_FILES['bphoto']['tmp_name'] == "image/png" || $_FILES['bphoto']['tmp_name'] == "image/x-png") { $photo = $time . ".png"; } else { $photo = $_FILES['bphoto']['name']; } } } move_uploaded_file($_FILES['bphoto']['tmp_name'], TMP_IMAGE_DIR . $photo); $_SESSION['value_array']['isPhoto_select'] = $photo; } if (!empty($_FILES['front_national_id']['tmp_name']) && in_array($frntidtype, $supported)) { chmod($_FILES['front_national_id']['tmp_name'], 0644); $time = time(); if ($_FILES['front_national_id']['tmp_name'] == "image/gif") { $frntnatid = $time . ".gif"; } else { if ($_FILES['front_national_id']['tmp_name'] == "image/jpeg" || $_FILES['front_national_id']['tmp_name'] == "image/pjpeg") { $frntnatid = $time . ".jpeg"; } else { if ($_FILES['front_national_id']['tmp_name'] == "image/png" || $_FILES['front_national_id']['tmp_name'] == "image/x-png") { $frntnatid = $time . ".png"; } else { $frntnatid = $_FILES['front_national_id']['name']; } } } move_uploaded_file($_FILES['front_national_id']['tmp_name'], TMP_IMAGE_DIR . $frntnatid); $_SESSION['value_array']['isFrntNatid'] = TMP_IMAGE_DIR . $frntnatid; } if (!empty($_FILES['back_national_id']['tmp_name']) && in_array($bkidtype, $supported)) { chmod($_FILES['back_national_id']['tmp_name'], 0644); $time = time(); if ($_FILES['back_national_id']['tmp_name'] == "image/gif") { $bcktnatid = $time . ".gif"; } else { if ($_FILES['back_national_id']['tmp_name'] == "image/jpeg" || $_FILES['back_national_id']['tmp_name'] == "image/pjpeg") { $bcktnatid = $time . ".jpeg"; } else { if ($_FILES['back_national_id']['tmp_name'] == "image/png" || $_FILES['back_national_id']['tmp_name'] == "image/x-png") { $bcktnatid = $time . ".png"; } else { $bcktnatid = $_FILES['back_national_id']['name']; } } } move_uploaded_file($_FILES['back_national_id']['tmp_name'], TMP_IMAGE_DIR . $bcktnatid); $_SESSION['value_array']['isbcktnatid'] = TMP_IMAGE_DIR . $bcktnatid; } if (!empty($_FILES['address_proof']['tmp_name']) && in_array($addrsype, $supported)) { chmod($_FILES['address_proof']['tmp_name'], 0644); $time = time(); if ($_FILES['address_proof']['tmp_name'] == "image/gif") { $addrprf = $time . ".gif"; } else { if ($_FILES['address_proof']['tmp_name'] == "image/jpeg" || $_FILES['address_proof']['tmp_name'] == "image/pjpeg") { $addrprf = $time . ".jpeg"; } else { if ($_FILES['address_proof']['tmp_name'] == "image/png" || $_FILES['address_proof']['tmp_name'] == "image/x-png") { $addrprf = $time . ".png"; } else { $addrprf = $_FILES['address_proof']['name']; } } } move_uploaded_file($_FILES['address_proof']['tmp_name'], TMP_IMAGE_DIR . $addrprf); $_SESSION['value_array']['isaddrprf'] = TMP_IMAGE_DIR . $addrprf; } if (!empty($_FILES['legal_declaration']['tmp_name']) && in_array($legalype, $supported)) { chmod($_FILES['legal_declaration']['tmp_name'], 0644); $time = time(); if ($_FILES['legal_declaration']['tmp_name'] == "image/gif") { $lgldecl = $time . ".gif"; } else { if ($_FILES['legal_declaration']['tmp_name'] == "image/jpeg" || $_FILES['legal_declaration']['tmp_name'] == "image/pjpeg") { $lgldecl = $time . ".jpeg"; } else { if ($_FILES['legal_declaration']['tmp_name'] == "image/png" || $_FILES['legal_declaration']['tmp_name'] == "image/x-png") { $lgldecl = $time . ".png"; } else { $lgldecl = $_FILES['legal_declaration']['name']; } } } move_uploaded_file($_FILES['legal_declaration']['tmp_name'], TMP_IMAGE_DIR . $lgldecl); $_SESSION['value_array']['islgldecl'] = TMP_IMAGE_DIR . $lgldecl; } if (!empty($_FILES['legal_declaration2']['tmp_name']) && in_array($legl2type, $supported)) { chmod($_FILES['legal_declaration2']['tmp_name'], 0644); $time = time(); if ($_FILES['legal_declaration2']['tmp_name'] == "image/gif") { $lgldecl2 = $time . ".gif"; } else { if ($_FILES['legal_declaration2']['tmp_name'] == "image/jpeg" || $_FILES['legal_declaration2']['tmp_name'] == "image/pjpeg") { $lgldecl2 = $time . ".jpeg"; } else { if ($_FILES['legal_declaration2']['tmp_name'] == "image/png" || $_FILES['legal_declaration2']['tmp_name'] == "image/x-png") { $lgldecl2 = $time . ".png"; } else { $lgldecl2 = $_FILES['legal_declaration2']['name']; } } } move_uploaded_file($_FILES['legal_declaration2']['tmp_name'], TMP_IMAGE_DIR . $lgldecl2); $_SESSION['value_array']['islgldecl2'] = TMP_IMAGE_DIR . $lgldecl2; } $_SESSION['error_array'] = $form->getErrorArray(); if ($result == 1) { $errurl1 = $_SERVER['HTTP_REFERER']; if (strstr($errurl1, "fb_join")) { $errurl = $errurl1; } else { $errurl = $errurl1 . "&fb_join=1"; } if (!empty($_SESSION['error_array']['repaidpast'])) { $errurl = $errurl . "#repaidpasterr"; } else { if (!empty($_SESSION['error_array']['debtfree'])) { $errurl = $errurl . "#debtfreeerr"; } else { if (!empty($_SESSION['error_array']['share_update'])) { $errurl = $errurl . "#share_updateerr"; } else { if (!empty($_SESSION['error_array']['behalf_name'])) { $errurl = $errurl . "#behalf_nameerr"; } else { if (!empty($_SESSION['error_array']['behalf_number'])) { $errurl = $errurl . "#behalf_numbererr"; } else { if (!empty($_SESSION['error_array']['behalf_email'])) { $errurl = $errurl . "#behalf_emailerr"; } else { if (!empty($_SESSION['error_array']['behalf_town'])) { $errurl = $errurl . "#behalf_townerr"; } else { if (!empty($_SESSION['error_array']['busername'])) { $errurl = $errurl . "#busernameerr"; } else { if (!empty($_SESSION['error_array']['bpass1'])) { $errurl = $errurl . "#bpass1err"; } else { if (!empty($_SESSION['error_array']['bfname'])) { $errurl = $errurl . "#bfnameerr"; } else { if (!empty($_SESSION['error_array']['blname'])) { $errurl = $errurl . "#blnameerr"; } else { if (!empty($_SESSION['error_array']['bpostadd'])) { $errurl = $errurl . "#bpostadderr"; } else { if (!empty($_SESSION['error_array']['bcity'])) { $errurl = $errurl . "#bcityerr"; } else { if (!empty($_SESSION['error_array']['bcountry'])) { $errurl = $errurl . "#bcountryerr"; } else { if (!empty($_SESSION['error_array']['bnationid'])) { $errurl = $errurl . "#bnationiderr"; } else { if (!empty($_SESSION['error_array']['bemail'])) { $errurl = $errurl . "#bemailerr"; } else { if (!empty($_SESSION['error_array']['bmobile'])) { $errurl = $errurl . "#bmobileerr"; } else { if (!empty($_SESSION['error_array']['reffered_by'])) { $errurl = $errurl . "#breffered_by"; } else { if (!empty($_SESSION['error_array']['babout'])) { $errurl = $errurl . "#babouterr"; } else { if (!empty($_SESSION['error_array']['bbizdesc'])) { $errurl = $errurl . "#bbizdescerr"; } else { if (!empty($_SESSION['error_array']['referrer'])) { $errurl = $errurl . "#referrererr"; } else { if (!empty($_SESSION['error_array']['front_national_id'])) { $errurl = $errurl . "#front_national_iderr"; } else { if (!empty($_SESSION['error_array']['back_national_id'])) { $errurl = $errurl . "#back_national_iderr"; } else { if (!empty($_SESSION['error_array']['address_proof'])) { $errurl = $errurl . "#address_prooferr"; } else { if (!empty($_SESSION['error_array']['legal_declaration'])) { $errurl = $errurl . "#legal_declarationerr"; } else { if (!empty($_SESSION['error_array']['user_guess'])) { $errurl = $errurl . "#recaptcha_response_fielderr"; } else { if (!empty($_SESSION['error_array']['bfamilycont'])) { $errurl = $errurl . "#bfamilycontact"; } else { if (!empty($_SESSION['error_array']['bneighcont'])) { $errurl = $errurl . "#bneighcontact"; } else { if (!empty($_SESSION['error_array']['home_no'])) { $errurl = $errurl . "#home_noerr"; } else { if (!empty($_SESSION['error_array']['refer_member'])) { $errurl = $errurl . "#refer_membererr"; } else { if (!empty($_SESSION['error_array']['volunteer_mentor'])) { $errurl = $errurl . "#volunteer_mentorerr"; } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } header("Location: {$errurl}"); exit; } else { $url = $_SERVER['HTTP_REFERER']; if (strstr($url, "fb_join")) { header("Location: {$url}" . $_POST["uploadfileanchor"]); } else { // redirect to borrower form after file upload. $_POST["uploadfileanchor"] contains an anchor header("Location: {$url}&fb_join=1" . $_POST["uploadfileanchor"]); } exit; } } } }
} } if (isset($_POST['btnVarUpdate'])) { require_once CLASSES . 'variable.php'; $var_id = $_POST['hidVarID']; $var_name = $_POST['txtVarName']; $var_value = $_POST['txtVarVal']; $variable = new Variable($var_id, 'edit'); if ($variable->update_variable($var_name, $var_value)) { unset($_POST['btnVarUpdate']); url_redirect(HTTP_SERVER . 'index.php?variable=1'); } else { } } if (isset($_POST['btnVarAdd'])) { require_once CLASSES . 'variable.php'; $var_name = $_POST['txtVarName']; $var_value = $_POST['txtVarVal']; $variable = new Variable(); if ($variable->add_variable($var_name, $var_value)) { unset($_POST['btnVarAdd']); url_redirect(HTTP_SERVER . 'index.php?variable=1'); } else { } } if (isset($_POST['btnUploadImg'])) { print_r($_FILES); if (imageUpload($_FILES['upImage']['tmp_name'], UPLOAD_DIR . $_FILES['upImage']['name'], UPLOAD_DIR . 'thumb_' . $_FILES['upImage']['name'])) { echo 'About Upload'; } }
//ajax call base rest call handler session_start(); include 'API/curl_api.php'; include '../config/config.php'; $api_type = htmlspecialchars($_POST["api_type"]); $token = preg_replace('/\\s+/', '', $_SESSION['authtoken']); switch ($api_type) { case "addPetTypes": $category_name = htmlspecialchars($_POST["category_name"]); $category_name_json = json_encode(array('name' => $category_name)); $url = 'http://' . PET_SERVICE . ':' . PET_SERVICE_PORT . '/category/'; callAuthApiAddPetTypes($url, $token, $category_name_json); break; case "addPets": $url_image_upload = 'http://' . FILE_SERVER; imageUpload($url_image_upload, $_FILES); $pet_category = htmlspecialchars($_POST["pet-category"]); $pet_age_months = htmlspecialchars($_POST["pet-age-months"]); $pet_price = htmlspecialchars($_POST["pet-price"]); $url = 'http://' . PET_SERVICE . ':' . PET_SERVICE_PORT . '/pet/'; $data_json = json_encode(array('category' => array('name' => $pet_category), 'ageMonths' => $pet_age_months, 'price' => $pet_price, 'image' => $_FILES['file']['name'])); callAuthApiAddPet($url, $token, $data_json); break; case "deletePetTypes": $category_name = htmlspecialchars($_POST["category_name"]); $url = 'http://' . PET_SERVICE . ':' . PET_SERVICE_PORT . '/category/' . urlencode($category_name); callAuthapiDeletePetType($url, $token); break; case "deletePet": $pet_id = htmlspecialchars($_POST["pet_id"]); $url = 'http://' . PET_SERVICE . ':' . PET_SERVICE_PORT . '/pet/' . $pet_id;
/** * Function to call imageUpload method to upload images. * This function upload current user profile image * This function upload current user cover image * @param int $userID user id * @return void */ public function imageUploadController($userID) { imageUpload($userID); }
<?php include './database.php'; error_reporting(); if (!empty($_POST)) { // mytest($_POST); $r = imageUpload('img_file'); if (!$r['e']) { $data = array('added_by' => 'Self', 'form_no' => getFormno(), 'fname' => $_POST['txt_Fname'], 'mname' => $_POST['txt_Mname'], 'lname' => $_POST['txt_Lname'], 'agent_code' => $_POST['txt_AgentCode'], 'club_membership' => $_POST['txt_ClubMembership'], 'branch' => $_POST['txt_Branch'], 'division' => $_POST['txt_Division'], 'contact_no' => $_POST['txt_ContactNo'], 'email' => $_POST['txt_Email'], 'office_add' => $_POST['txt_OfficeAddress'], 'resi_add' => $_POST['txt_ResiAddress'], 'city' => $_POST['txt_City'], 'state' => $_POST['txt_State'], 'pincode' => $_POST['txt_Pincode'], 'agency_since' => $_POST['txt_AgencySince'], 'oth_busi' => $_POST['txt_OtherBusiness'], 'date_reg' => date('Y-m-d h:i:s'), 'photo' => json_encode($r['updata']), 'type' => $_POST['txt_Type']); $x = false; if (insert('Agent_tbl', $data)) { $id = mysql_insert_id(); foreach ($_POST['txt_Area'] as $area) { $da = array('prof_id' => $id, 'area' => $area, 'create_date' => date('Y-m-d h:i:s'), 'status' => 'Active'); $x = insert('area', $da); } } if ($x) { $_SESSION['resmsg'] = array('e' => 0, 'msg' => "Agent or DO Registration Successfully."); header("Location: ../online_register.php"); } else { $_SESSION['resmsg'] = array('e' => 1, 'msg' => "Agent or DO Registration Failed."); header("Location: ../online_register.php"); } } else { $_SESSION['resmsg'] = array('e' => 0, 'msg' => $r['msg']); header("Location: ../online_register.php"); } } else { header("Location: ../online_register.php"); }
//ajax call base rest call handler session_start(); include 'API/curl_api.php'; include '../config/config.php'; $api_type = htmlspecialchars($_POST["api_type"]); $token = preg_replace('/\\s+/', '', $_SESSION['authtoken']); switch ($api_type) { case "addPetTypes": $category_name = htmlspecialchars($_POST["category_name"]); $category_name_json = json_encode(array('name' => $category_name)); $url = 'http://' . PET_SERVICE . ':' . PET_SERVICE_PORT . '/category/'; callAuthApiAddPetTypes($url, $token, $category_name_json); break; case "addPets": $url_image_upload = 'http://' . FILE_SERVER; imageUpload($url_image_upload, $_FILES, $_SESSION['authtoken']); $pet_category = htmlspecialchars($_POST["pet-category"]); $pet_age_months = htmlspecialchars($_POST["pet-age-months"]); $pet_price = htmlspecialchars($_POST["pet-price"]); $url = 'http://' . PET_SERVICE . ':' . PET_SERVICE_PORT . '/pet/'; $data_json = json_encode(array('category' => array('name' => $pet_category), 'ageMonths' => $pet_age_months, 'price' => $pet_price, 'image' => $_FILES['file']['name'])); callAuthApiAddPet($url, $token, $data_json); break; case "deletePetTypes": $category_name = htmlspecialchars($_POST["category_name"]); $url = 'http://' . PET_SERVICE . ':' . PET_SERVICE_PORT . '/category/' . urlencode($category_name); callAuthapiDeletePetType($url, $token); break; case "deletePet": $pet_id = htmlspecialchars($_POST["pet_id"]); $url = 'http://' . PET_SERVICE . ':' . PET_SERVICE_PORT . '/pet/' . $pet_id;
function loanApplicationPublicProfile() { global $session, $form; $_POST_ORG = $_POST; $_POST = sanitize_custom($_POST); $photo = $_POST['isPhoto_select']; if (is_uploaded_file($_FILES['bphoto']['tmp_name'])) { $photo = $_FILES['bphoto']['tmp_name']; } if (!empty($_POST["uploadfileanchor"])) { $supported = array("image/gif", "image/jpeg", "image/pjpeg", "image/png", "image/x-png", "application/pdf"); if (isset($_FILES['bphoto']['type'])) { $phototype = $_FILES['bphoto']['type']; } if (isset($_FILES['bphoto']['tmp_name']) && !empty($_FILES['bphoto']['tmp_name']) && in_array($phototype, $supported)) { chmod($_FILES['bphoto']['tmp_name'], 0644); $time = time(); if ($_FILES['bphoto']['tmp_name'] == "image/gif") { $photo = $time . ".gif"; } else { if ($_FILES['bphoto']['tmp_name'] == "image/jpeg" || $_FILES['bphoto']['tmp_name'] == "image/pjpeg") { $photo = $time . ".jpeg"; } else { if ($_FILES['bphoto']['tmp_name'] == "image/png" || $_FILES['bphoto']['tmp_name'] == "image/x-png") { $photo = $time . ".png"; } else { $photo = $_FILES['bphoto']['name']; } } } move_uploaded_file($_FILES['bphoto']['tmp_name'], TMP_IMAGE_DIR . $photo); $_SESSION['value_array'] = $_POST_ORG; $_SESSION['value_array']['isPhoto_select'] = $photo; $_SESSION['error_array'] = array(); header("Location: /index.php?p=9&step=2"); exit; } } else { $result = $session->loanApplicationPublicProfile(array_get($_POST, 'babout'), array_get($_POST, 'bbizdesc'), $photo); if ($result) { if (!empty($_POST['isPhoto_select']) && file_exists(TMP_IMAGE_DIR . $_POST['isPhoto_select'])) { $img_file = TMP_IMAGE_DIR . $_POST['isPhoto_select']; $ext[1] = end(explode(".", $img_file)); imageUpload($img_file, $ext, $session->userid); removeProfileImageCache($session->userid); } $_SESSION['loanapplic']['step2'] = true; header("Location: /index.php?p=9&step=3"); } else { $_SESSION['value_array'] = $_POST_ORG; $_SESSION['error_array'] = $form->getErrorArray(); $errurl = "/index.php?p=9&step=2"; if (!empty($_SESSION['error_array']['bphoto'])) { $errurl = '/index.php?p=9&step=2#bphoto'; } elseif (!empty($_SESSION['error_array']['babout'])) { $errurl = '/index.php?p=9&step=2#babout'; } elseif (!empty($_SESSION['error_array']['bbizdesc'])) { $errurl = '/index.php?p=9&step=2#bbizdesc'; } header("Location: {$errurl}"); } exit; } }
function fileUpload($uploadPath, $fileName, $fileFieldName, $imageTypes = array('image/gif', 'image/jpeg', 'image/pjpeg'), $fileSize = 200, $oldImageNameName = '', $defaultFileName = '') { if (in_array($_FILES[$fileFieldName]['type'], $imageTypes)) { #checking if image size is greater then 200kb or not.if greater then 200kb #then we are not updating image but we are updating other data $fileSizeNew = $_FILES[$fileFieldName]['size'] / 1024; if ((int) $fileSizeNew > $fileSize) { $imgsuccess = 0; return $imgsuccess; } else { $fileName = imageUpload($uploadPath, $fileName, $_FILES[$fileFieldName]['tmp_name'], $defaultFileName); @unlink(LIST_ROOT_ADMIN . '/images/logo_header/' . $oldImageNameName); $imgsuccess = 1; return $imgsuccess; } } else { $imgsuccess = 2; return $imgsuccess; } }
require 'models/user_functions.php'; if (isset($_SESSION)) { $emailError = ''; $imageError = ''; if (!empty($_POST['newemail'])) { $valid = validateEmail($_POST['newemail']); if ($valid) { $success = updateEmail($_POST['newemail'], $_SESSION['userid']); if (!$success) { $emailError = 'το E-mail'; } } else { $emailError = 'το E-mail'; } } if (!empty($_FILES['newimg'])) { $path = imageUpload('data/profile_imgs/', 'newimg'); $success = false; if ($path) { $success = imageUpdate($path, $_SESSION['userid']); } if (!$success) { $imageError = 'την Εικόνα'; } } if ($emailError || $imageError) { echo "Προσπαθήστε ξάνα υπήρξε πρόβλημα με : {$emailError} {$imageError} "; } else { echo 'Ολοκληρώθηκε.'; } }
session_destroy(); header("location: register.php?fx=error&value=MailAlreadyExist"); exit; } else { echo "New record created successfully. Last inserted ID is: " . $last_id; if (!file_exists(requestPath())) { mkdir(requestPath(), 0777, true); copy('img/default.jpg', requestPath() . "/profile.jpg"); } else { if (!file_exists(requestPath() . "/profile.jpg")) { copy('img/default.jpg', requestPath() . "/profile.jpg"); } } localMail($email, $name, $surname, $randomString, $last_id); //altervista($email, $randomString, $last_id); imageUpload(); session_unset(); session_destroy(); header("location: login.php"); exit; } } exit; break; default: header("location: index.php"); exit; break; } } }
function addBook($data, $files) { global $db; require 'image_upload.php'; //Insert title, description, cover url and isbn it books table $title = $data['title']; $description = $data['description']; $path = imageUpload('data/cover_images/', 'cover_img'); $stmt = mysqli_prepare($db, 'INSERT INTO books SET title = ?, description = ?, coverimage = ?, uid = ?'); mysqli_stmt_bind_param($stmt, 'sssi', htmlspecialchars($title), htmlspecialchars($description), $path, $_SESSION['userid']); mysqli_execute($stmt); $bid = mysqli_insert_id($db); foreach ($data['authors'] as $author) { //Insert authors name in authors table $stmt = mysqli_prepare($db, 'INSERT INTO bookauthors SET bid = ?, name = ?'); mysqli_stmt_bind_param($stmt, 'is', $bid, htmlspecialchars($author)); mysqli_execute($stmt); } foreach ($data['genres'] as $genreId) { //Insert authors name in authors table $stmt = mysqli_prepare($db, 'INSERT INTO bookgenres SET bid = ?, genreid = ?'); mysqli_stmt_bind_param($stmt, 'ii', $bid, $genreId); mysqli_execute($stmt); } return $bid; }