function process_signup_3($POST, $FILES, $user_id) { global $seo_tag, $consts; if ($user_id > 0) { ##/ Process Profile Pic include_once '../includes/resize_images.php'; $up_path = "user_files/prof/{$user_id}/"; if (!is_dir($up_path)) { mkdir($up_path, 0705, true); } $sql_prt = $profile_pic = ''; if (is_uploaded_file(@$_FILES['profile_pic']['tmp_name'])) { $copy_data = array(0 => array('i_part' => '_th', 'size_w' => 35, 'size_h' => 35)); $profile_pic = upload_img_rs('profile_pic', 250, 250, $up_path, 'Profile Pic', '', 250, 'CUSA_MSG_GLOBAL', false, $copy_data); if ($profile_pic != '') { $sql_prt .= ", profile_pic='{$profile_pic}'"; } } //die('x'); # #/save users $sql_users = "UPDATE users SET\n screen_name='{$POST['screen_name']}', identify_by='{$POST['identify_by']}' {$sql_prt}\n WHERE id = '{$user_id}'"; @mysql_exec($sql_users, 'save'); #/save user_info $sql_user_info = "UPDATE user_info SET\n country_code = '{$POST['country_code']}', state = '{$POST['state']}', city = '{$POST['city']}',\n \taddress_ln_1 = '{$POST['address_ln_1']}', address_ln_2 = '{$POST['address_ln_2']}',\n \tzip = '{$POST['zip']}', phone_number = '{$POST['phone_number']}'\n WHERE user_id = '{$user_id}'"; @mysql_exec($sql_user_info, 'save'); //die('x'); $_SESSION['signup_success'] = '2'; $_SESSION['signup_stage'] = 'signup-details'; reset_attempt_counts(); redirect_me('signup-details/success'); } else { $_SESSION["CUSA_MSG_GLOBAL"] = array(false, 'Unable to process your request at this moment! Please try again later.'); redirect_me($seo_tag); } }
$chk_user = mysql_exec("SELECT screen_name FROM users WHERE screen_name='{$_POST['screen_name']}' and id!='{$user_id}'", 'single'); if (!empty($chk_user)) { $fv_errors[] = array('This Screen Name is already used, please try a different one!'); } } if (!is_array($fv_errors) || empty($fv_errors) || count($fv_errors) <= 0) { ###/ Process Profile Pic include_once '../includes/resize_images.php'; $up_path = "user_files/prof/{$user_id}/"; if (!is_dir($up_path)) { mkdir($up_path, 0705, true); } $sql_prt = $profile_pic = ''; if (is_uploaded_file(@$_FILES['profile_pic']['tmp_name'])) { $copy_data = array(0 => array('i_part' => '_th', 'size_w' => 60, 'size_h' => 60)); $profile_pic = @upload_img_rs('profile_pic', 250, 250, $up_path, 'Profile Pic', '', 250, 'CUSA_MSG_GLOBAL', false, $copy_data); if ($profile_pic != '') { $sql_prt .= ", profile_pic='{$profile_pic}'"; $_POST['profile_pic'] = $profile_pic; } } #- #/ update users $sql_users = "UPDATE users SET email_add='{$_POST['email_add']}',\n screen_name='{$_POST['screen_name']}', first_name='{$_POST['first_name']}', middle_name='{$_POST['middle_name']}', last_name='{$_POST['last_name']}',\n company_name='{$_POST['company_name']}', identify_by='{$_POST['identify_by']}' {$sql_prt}\n WHERE id='{$user_id}'"; @mysql_exec($sql_users, 'save'); #/ Delete Old image $cur_profile_pic = @$_POST["cur_profile_pic"]; if ($cur_profile_pic != '' && $profile_pic != '' && $profile_pic != $cur_profile_pic) { @unlink($up_path . $cur_profile_pic); @unlink($up_path . @substr_replace($cur_profile_pic, '_th.', @strrpos($cur_profile_pic, '.'), 1)); //_th
$content_type = @$_POST['content_type']; if ($content_type == 'html') { $m_value = rem_risky_tags($_POST_ori['m_value']); } else { if ($content_type == 'plain') { $m_value = $_POST['m_value']; } } //var_dump($content_type, $m_value); die(); ##/ Image processing & savings include_once '../../includes/resize_images.php'; $up_path = "../assets/images_2/misc/"; //if(!is_dir($up_path)){mkdir($up_path, 0705, true);} $sql_prt = $new_m_image = ''; if (is_uploaded_file(@$_FILES['m_image']['tmp_name'])) { $new_m_image = upload_img_rs('m_image', 0, 0, $up_path, 'Image', '', '', 'CUSA_ADMIN_MSG_GLOBAL'); if ($new_m_image != '') { $sql_prt .= " m_image='{$new_m_image}', "; } } #- if ($misc_id > 0) { ###/ Updating Database #/ site_misc_data $sql_tb1 = "UPDATE site_misc_data SET title='{$_POST['title']}', m_value='{$m_value}',\n content_type='{$content_type}', content_settings='{$_POST['content_settings']}',\n {$sql_prt} m_cat='{$_POST['m_cat']}'\n WHERE id='{$misc_id}'"; //die($sql_tb1); mysql_exec($sql_tb1, 'save'); #- ##/ Delete Old images $cur_m_image = @$_POST["cur_m_image"]; if ($new_m_image != '' && $new_m_image != $cur_m_image) {
$up_type = $_FILES['m_file']['type']; //var_dump($up_type); die(); if (stristr($up_type, 'video') != false) { $m_type = 'video'; } else { if (stristr($up_type, 'image') != false) { $m_type = 'image'; } } } $placement_tag = $sql_prt = $sql_prt_2 = $new_m_file = ''; if ($m_type == 'video') { $new_m_file = upload_vdo('m_file', $up_path, 'Media File', '', 'CUSA_ADMIN_MSG_GLOBAL'); } else { if ($m_type == 'image') { $new_m_file = upload_img_rs('m_file', 0, 0, $up_path, 'Media File', '', '', 'CUSA_ADMIN_MSG_GLOBAL'); } } if ($new_m_file != '') { $sql_prt .= " m_file='{$new_m_file}', "; $sql_prt_2 .= " m_type='{$m_type}', "; $placement_tag = current(explode(".", $new_m_file)); $sql_prt .= " placement_tag='{$placement_tag}', "; } #- if ($med_id > 0) { ###/ Updating Database #/ site_media $sql_tb1 = "UPDATE site_media SET {$sql_prt} {$sql_prt_2}\n alt_text='{$_POST['alt_text']}', m_cat='{$_POST['m_cat']}'\n WHERE id='{$med_id}'"; mysql_exec($sql_tb1, 'save'); #-
/** * Function upload_img_rs_ar * PURPOSE: upload & resize images in array[] * * $field_name = Image field name * $img_width = width to resize to. set to '0' to prevent resize * $img_height = height to resize to. set to '0' to prevent resize * $up_loc = upload location for the image. Like '../img/clients' * $img_title = Image Title (mainly used for errors) * $insert_name_part = Insert Part in File Name (use to create different size images like thunbnail) * $fix_height = fix height as well * $images_only = upload and return info about Images Only from $_FILES * $copies = array with (insert_parts, size_w, size_h) to create copies [applicable on images only] * * * RETURNS: Array of new names * * [USAGE example] * $new_p_files = $sql_part_2 = array(); $copy_data = array(0=>array('i_part'=>'_small', 'size_w'=>300, 'size_h'=>300), 1=>array('i_part'=>'_t', 'size_w'=>30, 'size_h'=>30)); $new_p_files = upload_img_rs_ar('p_file', 0, 0, $up_path, 'Image', '', '', 'CUSAADMIN_MSG_GLOBAL', false, $copy_data); if(is_array($new_p_files) && count($new_p_files)>0) { for($i=0; $i<count($new_p_files); $i++) { if($new_p_files[$i]=='') continue; $sql_part_2[] = "('{$pf_id}', '{$new_p_files[$i]['new_name']}', '{$new_p_files[$i]['type']}')"; } } * */ function upload_img_rs_ar($field_name, $img_width, $img_height, $up_loc, $img_title, $insert_name_part = '', $fix_height = '', $error_sess_name = 'CUSA_MSG_GLOBAL', $images_only = false, $copies = array()) { $rtn_ar = array(); if (isset($_FILES[$field_name]) && @is_array($_FILES[$field_name]) && @is_array($_FILES[$field_name]['tmp_name'])) { for ($i = 0; $i < count($_FILES[$field_name]['tmp_name']); $i++) { //var_dump("<pre>", $_FILES[$field_name]['type'][$i]); if ($_FILES[$field_name]['tmp_name'][$i] == '') { $rtn_ar[$i] = ''; continue; } #/ determine type $up_type = $_FILES[$field_name]['type'][$i]; $m_type = ''; if (stristr($up_type, 'video') != false) { $m_type = 'video'; } else { if (stristr($up_type, 'image') != false) { $m_type = 'image'; } } #/ upload files $new_name = ''; if ($m_type == 'video') { if ($images_only != false) { continue; } $new_name = upload_vdo($field_name, $up_loc, $img_title, $insert_name_part, $error_sess_name, $i); } else { if ($m_type == 'image') { $new_name = upload_img_rs($field_name, $img_width, $img_height, $up_loc, $img_title, $insert_name_part, $fix_height, $error_sess_name, $i, $copies); } } if (!empty($new_name)) { $rtn_ar[$i]['new_name'] = $new_name; $rtn_ar[$i]['type'] = $m_type; } } } return $rtn_ar; }
} //var_dump("<pre>", $_POST, $voice_tag_ids_ar); die(); if (!empty($voice_tag_ids_ar)) { $voice_tag_ids = @json_encode($voice_tag_ids_ar); } } #- ##/ Image processing & savings include_once '../../includes/resize_images.php'; $up_path = "../user_files/prof/{$user_id}/voices/"; if (!is_dir($up_path)) { mkdir($up_path, 0705, true); } $sql_prt = $new_voice_pic = ''; if (is_uploaded_file(@$_FILES['voice_pic']['tmp_name'])) { $new_voice_pic = upload_img_rs('voice_pic', 0, 0, $up_path, 'Voice Pic', '', '', 'CUSA_ADMIN_MSG_GLOBAL'); if ($new_voice_pic != '') { $sql_prt .= " voice_pic='{$new_voice_pic}', "; } } #- if ($vc_id > 0) { #/ update $sql_tb1 = "UPDATE user_voices SET\n voice_cat_id='{$_POST['voice_cat_id']}', voice_tag_ids='{$voice_tag_ids}', question_text='{$_POST['question_text']}',\n voice_details='{$voice_details}', {$sql_prt} is_blocked='{$_POST['is_blocked']}'\n WHERE id='{$vc_id}'"; mysql_exec($sql_tb1, 'save'); #/ Delete Old images $cur_voice_pic = @$_POST["cur_voice_pic"]; if ($new_voice_pic != '' && $new_voice_pic != $cur_voice_pic) { @unlink($up_path . $cur_voice_pic); } $_SESSION["CUSA_ADMIN_MSG_GLOBAL"] = array(true, 'The Voice data has been successfully Updated');