Example #1
0
require_once "lib/lib.php";
require_once "lib/users.class.php";
require_once "lib/jobs.class.php";
$pageTitle = "Post a Job";
include "lib/head.inc";
require_once "templates/intern_profile.php";
$conn = new PDO(DB_DSN, DB_USER, DB_PASS);
if (!isset($_COOKIE['logged'])) {
    $_SESSION['message'] = "Sorry, but you have to be logged in.";
    header("location: login.php");
    exit;
}
$email = $_COOKIE['logged'];
$pswrd = $_COOKIE['_intseid'];
$ID = User::getCurrentUser($_COOKIE['logged']);
$info = User::about($email, $pswrd);
if ($info['utype'] == "intern") {
    echo "Unforunately, You cannot post a job. You may consider inviting specific users to your project";
    exit;
}
if (isset($_POST['post'])) {
    $job = new job();
    $job->storeFormValues($_POST);
    $job->posted_by = $ID['UserID'];
    //verify url
    if ($_POST['app_method'] == "link") {
        if ($_POST['url'] != "" && filter_var($_POST['url'], FILTER_VALIDATE_URL) == false) {
            echo "Invalid URL provided";
        }
    }
    $returnedID = $job->create();