コード例 #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;
}
コード例 #2
0
    if ($sDbWhere != "") {
        $sDbWhere .= " AND ";
    }
    $sDbWhere .= "(" . $sSrchWhere . ")";
}
//defaul search conditions
if ($sDbWhere != "") {
    $sDbWhere .= " AND ";
}
$sDbWhere .= "(job_status='active')";
$sDbWhere .= " AND ";
$toDay = date("Y-m-d");
$sDbWhere .= "(dt_expire>'{$toDay}')";
// Set up sorting order
$sOrderBy = "`dt_created` DESC";
$sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, $sDbWhere, $sOrderBy);
//echo $sSql . "<br>"; // Uncomment to show SQL for debugging
include "top.php";
?>
<script type="text/javascript" src="scripts/ewp.js"></script>
<script type="text/javascript">
<!--
EW_dateSep = "/"; // set date separator
//-->
</script>
<script type="text/javascript">
<!--
function EW_checkMyForm2(EW_this) {
	for (var i=0;i<EW_this.elements.length;i++) {
		var elem = EW_this.elements[i];
		if (elem.name.substring(0,2) == "s_" || elem.name.substring(0,3) == "sv_")
コード例 #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;
}
コード例 #4
0
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;
}
コード例 #5
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;
}
コード例 #6
0
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;
}
コード例 #7
0
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);
コード例 #8
0
ファイル: cvedit.php プロジェクト: BackupTheBerlios/scrapbook
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;
}