function AddData($conn) { global $x_cvid, $user; $sFilter = ewSqlKeyWhere; // Check for duplicate key $bCheckKey = true; if (@$x_cvid == "" || is_null(@$x_cvid)) { $bCheckKey = false; } else { $sFilter = str_replace("@cvid", AdjustSql($x_cvid), $sFilter); // Replace key value } if ($bCheckKey) { $sSqlChk = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, $sFilter, ""); $rsChk = phpmkr_query($sSqlChk, $conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSqlChk); if (phpmkr_num_rows($rsChk) > 0) { //$_SESSION[ewSessionMessage] = "Duplicate value for primary key"; phpmkr_free_result($rsChk); return false; } phpmkr_free_result($rsChk); } $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"]; // Field onlineuser_onlineuserid $fieldList["`onlineuser_onlineuserid`"] = $user->onlineuserId; // Field picture if (is_uploaded_file($_FILES["x_picture"]["tmp_name"])) { $sTmpFolder = ewUploadPathEx(true, EW_UploadDestPath); $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"]); } // Field first_name $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_first_name"]) : $GLOBALS["x_first_name"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`first_name`"] = $theValue; // Field mid_name $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_mid_name"]) : $GLOBALS["x_mid_name"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`mid_name`"] = $theValue; // Field last_name $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_last_name"]) : $GLOBALS["x_last_name"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`last_name`"] = $theValue; // Field age $theValue = $GLOBALS["x_age"] != "" ? intval($GLOBALS["x_age"]) : "NULL"; $fieldList["`age`"] = $theValue; // Field sex $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_sex"]) : $GLOBALS["x_sex"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`sex`"] = $theValue; // Field nationality $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_nationality"]) : $GLOBALS["x_nationality"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`nationality`"] = $theValue; // Field is_legal $theValue = $GLOBALS["x_is_legal"] != "" ? intval($GLOBALS["x_is_legal"]) : "NULL"; $fieldList["`is_legal`"] = $theValue; // Field years_of_residence $theValue = $GLOBALS["x_years_of_residence"] != "" ? intval($GLOBALS["x_years_of_residence"]) : "NULL"; $fieldList["`years_of_residence`"] = $theValue; // Field address_1 $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_address_1"]) : $GLOBALS["x_address_1"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`address_1`"] = $theValue; // Field address_2 $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_address_2"]) : $GLOBALS["x_address_2"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`address_2`"] = $theValue; // Field address_3 $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_address_3"]) : $GLOBALS["x_address_3"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`address_3`"] = $theValue; // Field postcode $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_postcode"]) : $GLOBALS["x_postcode"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`postcode`"] = $theValue; // Field email $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_email"]) : $GLOBALS["x_email"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`email`"] = $theValue; // Field mobile $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_mobile"]) : $GLOBALS["x_mobile"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`mobile`"] = $theValue; // Field tel $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_tel"]) : $GLOBALS["x_tel"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`tel`"] = $theValue; // Field employer $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_employer"]) : $GLOBALS["x_employer"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`employer`"] = $theValue; // Field uk_license $theValue = $GLOBALS["x_uk_license"] != "" ? intval($GLOBALS["x_uk_license"]) : "NULL"; $fieldList["`uk_license`"] = $theValue; // Field european_license $theValue = $GLOBALS["x_european_license"] != "" ? intval($GLOBALS["x_european_license"]) : "NULL"; $fieldList["`european_license`"] = $theValue; // Field license_points $theValue = $GLOBALS["x_license_points"] != "" ? intval($GLOBALS["x_license_points"]) : "NULL"; $fieldList["`license_points`"] = $theValue; // Field marital_status $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_marital_status"]) : $GLOBALS["x_marital_status"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`marital_status`"] = $theValue; // Field has_dependent $theValue = $GLOBALS["x_has_dependent"] != "" ? intval($GLOBALS["x_has_dependent"]) : "NULL"; $fieldList["`has_dependent`"] = $theValue; // Field can_relocate $theValue = $GLOBALS["x_can_relocate"] != "" ? intval($GLOBALS["x_can_relocate"]) : "NULL"; $fieldList["`can_relocate`"] = $theValue; // Field can_travel $theValue = $GLOBALS["x_can_travel"] != "" ? intval($GLOBALS["x_can_travel"]) : "NULL"; $fieldList["`can_travel`"] = $theValue; // Field employement_status $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_employement_status"]) : $GLOBALS["x_employement_status"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`employement_status`"] = $theValue; // Field work_location $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_work_location"]) : $GLOBALS["x_work_location"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`work_location`"] = $theValue; // Field position_held $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_position_held"]) : $GLOBALS["x_position_held"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`position_held`"] = $theValue; // Field salary $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_salary"]) : $GLOBALS["x_salary"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`salary`"] = $theValue; // Field bonus $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_bonus"]) : $GLOBALS["x_bonus"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`bonus`"] = $theValue; // Field ambitions $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_ambitions"]) : $GLOBALS["x_ambitions"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`ambitions`"] = $theValue; // Field salary_expectation_start $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; // Field salary_expectation_one $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; // Field salary_expectation_two $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; // Field achievement_sales $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_achievement_sales"]) : $GLOBALS["x_achievement_sales"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`achievement_sales`"] = $theValue; // Field achievement_food $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_achievement_food"]) : $GLOBALS["x_achievement_food"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`achievement_food`"] = $theValue; // Field achievement_labour $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_achievement_labour"]) : $GLOBALS["x_achievement_labour"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`achievement_labour`"] = $theValue; // Field interests $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_interests"]) : $GLOBALS["x_interests"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`interests`"] = $theValue; // Field qualifications $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_qualifications"]) : $GLOBALS["x_qualifications"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`qualifications`"] = $theValue; // Field tell_us $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_tell_us"]) : $GLOBALS["x_tell_us"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`tell_us`"] = $theValue; // Field notice $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_notice"]) : $GLOBALS["x_notice"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`notice`"] = $theValue; // Inserting event if (Recordset_Inserting($fieldList)) { // Insert $sSql = "INSERT INTO `cv` ("; $sSql .= implode(",", array_keys($fieldList)); $sSql .= ") VALUES ("; $sSql .= implode(",", array_values($fieldList)); $sSql .= ")"; phpmkr_query($sSql, $conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql); $fieldList["`cvid`"] = phpmkr_insert_id($conn); $result = phpmkr_affected_rows($conn) > 0; // Inserted event if ($result) { Recordset_Inserted($fieldList); } } else { $result = false; } return $result; }
function AddData($conn) { global $x_jobid, $user; $sFilter = ewSqlKeyWhere; // Check for duplicate key $bCheckKey = true; if (@$x_jobid == "" || is_null(@$x_jobid)) { $bCheckKey = false; } else { $sFilter = str_replace("@jobid", AdjustSql($x_jobid), $sFilter); // Replace key value } if ($bCheckKey) { $sSqlChk = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, $sFilter, ""); $rsChk = phpmkr_query($sSqlChk, $conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSqlChk); if (phpmkr_num_rows($rsChk) > 0) { $_SESSION[ewSessionMessage] = "Duplicate value for primary key"; phpmkr_free_result($rsChk); return false; } phpmkr_free_result($rsChk); } // Field onlineuser_onlineuserid $fieldList["`onlineuser_onlineuserid`"] = $user->onlineuserId; // Field job_status $fieldList["`job_status`"] = " 'active'"; // Field expiry $fieldList["`dt_expire`"] = "'" . expiryDate() . "'"; // Field position $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_position"]) : $GLOBALS["x_position"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`position`"] = $theValue; // Field overview $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_overview"]) : $GLOBALS["x_overview"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`overview`"] = $theValue; // Field salary $theValue = $GLOBALS["x_salary"] != "" ? intval($GLOBALS["x_salary"]) : "NULL"; $fieldList["`salary`"] = $theValue; // Field bonus $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_bonus"]) : $GLOBALS["x_bonus"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`bonus`"] = $theValue; // Field benifits $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_benifits"]) : $GLOBALS["x_benifits"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`benifits`"] = $theValue; // Field location $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_location"]) : $GLOBALS["x_location"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`location`"] = $theValue; // Field company $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_company"]) : $GLOBALS["x_company"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`company`"] = $theValue; // Field profile $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_profile"]) : $GLOBALS["x_profile"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`profile`"] = $theValue; // Field contact_email $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_contact_email"]) : $GLOBALS["x_contact_email"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`contact_email`"] = $theValue; // Field link $theValue = !get_magic_quotes_gpc() ? addslashes($GLOBALS["x_link"]) : $GLOBALS["x_link"]; $theValue = $theValue != "" ? " '" . $theValue . "'" : "NULL"; $fieldList["`link`"] = $theValue; // Inserting event if (Recordset_Inserting($fieldList)) { // Insert $sSql = "INSERT INTO `job` ("; $sSql .= implode(",", array_keys($fieldList)); $sSql .= ") VALUES ("; $sSql .= implode(",", array_values($fieldList)); $sSql .= ")"; 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; // Inserted event if ($result) { Recordset_Inserted($fieldList); } } else { $result = false; } return $result; }