コード例 #1
0
    $correct_result = true;
    /*---------------Country---------------*/
    if (isset($u_country) && $u_country !== "") {
        validate_country();
    }
    /*---------------City---------------*/
    if (isset($u_city) && $u_city !== "") {
        validate_city();
    }
    /*---------------Title---------------*/
    if (isset($u_jobtitle) && $u_jobtitle !== "") {
        validate_title();
    }
    /*---------------Category---------------*/
    if (isset($u_category) && $u_category !== "Industry" && $u_category !== "") {
        validate_category();
    }
    /*---------------Location---------------*/
    if (isset($u_location) && $u_location !== "Location" && $u_location !== "") {
        validate_location();
    }
    /*---------------keywords---------------*/
    if (isset($u_keywords) && $u_keywords !== "") {
        validate_keywords_and();
    }
    /*---------------Display Result---------------*/
    if ($correct_result == true) {
        add_result($input);
    }
}
//END FOR LOOP
コード例 #2
0
ファイル: create_category.php プロジェクト: shifter/ospap
# This script simply creates a category, if it doesn't already exist.
#
header('Pragma: no-cache');
require_once 'shared.php';
# Make a connection to the database
$db_read = get_db_read();
$db_write = get_db_write();
if (!$me) {
    redirect("index.php");
}
if (isset($_POST['category']) == false) {
    redirect("index.php");
}
$category = mysql_escape_string(htmlentities(trim($_POST['category'])));
$private = isset($_POST['private']) ? '1' : '0';
if (validate_category($category) == false) {
    show_error_redirect_back("Please enter a valid category name (between 3 and {$max_length_category} characters)");
}
$result = try_mysql_query("SELECT * FROM categories WHERE name = '{$category}' AND user_id = '" . $me['user_id'] . "'", $db_read);
if (mysql_num_rows($result) > 0) {
    show_error_redirect_back('Error: you already have a category with that name!');
}
try_mysql_query("INSERT INTO categories (user_id, name, private, date_created, last_updated, last_updated_public) VALUES (" . $me['user_id'] . ", '{$category}', '{$private}', NOW(), 0, 0)", $db_write);
$category_id = mysql_insert_id($db_write);
try_mysql_query("UPDATE users SET last_category='{$category_id}' WHERE user_id='" . $me['user_id'] . "'", $db_write);
show_message_redirect_back("Category successfully created!");
?>