Esempio n. 1
0
function DeleteData($sqlKey, $conn)
{
    global $x_jobid;
    $sFilter = $sqlKey;
    // Backup the record before delete
    $sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, $sFilter, "");
    $query = phpmkr_query($sSql, $conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql);
    while ($temp = phpmkr_fetch_array($query)) {
        $oldrs[] = $temp;
    }
    // Delete
    $sSql = "DELETE FROM `job`";
    $sWhere = "";
    if ($sFilter != "") {
        if ($sWhere != "") {
            $sWhere .= " AND ";
        }
        $sWhere .= $sFilter;
    }
    if ($sWhere != "") {
        $sSql .= " WHERE " . $sWhere;
    }
    // Deleting event
    if (Recordset_Deleting($oldrs)) {
        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;
        // Deleted event
        if ($result) {
            Recordset_Deleted($oldrs);
        }
    } else {
        $result = false;
    }
    return $result;
}
Esempio n. 2
0
<?php 
if ($nTotalRecs > 0) {
    ?>
<br />
<form method="post">
<table cellspacing="0" cellpadding="0" c>
    <?php 
    // Set the last record to display
    $nStopRec = $nStartRec + $nDisplayRecs - 1;
    // Move to the first record
    $nRecCount = $nStartRec - 1;
    if (phpmkr_num_rows($rs) > 0) {
        phpmkr_data_seek($rs, $nStartRec - 1);
    }
    $nRecActual = 0;
    while (($row = @phpmkr_fetch_array($rs)) && $nRecCount < $nStopRec) {
        $nRecCount = $nRecCount + 1;
        if ($nRecCount >= $nStartRec) {
            $nRecActual++;
            // Set row color
            $sItemRowClass = " class=\"row_odd\"";
            $sListTrJs = " onmouseover='ew_mouseover(this);' onmouseout='ew_mouseout(this);' onclick='ew_click(this);'";
            // Display alternate color for rows
            if ($nRecCount % 2 != 1) {
                $sItemRowClass = " class=\"row_even\"";
            }
            $x_jobid = $row["jobid"];
            $x_onlineuser_onlineuserid = $row["onlineuser_onlineuserid"];
            $x_position = $row["position"];
            $x_overview = $row["overview"];
            $x_salary = $row["salary"];
Esempio n. 3
0
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;
}
Esempio n. 4
0
function LoadData($conn)
{
    global $x_jobid;
    $sFilter = ewSqlKeyWhere;
    if (!is_numeric($x_jobid)) {
        return false;
    }
    $x_jobid = get_magic_quotes_gpc() ? stripslashes($x_jobid) : $x_jobid;
    $sFilter = str_replace("@jobid", AdjustSql($x_jobid), $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);
    if (phpmkr_num_rows($rs) == 0) {
        $bLoadData = false;
    } else {
        $bLoadData = true;
        $row = phpmkr_fetch_array($rs);
        // Get the field contents
        $GLOBALS["x_jobid"] = $row["jobid"];
        $GLOBALS["x_onlineuser_onlineuserid"] = $row["onlineuser_onlineuserid"];
        $GLOBALS["x_position"] = $row["position"];
        $GLOBALS["x_overview"] = $row["overview"];
        $GLOBALS["x_salary"] = $row["salary"];
        $GLOBALS["x_bonus"] = $row["bonus"];
        $GLOBALS["x_benifits"] = $row["benifits"];
        $GLOBALS["x_location"] = $row["location"];
        $GLOBALS["x_company"] = $row["company"];
        $GLOBALS["x_profile"] = $row["profile"];
        $GLOBALS["x_contact_email"] = $row["contact_email"];
        $GLOBALS["x_dt_created"] = $row["dt_created"];
        $GLOBALS["x_dt_expire"] = $row["dt_expire"];
        $GLOBALS["x_job_status"] = $row["job_status"];
    }
    phpmkr_free_result($rs);
    return $bLoadData;
}
Esempio n. 5
0
/**
 * 
 * @todo Funcion que busca el mantenimiento para convertirlo en un json
 * @author Jean Carlos Nuñez
 * @param  int $var_cod_salida
 * @param  int $var_tipo
 * @param  string $var_num_und
 * @param  int $var_odt
 * @return json
 *  
 */
function mantenimiento_json($var_cod_salida, $var_tipo, $var_num_und, $var_odt)
{
    global $conn;
    $sSql = "select s.codigo, s.fecha, s.hora, s.cod_pro, s.cantidad, s.monto, s.monto_total, s.total_general, s.cod_usu, s.empresa, s.num_und, \n\ts.cedula_responsable, s.cod_dep, s.nombre_responsable, s.cod_provee, s.kilometraje, s.factura, s.cobrar, s.general, s.detalle,\n\tp.descripcion,p.codigo_secundario from salidas_temp s,productos p where s.codigo = {$var_cod_salida} and s.cod_pro = p.codigo";
    $rs = phpmkr_query($sSql, $conn) or die("Fallo al ejecutar la consulta en la linea" . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql);
    $rs2 = phpmkr_query($sSql, $conn) or die("Fallo al ejecutar la consulta en la linea" . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql);
    $valores_1 = phpmkr_fetch_array($rs2);
    while ($row_rs = $rs->fetch_assoc()) {
        $var_fecha = fecha($row_rs['fecha']);
        $var_hora = $row_rs['hora'];
        $var_cantidad = $row_rs['cantidad'];
        $var_empresa = $row_rs['empresa'];
        $var_num_und = $row_rs['num_und'];
        $var_kilometraje = $row_rs['kilometraje'];
        $var_monto = number_format($row_rs['monto'], 2);
        $var_descripcion_pro = $row_rs['descripcion'];
        $var_codigo_secundario = $row_rs['codigo_secundario'];
    }
    $sSql = "select descripcion from empresas where codigo =" . $var_empresa;
    $rs2 = phpmkr_query($sSql, $conn) or die("Fallo al ejecutar la consulta en la linea" . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql);
    $valores_2 = phpmkr_fetch_array($rs2);
    while ($row_rs2 = $rs2->fetch_assoc()) {
        $var_descripcion = $row_rs2['descripcion'];
    }
    if ($var_descripcion == "") {
        $var_descripcion = "-";
    }
    $var_nombre = "";
    $var_num_ope_temp = "";
    $sSql = "select * from operadores_odm where odm = {$var_odt}";
    $rs2 = phpmkr_query($sSql, $conn) or die("Fallo al ejecutar la consulta en la linea" . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql);
    $con = phpmkr_num_rows($rs2);
    $valores_3 = phpmkr_fetch_array($rs2);
    if ($con > 0) {
        while ($row_rs2 = $rs2->fetch_assoc()) {
            $var_num_ope_temp = $row_rs2['num_ope'];
        }
    }
    if ($var_num_ope_temp == "" || $var_num_ope_temp == "0") {
        $sSql = "select concat(num_oper,'-',nombre,' ',apellido) as nombre,financiado from autos a,operadores o \n\t\twhere a.num_und = '{$var_num_und}' and a.num_und = o.num_und_asig";
        $rs2 = phpmkr_query($sSql, $conn) or die("Fallo al ejecutar la consulta en la linea" . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql);
        $valores_4 = phpmkr_fetch_array($rs2);
        while ($row_rs2 = $rs2->fetch_assoc()) {
            $var_nombre = $row_rs2['nombre'];
            $var_financiado = $row_rs2['financiado'];
        }
        if ($var_nombre == "") {
            $var_nombre = "Sin Operador";
        }
    }
    if ($var_num_ope_temp > 0) {
        $sSql = "select concat(o.num_oper,'-',o.nombre,' ',o.apellido) as nombre from operadores o where o.num_oper = {$var_num_ope_temp}";
        $rs2 = phpmkr_query($sSql, $conn) or die("Fallo al ejecutar la consulta en la linea" . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql);
        $valores_5 = phpmkr_fetch_array($rs2);
        while ($row_rs2 = $rs2->fetch_assoc()) {
            $var_nombre = $row_rs2['nombre'];
        }
        if ($var_nombre == "") {
            $var_nombre = "Sin Operador";
        }
    }
    $var_monto_total = 0;
    $sSql = "select s.codigo, s.fecha, s.hora, s.cod_pro, s.cantidad, s.monto, s.monto_total, s.total_general, s.cod_usu, s.empresa, s.num_und, \n\ts.cedula_responsable, s.cod_dep, s.nombre_responsable, s.cod_provee, s.kilometraje, s.factura, s.cobrar, s.general, s.detalle,\n\tp.descripcion,p.codigo_secundario from salidas_temp s,productos p where s.codigo = {$var_cod_salida} and s.cod_pro = p.codigo";
    $rs = phpmkr_query($sSql, $conn) or die("Fallo al ejecutar la consulta en la linea" . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql);
    $valores_6 = phpmkr_fetch_array($rs);
    while ($row_rs = $rs->fetch_assoc()) {
        $var_fecha = fecha($row_rs['fecha']);
        $var_hora = $row_rs['hora'];
        $var_cantidad = $row_rs['cantidad'];
        $var_empresa = $row_rs['empresa'];
        $var_num_und = $row_rs['num_und'];
        $var_kilometraje = $row_rs['kilometraje'];
        $var_monto = number_format($row_rs['monto'], 2);
        $var_monto_sumar = $row_rs['monto'];
        $var_descripcion_pro = $row_rs['descripcion'];
        $var_codigo_secundario = $row_rs['codigo_secundario'];
        $var_monto_total = $var_monto_sumar + $var_monto_total;
        $sSql = "select descripcion from empresas  where codigo = {$var_empresa}";
        $rs2 = phpmkr_query($sSql, $conn) or die("Fallo al ejecutar la consulta en la linea" . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql);
        $valores_7 = phpmkr_fetch_array($rs2);
        while ($row_rs2 = $rs2->fetch_assoc()) {
            $var_descripcion = $row_rs2['descripcion'];
        }
        if ($var_descripcion == "") {
            $var_descripcion = "-";
        }
    }
    $resultado = array_merge($valores_1, $valores_2, $valores_3, $valores_4, $valores_5, $valores_6);
    print json_encode($resultado);
}
Esempio n. 6
0
function isSubquerySupported()
{
    global $conn;
    $sSql = "SHOW VARIABLES LIKE 'version'";
    $rs = phpmkr_query($sSql, $conn) or die("Failed to execute query at line " . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql);
    if ($field = phpmkr_fetch_array($rs)) {
        $version = $field["Value"];
    }
    $match = explode('.', @$version);
    return (int) sprintf('%d%02d%02d', $match[0], @$match[1], intval(@$match[2])) >= 40100;
}
include "cvinfo.php";
include "advsecu.php";
include "phpmkrfn.php";
// Get key
$x_cvid = @$_GET["cvid"];
if (!is_numeric($x_cvid)) {
    ob_end_clean();
    header("Location: cvlist.php");
    exit;
}
if ($x_cvid == "" || is_null($x_cvid)) {
    ob_end_clean();
    header("Location: cvlist.php");
    exit;
}
$x_cvid = get_magic_quotes_gpc() ? stripslashes($x_cvid) : $x_cvid;
$conn = phpmkr_db_connect(HOST, USER, PASS, DB, PORT);
$sFilter = ewSqlKeyWhere;
$sFilter = str_replace("@cvid", AdjustSql($x_cvid), $sFilter);
$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);
if (phpmkr_num_rows($rs) > 0) {
    $row = phpmkr_fetch_array($rs);
    if ($row["picture"] != "") {
        header("Content-Disposition: attachment; filename=" . $row["picture"]);
    }
    ob_clean();
    echo $row["picture"];
}
phpmkr_free_result($rs);
phpmkr_db_close($conn);
Esempio n. 8
0
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;
}