<?php
#####################################
# phprofession June 2002 #
# by Aidan Peiser #
# Recruitment module for PN.714 #
# www.galore.co.za #
# .,.,.,, #
# C 'C' C #
# > * < #
#####################################
/*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, http://phprofession.sourceforge.net so if any of your cool friends find out it isn't yours, you'd better have a big bat ready :)*/
/* Do not alter the following code unless you are a proficient PHP coder. Altering the code incorrectly may result in corrupting the entire script.*/
//include("header.php");
#########################
# Including CONFIG file #
#########################
//must change this to link to your config.php file for this module
include("config.php");
include("functions.php");
include("fileupload-class.php");
echo"<html><title>Phprofession $Version</title><head><link rel=\"STYLESHEET\" type=\"text/css\" href=\"style.css\"></head><body>";
phprofession_language();
OpenTable();
echo "<br><center><font class=\"pn-Title\">"._JOBCVUPLOAD."</font></center>";
CloseTable();
OpenTable();
if ($submitted)
{
// Create a new instance of the class
$my_uploader = new uploader;
// OPTIONAL: set the max filesize of uploadable files in bytes 1000 = 1kb
$my_uploader->max_filesize(100000);
// OPTIONAL: if you're uploading images, you can set the max pixel dimensions
$my_uploader->max_image_size(800, 600); // max_image_size($width, $height)
// UPLOAD the file
if ($my_uploader->upload($upload_file_name, $acceptable_file_types, $default_extension)) {
$success = $my_uploader->save_file($path, $mode);
}
if ($success)
{
// Successful upload!
print($my_uploader->file['name'] . " was successfully uploaded Thank you!<br>");
// Print all the array details...
//print_r($my_uploader->file);
// ...or print the file
// Uncomment if you want to view the uploaded file after it was uploaded image or file...can be messy
/*
if(ereg("image", $my_uploader->file['type'])){
echo "<img src=\"" . $path . $my_uploader->file['name'] . "\" border=\"0\" alt=\"\">";
}else{
$fp = fopen($path . $my_uploader->file['name'], "r");
while(!feof($fp)){
$line = fgets($fp, 255);
echo $line;
}
if ($fp) { fclose($fp); }
}*/
//update DB info about uploaded file.
if (!(getenv("HTTP_X_FORWARDED_FOR")))
{
$ip_address= getenv(REMOTE_ADDR);
}
else
{
$proxy_address= getenv(REMOTE_ADDR);
$ip_address= getenv(HTTP_X_FORWARDED_FOR);
}
$host = gethostbyaddr (getenv("REMOTE_ADDR"));
$filename = $my_uploader->file[name];
mysql_select_db($database, $connection) or die('Database Not Found');
$query = "INSERT INTO {$prefix}_jobresume (cvname,
cvphone,
cvemail,
source_name,
jcode,
ip_address,
host)
VALUES ('$cvname',
'$cvphone',
'$cvemail',
'$filename',
'$jcode',
'$ip_address',
'$host')";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
mysql_close($connection);
# email USER about new user file upload.
/* recipients */
$recipient = "$cvemail";
/* subject */
$subject = "$cvname user registration with $websiteurl";
/* message */
$message .= "<p><a href=\"$websiteurl\"><img src=\"$logopath\" border=\"0\"></a><br><br><font color=\"#000080\">$source_name C.V. file has been uploaded along with your details\n</font></p>\n";
$message .= "<table width=\"300\" border=\"0\" cellspacing=\"1\" bgcolor=\"#000000\"><tr bgcolor=\"#ffffff\"><td>"._JOBNAME.": </td><td><font size=3 color=blue>$cvname</font></td></tr><tr bgcolor=\"#ffffff\"><td>"._JOBPHONE.": </td><td><font size=3 color=blue>$cvphone</font></td></tr><tr bgcolor=\"#ffffff\"><td>Email:</td><td><font size=3 color=blue>$cvemail</font></td></tr></table><br><br><font size=3 color=blue>Thank You For registering with <a href=\"$websiteurl\">$websiteurl</a>.<br>One of our consultants will get in touch with you shortly.</font>";
/* headers */
$headers .= "X-Mailer: PHP\r\n"; // mailer
$headers .= "X-Priority: 1\r\n"; // Urgent message!
$headers .= "Return-Path: <$Admin_Email>\r\n"; // Return path for errors
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\r\n"; // Mime type
$headers .= "From: $Admin_Email\r\n";
/* and now mail it */
mail($recipient, $subject, $message, $headers);
# email ADMIN about new user file upload.
/* to */
$to = "$Admin_Email";
if ($jcode != 'Apply')
{
mysql_select_db($database, $connection) or die('Database Not Found');
$query = "SELECT cmail FROM {$prefix}_joblisting WHERE {$prefix}_joblisting.jcode = '$jcode'";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
while(list($cmail) = mysql_fetch_row($result))
{
$to .= ",$cmail";
}
}
/* title */
$title = "$cvname "._JOBUPLOAD2." $websiteurl";
/* body */
$body .= "<p><a href=\"$websiteurl\"><img src=\"$logopath\" border=\"0\"></a><br><br><font color=\"#000080\">$source_name "._JOBUPLOAD3.",\n</font></p>\n";
$body .= "<table width=\"300\" border=\"0\" cellspacing=\"1\" bgcolor=\"#000000\"><tr bgcolor=\"#ffffff\"><td>"._JOBNAME.": </td><td><font size=3 color=blue>$cvname</font></td></tr><tr bgcolor=\"#ffffff\"><td>"._JOBPHONE.": </td><td><font size=3 color=blue>$cvphone</font></td></tr><tr bgcolor=\"#ffffff\"><td>Email:</td><td><font size=3 color=blue>$cvemail</font></td></tr><tr><td colspan=\"2\" bgcolor=\"ffffff\">"._JOBUPLOAD4."\n\n <a href=\"$websiteurl/$ModuleDirName/post.php?cmd=ResumeUploads\">$source_name</a></td></tr></table>";
/* from */
$from .= "X-Mailer: PHP\r\n"; // mailer
$from .= "X-Priority: 1\r\n"; // Urgent message!
$from .= "Return-Path: <$Admin_Email>\r\n"; // Return path for errors
$from .= "MIME-Version: 1.0\r\n";
$from .= "Content-Type: text/html; charset=iso-8859-1\r\n"; // Mime type
$from .= "From: $websiteurl\r\n";
/* and now mail it */
mail ($to, $title, $body, $from);
}
else
{
// ERROR uploading...
if($my_uploader->errors)
{
while(list($key, $var) = each($my_uploader->errors))
{
echo $var . "<br>";
}
}
}
}
if (!$submitted)
{
echo "<form enctype=\"multipart/form-data\" action=\"$PHP_SELF?jcode=$jcode\" method=\"POST\">
<input type=\"hidden\" name=\"submitted\" value=\"true\">
Browse for your file on your computer and when you have selected the file click upload <br>
<table>
<tr><td>"._JOBNAME."</td><td><input type=\"text\" name=\"cvname\" size=\"30\"><br></td></tr>
<tr><td>"._JOBPHONE."</td><td><input type=\"text\" name=\"cvphone\" size=\"30\"><br></td></tr>
<tr><td>"._JOBEMAIL."</td><td><input type=\"text\" name=\"cvemail\" size=\"30\"><br></td></tr>
<tr><td></td><td><input type=\"hidden\" name=\"submitted\" value=\"true\"></td></tr>
<tr><td>"._JOBUPLOAD8."</td><td><input type=\"file\" name=\"$upload_file_name\" size=\"30\"><br></td></tr></table>
<input type=\"hidden\" name=\"jcode\" size=\"30\" value=\"$jcode\"><br>
<input type=\"submit\" value=\""._JOBUPLOADSUB."\">
</form></font></p><br><br>
<b><a href=\"index.php?cmd=Apply&jcode=$jcode\">"._JOBUPLOADSUBMIT."</a></b>
<blockquote>If you do not have your cv in word format then fill out this form it will take you about 3 min to complete.</blockquote><br>";
}
if ($acceptable_file_types)
{
print("This form only accepts <b>" . str_replace("|", " or ", $acceptable_file_types) . "</b> files\n");
}
User_Menu($ModuleBaseUrl);
CloseTable();
//include("footer.php");
?>