Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
UConnJobSearch/postjob.php
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
255 lines (225 sloc)
9.53 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Authored by Iu-Wei Sze and Ashley Dumaine and Robert Paganetti--> | |
<?php | |
session_start(); | |
?> | |
<!DOCTYPE html> | |
<html> | |
<style> | |
form { width: 1200px; } | |
input { float: right; width: 250px; } | |
</style> | |
<head> | |
<!-- META --> | |
<title>Post Job</title> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> | |
<meta name="description" content="" /> | |
<!-- CSS --> | |
<link rel="stylesheet" type="text/css" href="css/kickstart.css" media="all" /> | |
<link rel="stylesheet" type="text/css" href="style.css" media="all" /> | |
<!-- Javascript --> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> | |
<script type="text/javascript" src="js/kickstart.js"></script> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> | |
<script> | |
$(document).ready(function () { | |
$('div.toshow').fadeIn(20); | |
//$('div.toshow').show(2000); | |
//$('div.toshow').slideDown("slow"); | |
}); | |
</script> | |
<link href="http://s3.amazonaws.com/codecademy-content/courses/ltp/css/shift.css" rel="stylesheet"> | |
<link rel="stylesheet" href="http://s3.amazonaws.com/codecademy-content/courses/ltp/css/bootstrap.css"> | |
<link rel="stylesheet" href="register_formatting.css"> | |
</head> | |
<body> | |
<div class="nav"> | |
<div class="container"> | |
<ul class="pull-left"> | |
<!-- <li><a href=<img><></li> --> | |
<li><a href="http://localhost/UConnJobSearch/index.php">UConnJobSearch</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/about.php">About</a></li> | |
</ul> | |
<ul class="pull-right"> | |
<?php if ($_SESSION): ?> | |
<?php if ($_SESSION['type'] == "Admin"): ?> | |
<li><a href="http://localhost/UConnJobSearch/admin_dashboard.php">Dashboard</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/admin.php">My Account</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/logout.php">Log Out</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/faq.php">Help</a></li> | |
<?php elseif ($_SESSION['type'] == "Poster"): ?> | |
<li><a href="http://localhost/UConnJobSearch/posterDashboard.php">Dashboard</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/poster.php">My Account</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/logout.php">Log Out</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/faq.php">Help</a></li> | |
<?php elseif ($_SESSION['type'] == "Seeker"): ?> | |
<li><a href="http://localhost/UConnJobSearch/dashboard.php">Dashboard</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/seeker.php">My Account</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/logout.php">Log Out</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/faq.php">Help</a></li> | |
<?php endif; ?> <!-- not logged in --> | |
<?php else: header("location:error.php"); ?> | |
<li><a href="http://localhost/UConnJobSearch/register.php">Register</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/login.php">Log In</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/faq.php">Help</a></li> | |
<?php endif; ?> | |
</ul> | |
</div> | |
</div> | |
<div class="toshow" style="display:none;"> | |
<div class="jumbotron"> | |
<div class="container"> | |
<form> | |
<div class="row"> | |
<div class="col-md-6"> | |
<h1>Post a New Job</h1> | |
<hr style="height: 1px; color: #008000; width: 100% " /> | |
<h4 style="color: #fff">Basic Info</h4><br> | |
<p style="color: #fff; font-size: 15px"> | |
Position Title: <input type="text" id="positionTitle" style="color:#000"></input><br><br> | |
Company Name: <input type="text" id="CName" style="color:#000"></input><br><br> | |
</p> | |
<hr style="height: 1px; color: #008000; width: 100% " /> | |
<h4 style="color: #fff">Requirements</h4><br> | |
<p style="color: #fff; font-size: 15px"> | |
Duties: <input type="text" id="Duties" style="color:#000"></input><br><br> | |
Minimum Years of Experience: <input type="text" id="JYRSExp" style="color:#000"></input><br><br> | |
</p> | |
</div> | |
<div class="col-md-6"> | |
<br><br> | |
<hr style="height: 1px; color: #008000; width: 100% " /> | |
<h4 style="color: #fff">Location</h4><br> | |
<p style="color: #fff; font-size: 15px"> | |
City: <input type="text" id="City" style="color:#000"></input><br><br> | |
State: <input type="text" id="State" style="color:#000"></input><br><br> | |
Zipcode: <input type="text" id="Zipcode" style="color:#000"></input><br><br> | |
</p> | |
<hr style="height: 1px; color: #008000; width: 100% " /> | |
<h4 style="color: #fff">Pay</h4><br> | |
<p style="color: #fff; font-size: 15px"> | |
Low Range: <input type="text" id="JLowRange" style="color:#000"></input><br><br> | |
High Range: <input type="text" id="JHighRange" style="color:#000"></input><br><br> | |
</p> | |
<hr style="height: 1px; color: #008000; width: 100% " /> | |
<h4 style="color: #fff">Other</h4><br> | |
<p style="color: #fff; font-size: 15px"> | |
Fill Status: <input type="checkbox" id="JFillStatus" style="color:#000"></input><br><br> | |
</p> | |
</div> | |
</div> | |
<br><br> | |
</form> | |
<button class="medium blue" onclick="register()"><i class="fa fa-star"></i> Post Job</button> | |
<div id='returnHTML'></div> | |
</div> | |
</div> | |
<div class="learn-more"> | |
<div class="container"> | |
<div class="row"> | |
</div> | |
</div> | |
</div> | |
</div> | |
<div class="credits"> | |
<footer> <!-- site wide footer --> | |
<nav> | |
<p><a href="http://localhost/UConnJobSearch/credits.php">Credits</a> | |
<a>|</a> | |
<a href="">Terms of Service</a> | |
<a>|</a> | |
<a herf="">Blog Index</a> | |
</p> | |
</nav> | |
<p>Copyright © 2015 UConn</p> | |
</footer> | |
</div> | |
</body> | |
<head> | |
<!-- JQuery Reference --> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> | |
<script> <!-- Javascript functions here --> | |
var q = r = s = t = stateID = ""; | |
var INSERT = 0; | |
var SELECTSTATE = 1; | |
var SELECTUNAME = 2; | |
function query(queryString, whichQ){ | |
$.ajax({ | |
url: "query.php", | |
data: { | |
query: queryString | |
}, | |
type: "POST", | |
dataType: "html", | |
success: function (data) { | |
document.getElementById("returnHTML").innerHTML = data; | |
if(whichQ == 1){ //-- not a select statement | |
if(document.getElementById("stateTable")){ | |
stateID = getValueFromQueryTable(data); | |
runInsert(); | |
} | |
} | |
if(whichQ == 2){ //checking if uname already exists | |
if(document.getElementById("stateTable")){ | |
alert("Username already exists! please pick a new one."); | |
} | |
} | |
}, | |
error: function (xhr, status) { | |
alert("There was a problem with the request!"); | |
} | |
}); | |
} | |
function getValueFromQueryTable(data){ | |
return ((data.split("<td>")[1]).split("</td>")[0]); | |
} | |
function register(){ | |
var state = document.getElementById("State").value; | |
if((state.length < 3) && (state.length > 0)) | |
alert("please type in the full name of the state!"); | |
else | |
query("SELECT StateID FROM state WHERE state.StateName = '" + state + "';", SELECTSTATE); | |
} | |
function runInsert(){ | |
var date = new Date(); | |
var dd = date.getDate(); | |
var mm = date.getMonth()+1; | |
var yyyy = date.getFullYear(); | |
date = mm+'/'+dd+'/'+yyyy; | |
if(date.length > 8) | |
{ | |
date = date.substring(0, 8); | |
} | |
var positionTitle = document.getElementById("positionTitle").value; | |
var CName = document.getElementById("CName").value; | |
var duties = document.getElementById("Duties").value; | |
var JYRSExp = document.getElementById("JYRSExp").value; | |
var city = document.getElementById("City").value; | |
var zipCode = document.getElementById("Zipcode").value; | |
var JLowRange = document.getElementById("JLowRange").value; | |
var JHighRange = document.getElementById("JHighRange").value; | |
var isFillStatus = document.getElementById("JFillStatus").checked; | |
var fillStatus = "No"; | |
if(isFillStatus) | |
fillStatus = "Yes"; | |
q = "INSERT INTO job (JListDate, JobTitle, JCity, StateID, Zipcode, JDuties, JYRSExperience, JLowRange, JHighRange, JFillStatus, CName) VALUES " | |
+ "('" + date + "', '" + positionTitle + "', '" + city + "', " + stateID + ", '" + zipCode + "', '" + duties + "', " | |
+ JYRSExp + ", " + JLowRange + ", " + JHighRange + ", '" + fillStatus + "', '" + CName + "');"; | |
console.log(q); | |
query(q, INSERT); | |
} | |
</script> | |
</head> | |
</html> |