///////////////////////////// ############################# # phProfession # # The Resume Posting Script # # Source by Mykel Nahorniak # ############################# ///////////////////////////// /* You are free to edit this source as much as you want and claim it as your own. Just remember the original source is posted on SourceForge.net, so if any of your cool friends find out it isn't yours, you'd better have a big bat ready :) */ ######################### # Including CONFIG file # ######################### include("./config.php"); ### If $Admin is yes, execute authentication ### if ($cmd == "Admin"){ include ("./auth.php"); } ### If no $cmd, just list jobs ### if ((!isset($cmd)) || ($cmd == "")){ $cmd = "List"; } ?>
$image="$cmd.jpg"; ?>
|
##################### # Listing open jobs # ##################### if ($cmd =="List"){ ### Get List of Open Jobs ### $query = "SELECT DISTINCT id, department from department, listing WHERE department.id = listing.fk_department"; $result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error()); ### Check each department ### while(list($id, $department) = mysql_fetch_row($result)) { ### Printing department ### echo "Department: $department"; ### Look for jobs in each department and print as list ### $query2 = "SELECT jcode, designation from listing WHERE listing.fk_department = '$id'"; $result2 = mysql_db_query($database, $query2, $connection) or die ("Error in query: $query2. " . mysql_error()); echo "
"; } } ####################### # Echoing job details # ####################### if($cmd == "Details"){ if (!$jcode || $jcode == "") { header("Location:?cmd=Error"); exit; } ### Get job details ### $query = "SELECT listing.designation, listing.jcode, department.department, location.location, salary.salary, listing.responsibilities, listing.qualifications, listing.cname, listing.cmail, listing.posted from department, listing, location, salary WHERE department.id = listing.fk_department AND location.id = listing.fk_location AND salary.id = listing.fk_salary AND listing.jcode = '$jcode'"; $result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error()); ### Checking for errors ### if (mysql_num_rows($result) <= 0) { header("Location:?cmd=Error"); exit; } else { ### Obtain data from query ### list($designation, $jcode, $department, $location, $salary, $description, $qualification, $cname, $cmail, $posted) = mysql_fetch_row($result); echo " Designation: $designation
Department: $department
Location: $location
Salary: $salary
Responsibilities: $description
Qualifications: $qualification
Contact: $cname
Job code: $jcode
Posted on: "; echo fixDate($posted); echo "
Apply online for this job, or return to job listings"; } } ###################### # Applying for a job # ###################### if($cmd == "Apply"){ if (!$jcode || $jcode == ""){ header("Location:?cmd=Error"); exit; } ### Get job details ### $query = "SELECT designation, jcode, department from listing, department WHERE jcode = '$jcode' AND department.id = listing.fk_department"; $result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error()); ### Checking for errors ### if (mysql_num_rows($result) <= 0){ header("Location:?cmd=Error"); exit; } else { ### Obtain data from query ### list($designation, $jcode, $department) = mysql_fetch_row($result); ### Clean up ### mysql_free_result($result); ?> Please fill up this form to apply for the post of echo "$designation, $department ($jcode)"; ?>
| Department: $department | |||
| $dsg ($jcode) | edit | delete | |
Add a new listing or search the database"; } #################### # Adding a listing # #################### if($cmd == "Add"){ ### If form has not been submitted ### if (!$submit) { ?>
Add another entry, or return to job listings"; } else { listErrors(); } } } ##################### # Editing a listing # ##################### if($cmd == "Edit"){ ### Checking for errors ### if (!$jcode || $jcode == ""){ header("Location:?cmd=Error"); exit; } ### Form not yet submitted ### if (!$submit){ ### Get job details ### $query = "SELECT designation, jcode, fk_department, fk_location, fk_salary, responsibilities, qualifications, cname, cmail from listing WHERE jcode = '$jcode'"; $result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error()); ### Checking for errors ### if (mysql_num_rows($result) <= 0){ header("Location:?cmd=Error"); exit; } else { ### Obtain data from query ### list($designation, $jcode, $department, $location, $salary, $description, $qualification, $cname, $cmail, $posted) = mysql_fetch_row($result); ### Clean up ### mysql_free_result($result); ### Display form with values pre-filled ### ?>
Edit another entry, or return to job listings"; } else{ listErrors(); } } } ###################### # Deleting a listing # ###################### if($cmd == "Delete"){ if (!$jcode || $jcode == ""){ header("Location:?cmd=Error"); exit; } ### Delete record ### $query = "DELETE FROM listing WHERE jcode = '$jcode'"; $result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error()); mysql_close($connection); ### Redirect ### echo "Entry successfully deleted.
Go back to Admin, or return to job listings"; } ########################### # Searching for a listing # ########################### if($cmd == "Search"){ if(!$submit) { ?>
} else { ### Form submitted, search entries ### ### Check for missing parameters ### if (!$jcode || $jcode == ""){ header("Location:?cmd=Error"); exit; } ### Set up basic query and joins ### $query = "SELECT DISTINCT r_user.rid, r_user.lname, r_user.fname, r_user.email from r_user, r_skill, r_education WHERE r_user.jcode = '$jcode'"; ### If skills criteria selected ### if(!empty($skills) && !empty($exp_modifier) && !empty($years)){ ### Modify query further ### $query .= " AND r_user.rid = r_skill.rid AND ("; ### Turn keywords into tokens ### $keywords = split(" ", $skills); ### Iterate through list ### for ($x=0; $x
Date of birth: echo fixDate($dob); ?>
Address:
echo "$addr1
";
if($addr2){
echo "$addr2
";
}
echo "$city $zip
$state, $country"; ?>
Phone: echo $phone; ?>
Email address: echo $email; ?>
Web site: if($url){ echo "$url"; } else { echo "None"; } ?>
### Get education history ###
$query = "SELECT institute,
degree,
subject,
year
from r_education,
degree,
subject
WHERE r_education.fk_degree = degree.id
AND r_education.fk_subject = subject.id
AND rid = '$rid'
ORDER BY year";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
if(mysql_num_rows($result) > 0){
echo "
";
while (list($institute, $degree, $subject, $year ) = mysql_fetch_row($result)){
echo "Institute: $institute
";
echo "Degree: $degree ($subject, $year)
";
}
}
?>
### Get employment history ###
$query = "SELECT employer,
industry,
start_year,
end_year,
responsibilities
from r_employment,
industry
WHERE r_employment.fk_industry = industry.id
AND rid = '$rid'
ORDER BY end_year";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
if(mysql_num_rows($result) > 0){
echo "
";
while (list($employer, $industry, $start_year, $end_year, $responsibilities) = mysql_fetch_row($result)){
echo "Employer: $employer ($start_year-$end_year)
";
echo "Industry: $industry
";
echo "Responsibilities:
$responsibilities
";
}
}
?>
### Get skills ###
$query = "SELECT skill, experience from r_skill WHERE rid = '$rid' ORDER BY experience";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
if(mysql_num_rows($result) > 0){
echo "
";
while (list($skill, $experience) = mysql_fetch_row($result)){
echo "$skill
";
echo "$experience years experience
";
}
}
?>
### Get references ###
$query = "SELECT name, phone, email from r_reference WHERE rid = '$rid'";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error());
if(mysql_num_rows($result) > 0){
echo "
";
while (list($name, $phone, $ref_email) = mysql_fetch_row($result)){
echo "Name: $name
";
echo "Phone: $phone
";
if ($ref_email) {
echo "Email address: $ref_email
"; } else { echo "
";
}
}
}
?>
Willing to relocate:
if($relo == 1) {
echo "Yes";
} else {
echo "No";
}
?>
Resume posted on echo fixDate($posted); ?>
Go back to applicant list, or search again } } ////////////// ############## # Error Code # ############## ////////////// /* The following code is used for diagnosing errors for users who post information incorrectly in the script. Although not recommended, feel free to edit the code */ ################# # Generic Error # ################# if($cmd == "Error"){ echo "There was an error accessing the page you requested. Please return to the main page and try again."; } ?>