function EditData($conn) { global $x_jobid, $user; $sFilter = ewSqlKeyWhere; if (!is_numeric($x_jobid)) { return false; } $sTmp = get_magic_quotes_gpc() ? stripslashes($x_jobid) : $x_jobid; $sFilter = str_replace("@jobid", AdjustSql($sTmp), $sFilter); // Replace key value $sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, $sFilter, ""); $rs = phpmkr_query($sSql, $conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql); $oldrs = phpmkr_fetch_array($rs); if (phpmkr_num_rows($rs) == 0) { return false; // Update Failed } else { $x_jobid = @$_POST["x_jobid"]; //$x_onlineuser_onlineuserid = @$_POST["x_onlineuser_onlineuserid"]; $x_position = @$_POST["x_position"]; $x_overview = @$_POST["x_overview"]; $x_salary = @$_POST["x_salary"]; $x_bonus = @$_POST["x_bonus"]; $x_benifits = @$_POST["x_benifits"]; $x_location = @$_POST["x_location"]; $x_company = @$_POST["x_company"]; $x_profile = @$_POST["x_profile"]; $x_contact_email = @$_POST["x_contact_email"]; $x_link = @$_POST["x_link"]; //$x_dt_created = @$_POST["x_dt_created"]; //$x_dt_expire = @$_POST["x_dt_expire"]; //$x_job_status = @$_POST["x_job_status"]; $theValue = $GLOBALS["x_jobid"] != "" ? intval($GLOBALS["x_jobid"]) : "NULL"; $fieldList["`jobid`"] = $theValue; //$theValue = ($GLOBALS["x_onlineuser_onlineuserid"] != "") ? intval($GLOBALS["x_onlineuser_onlineuserid"]) : "NULL"; //$fieldList["`onlineuser_onlineuserid`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_position"]) : $GLOBALS["x_position"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`position`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_overview"]) : $GLOBALS["x_overview"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`overview`"] = $theValue; $theValue = $GLOBALS["x_salary"] != "" ? intval($GLOBALS["x_salary"]) : "NULL"; $fieldList["`salary`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_bonus"]) : $GLOBALS["x_bonus"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`bonus`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_benifits"]) : $GLOBALS["x_benifits"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`benifits`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_location"]) : $GLOBALS["x_location"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`location`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_company"]) : $GLOBALS["x_company"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`company`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_profile"]) : $GLOBALS["x_profile"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`profile`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_contact_email"]) : $GLOBALS["x_contact_email"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`contact_email`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_link"]) : $GLOBALS["x_link"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`link`"] = $theValue; //$theValue = ($GLOBALS["x_dt_created"] != "") ? " '" . ConvertDateToMysqlFormat($GLOBALS["x_dt_created"]) . "'" : "'" . date("D, d M Y H:i:s") . "'"; //$fieldList["`dt_created`"] = $theValue; //$theValue = ($GLOBALS["x_dt_expire"] != "") ? " '" . ConvertDateToMysqlFormat($GLOBALS["x_dt_expire"]) . "'" : "Null"; //$fieldList["`dt_expire`"] = $theValue; //$theValue = (!get_magic_quotes_gpc()) ? addslashes($GLOBALS["x_job_status"]) : $GLOBALS["x_job_status"]; //$theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; //$fieldList["`job_status`"] = $theValue; // Updating event if (Recordset_Updating($fieldList, $oldrs)) { // Update $sSql = "UPDATE `job` SET "; foreach ($fieldList as $key => $temp) { $sSql .= "{$key} = {$temp}, "; } if (substr($sSql, -2) == ", ") { $sSql = substr($sSql, 0, strlen($sSql) - 2); } $sSql .= " WHERE " . $sFilter; phpmkr_query($sSql, $conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql); $result = phpmkr_affected_rows($conn) >= 0; // Updated event if ($result) { Recordset_Updated($fieldList, $oldrs); } } else { $result = false; // Update Failed } } return $result; }
function EditData($conn) { global $x_cvid, $user; $sFilter = ewSqlKeyWhere; if (!is_numeric($x_cvid)) { return false; } $sTmp = get_magic_quotes_gpc() ? stripslashes($x_cvid) : $x_cvid; $sFilter = str_replace("@cvid", AdjustSql($sTmp), $sFilter); // Replace key value $sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, $sFilter, ""); $rs = phpmkr_query($sSql, $conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql); // Get old recordset $oldrs = phpmkr_fetch_array($rs); if (phpmkr_num_rows($rs) == 0) { return false; // Update Failed } else { // Check file size $EW_MaxFileSize = @$_POST["EW_Max_File_Size"]; // Check the file size if (!empty($_FILES["x_picture"]["size"])) { if (!empty($EW_MaxFileSize) && $_FILES["x_picture"]["size"] > $EW_MaxFileSize) { die(str_replace("%s", $EW_MaxFileSize, "Max. file size (%s bytes) exceeded.")); } } $fn_x_picture = @$_FILES["x_picture"]["name"]; // Check the file type if (!empty($fn_x_picture)) { if (!ewUploadAllowedFileExt($fn_x_picture)) { die("File type is not allowed."); } } $ct_x_picture = @$_POST["x_picture"]; $x_picture = @$_POST["x_picture"]; $wd_x_picture = @$_POST["wd_x_picture"]; $ht_x_picture = @$_POST["ht_x_picture"]; $a_x_picture = @$_POST["a_x_picture"]; $x_first_name = @$_POST["x_first_name"]; $x_mid_name = @$_POST["x_mid_name"]; $x_last_name = @$_POST["x_last_name"]; $x_age = @$_POST["x_age"]; $x_sex = @$_POST["x_sex"]; $x_nationality = @$_POST["x_nationality"]; $x_is_legal = @$_POST["x_is_legal"]; $x_years_of_residence = @$_POST["x_years_of_residence"]; $x_address_1 = @$_POST["x_address_1"]; $x_address_2 = @$_POST["x_address_2"]; $x_address_3 = @$_POST["x_address_3"]; $x_postcode = @$_POST["x_postcode"]; $x_email = @$_POST["x_email"]; $x_mobile = @$_POST["x_mobile"]; $x_tel = @$_POST["x_tel"]; $x_employer = @$_POST["x_employer"]; $x_uk_license = @$_POST["x_uk_license"]; $x_european_license = @$_POST["x_european_license"]; $x_license_points = @$_POST["x_license_points"]; $x_marital_status = @$_POST["x_marital_status"]; $x_has_dependent = @$_POST["x_has_dependent"]; $x_can_relocate = @$_POST["x_can_relocate"]; $x_can_travel = @$_POST["x_can_travel"]; $x_employement_status = @$_POST["x_employement_status"]; $x_work_location = @$_POST["x_work_location"]; $x_position_held = @$_POST["x_position_held"]; $x_salary = @$_POST["x_salary"]; $x_bonus = @$_POST["x_bonus"]; $x_ambitions = @$_POST["x_ambitions"]; $x_salary_expectation_start = @$_POST["x_salary_expectation_start"]; $x_salary_expectation_one = @$_POST["x_salary_expectation_one"]; $x_salary_expectation_two = @$_POST["x_salary_expectation_two"]; $x_achievement_sales = @$_POST["x_achievement_sales"]; $x_achievement_food = @$_POST["x_achievement_food"]; $x_achievement_labour = @$_POST["x_achievement_labour"]; $x_interests = @$_POST["x_interests"]; $x_qualifications = @$_POST["x_qualifications"]; $x_tell_us = @$_POST["x_tell_us"]; $x_notice = @$_POST["x_notice"]; $x_dt_created = @$_POST["x_dt_created"]; $x_cv_status = @$_POST["x_cv_status"]; // Field onlineuser_onlineuserid $fieldList["`onlineuser_onlineuserid`"] = $user->onlineuserId; if ($a_x_picture == "2") { // Remove $fieldList["`picture`"] = "NULL"; $ox_picture = $oldrs["picture"]; $sTmpFolder = ewUploadPathEx(True, EW_UploadDestPath); if ($ox_picture != "") { @unlink($sTmpFolder . $ox_picture); } } else { if ($a_x_picture == "3") { // Update if (is_uploaded_file($_FILES["x_picture"]["tmp_name"])) { $sTmpFolder = ewUploadPathEx(true, EW_UploadDestPath); $ox_picture = $oldrs["picture"]; if ($ox_picture != "") { @unlink($sTmpFolder . $ox_picture); } $theName = ewUploadFileNameEx($sTmpFolder, $_FILES["x_picture"]["name"]); $destfile = $sTmpFolder . $theName; if (!move_uploaded_file($_FILES["x_picture"]["tmp_name"], $destfile)) { // Move file to destination path die("" . $destfile); } @chmod($destfile, defined(EW_UploadedFileMode) ? EW_UploadedFileMode : 0666); // File name $theName = !get_magic_quotes_gpc() ? addslashes($theName) : $theName; $fieldList["`picture`"] = " '" . $theName . "'"; @unlink($_FILES["x_picture"]["tmp_name"]); } } } $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_first_name"]) : $GLOBALS["x_first_name"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`first_name`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_mid_name"]) : $GLOBALS["x_mid_name"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`mid_name`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_last_name"]) : $GLOBALS["x_last_name"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`last_name`"] = $theValue; $theValue = $GLOBALS["x_age"] != "" ? intval($GLOBALS["x_age"]) : "NULL"; $fieldList["`age`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_sex"]) : $GLOBALS["x_sex"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`sex`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_nationality"]) : $GLOBALS["x_nationality"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`nationality`"] = $theValue; $theValue = $GLOBALS["x_is_legal"] != "" ? intval($GLOBALS["x_is_legal"]) : "NULL"; $fieldList["`is_legal`"] = $theValue; $theValue = $GLOBALS["x_years_of_residence"] != "" ? intval($GLOBALS["x_years_of_residence"]) : "NULL"; $fieldList["`years_of_residence`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_address_1"]) : $GLOBALS["x_address_1"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`address_1`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_address_2"]) : $GLOBALS["x_address_2"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`address_2`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_address_3"]) : $GLOBALS["x_address_3"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`address_3`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_postcode"]) : $GLOBALS["x_postcode"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`postcode`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_email"]) : $GLOBALS["x_email"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`email`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_mobile"]) : $GLOBALS["x_mobile"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`mobile`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_tel"]) : $GLOBALS["x_tel"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`tel`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_employer"]) : $GLOBALS["x_employer"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`employer`"] = $theValue; $theValue = $GLOBALS["x_uk_license"] != "" ? intval($GLOBALS["x_uk_license"]) : "NULL"; $fieldList["`uk_license`"] = $theValue; $theValue = $GLOBALS["x_european_license"] != "" ? intval($GLOBALS["x_european_license"]) : "NULL"; $fieldList["`european_license`"] = $theValue; $theValue = $GLOBALS["x_license_points"] != "" ? intval($GLOBALS["x_license_points"]) : "NULL"; $fieldList["`license_points`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_marital_status"]) : $GLOBALS["x_marital_status"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`marital_status`"] = $theValue; $theValue = $GLOBALS["x_has_dependent"] != "" ? intval($GLOBALS["x_has_dependent"]) : "NULL"; $fieldList["`has_dependent`"] = $theValue; $theValue = $GLOBALS["x_can_relocate"] != "" ? intval($GLOBALS["x_can_relocate"]) : "NULL"; $fieldList["`can_relocate`"] = $theValue; $theValue = $GLOBALS["x_can_travel"] != "" ? intval($GLOBALS["x_can_travel"]) : "NULL"; $fieldList["`can_travel`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_employement_status"]) : $GLOBALS["x_employement_status"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`employement_status`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_work_location"]) : $GLOBALS["x_work_location"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`work_location`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_position_held"]) : $GLOBALS["x_position_held"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`position_held`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_salary"]) : $GLOBALS["x_salary"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`salary`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_bonus"]) : $GLOBALS["x_bonus"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`bonus`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_ambitions"]) : $GLOBALS["x_ambitions"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`ambitions`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_salary_expectation_start"]) : $GLOBALS["x_salary_expectation_start"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`salary_expectation_start`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_salary_expectation_one"]) : $GLOBALS["x_salary_expectation_one"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`salary_expectation_one`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_salary_expectation_two"]) : $GLOBALS["x_salary_expectation_two"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`salary_expectation_two`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_achievement_sales"]) : $GLOBALS["x_achievement_sales"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`achievement_sales`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_achievement_food"]) : $GLOBALS["x_achievement_food"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`achievement_food`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_achievement_labour"]) : $GLOBALS["x_achievement_labour"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`achievement_labour`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_interests"]) : $GLOBALS["x_interests"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`interests`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_qualifications"]) : $GLOBALS["x_qualifications"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`qualifications`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_tell_us"]) : $GLOBALS["x_tell_us"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`tell_us`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_notice"]) : $GLOBALS["x_notice"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`notice`"] = $theValue; $theValue = $GLOBALS["x_dt_created"] != "" ? " '" . ConvertDateToMysqlFormat($GLOBALS["x_dt_created"]) . "'" : "'" . date("D, d M Y H:i:s") . "'"; $fieldList["`dt_created`"] = $theValue; $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_cv_status"]) : $GLOBALS["x_cv_status"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`cv_status`"] = $theValue; // Updating event if (Recordset_Updating($fieldList, $oldrs)) { // Update $sSql = "UPDATE `cv` SET "; foreach ($fieldList as $key => $temp) { $sSql .= "{$key} = {$temp}, "; } if (substr($sSql, -2) == ", ") { $sSql = substr($sSql, 0, strlen($sSql) - 2); } $sSql .= " WHERE " . $sFilter; phpmkr_query($sSql, $conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql); $result = phpmkr_affected_rows($conn) >= 0; // Updated event if ($result) { Recordset_Updated($fieldList, $oldrs); } } else { $result = false; // Update Failed } } return $result; }