| Current Path : /var/www/cesa.co.za/php/ |
| Current File : /var/www/cesa.co.za/php/ypfmentees.php |
<script src='https://www.google.com/recaptcha/api.js' async defer></script>
<?php
include($_SERVER['DOCUMENT_ROOT'] . "/php/inc_db.php");
?>
<h1>CESA YPF Mentee Database</h1>
<p>Navigating the complex waters of employment can be daunting and difficult, and in the ever changing, competitive Engineering industry, having a mentor may significantly help an individual to grow and develop as a professional.</p>
<p>Mentorship allows for important skills and knowledge to be transferred from a mentor to mentee, whilst developing a professional relationship that offers support and guidance to the mentee. In addition, mentorship provides experienced engineers the opportunity to give back to the industry and further develop their leadership and management skills, which is often realized to be equally beneficial.</p>
<p>In an attempt to assist the development of young professionals in our profession and industry, a formal mentorship programme is proposed.</p>
<?php
$bDisplayForm = true;
if (isset($_REQUEST["go"]) && ($_REQUEST["go"] == 1)) {
$err = array();
$filename = "";
if (!reCaptcha($_POST["g-recaptcha-response"])) {
$err[] = "You could not be verified as not being a robot, please tick the reCaptcha verification option at the bottom of the form.";
} else {
if (isset($_FILES["strresume"]["name"])) {
$strresume_name = $_FILES["strresume"]["name"];
$strresume_type = $_FILES["strresume"]["type"];
$strresume_size = $_FILES["strresume"]["size"];
$strresume_temp = $_FILES["strresume"]["tmp_name"];
$fp = fopen($strresume_temp, "rb");
$file = fread($fp, $strresume_size);
$filename = "cvfiles/" . date("YmdHi") . str_replace("'", "", $strresume_name);
touch($filename);
$fp2 = fopen($filename, "wb");
fwrite($fp2, $file);
fclose($fp);
fclose($fp2);
chmod($filename, 0x777);
}
}
if (empty($_REQUEST["firstname"])) {
$err[] = "Your name is required";
}
if (empty($_REQUEST["surname"])) {
$err[] = "Your name is required";
}
if (empty($_REQUEST["qualification"])) {
$err[] = "Your qualification is required";
}
if (empty($_REQUEST["province"])) {
$err[] = "Your province is required";
} else {
$sProvince = substr(strtolower(trim($_REQUEST["province"])), 0, 3);
if (!in_array($sProvince, array("eas", "fre", "gau", "kwa", "lim", "mpu", "wes", "nor"))) {
$err[] = "Please enter a valid South African province";
}
}
if (empty($_REQUEST["email"])) {
$err[] = "Your email address is required";
} else {
if (filter_input(INPUT_POST, "email", FILTER_VALIDATE_EMAIL) == false) {
$err[] = "Your email address is invalid";
}
}
if ($_REQUEST["ecsa"] == "Y") {
if (filter_input(INPUT_POST, "yearreg", FILTER_VALIDATE_INT, ["options" => ["min_range" => 1950, ["max_range"] => date("Y")]]) == false) {
$err[] = "Your year of ECSA registration is invalid. Please enter a valid numeric year.";
}
}
if (!empty($_REQUEST["institution"])) {
if (empty(filter_var($_POST["institution"], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH))) {
$err[] = "Please enter a valid academic institution";
}
}
if (!empty($_REQUEST["yearqual"])) {
if (filter_input(INPUT_POST, "yearqual", FILTER_VALIDATE_INT, ["options" => ["min_range" => 1950, ["max_range"] => date("Y")]]) == false) {
$err[] = "Your year of qualification is invalid. Please enter a valid numeric year.";
}
}
if (!isset($_REQUEST["mentorshiptype"]) || empty($_REQUEST["mentorshiptype"])) {
$err[] = "Please indicate the type of mentorship you are looking for";
}
if (!isset($_REQUEST["menteecategory"]) || empty($_REQUEST["menteecategory"])) {
$err[] = "Please indicate the category of mentee";
}
if (!empty($_REQUEST["fromdate"])) {
$arrDateParts = explode("-", $_REQUEST["fromdate"]);
if (count($arrDateParts) == 3) {
if (!checkdate($arrDateParts[1], $arrDateParts[2], $arrDateParts[0])) {
$err[] = "The date you are available from is invalid. Please use the YYYY-MM-DD format, for example " . date("Y-m-d");
} else {
if (strtotime($_REQUEST["fromdate"] . " 23:59:59") < time()) {
$err[] = "The date you are available from cannot be in the past.";
}
}
} else {
$err[] = "The date you are available from is invalid. Please use the YYYY-MM-DD format, for example " . date("Y-m-d");
}
}
if (!isset($_REQUEST["unemployed"]) || empty($_REQUEST["unemployed"])) {
$err[] = "Please indicate whether you are unemployed or not";
}
if (!isset($_REQUEST["declarecorrect"]) || empty($_REQUEST["declarecorrect"])) {
$err[] = "Please confirm that the information is correct by ticking the box next to the declaration";
}
if (count($err) == 0) {
$sql = "SELECT * FROM YPFMentees WHERE firstname='" . addslashes($_REQUEST["firstname"]) . "' AND surname='" . addslashes($_REQUEST["surname"]) . "' AND email='" . addslashes($_REQUEST["email"]) . "'";
$rec = mysqli_query($conni, $sql);
if (mysqli_num_rows($rec) > 0) {
$err[] = "An entry with the supplied name and email address already exists in our database.";
}
}
if (count($err) == 0) {
$sql = "insert into YPFMentees (title, firstname, surname, cvfile,
qualification, institution, yearqual, province, location, menteecategory, ecsa, yearreg, profreg,
profile, telnum, email, fromdate, mentorshiptype, qualiflevel, specialisation, unemployed, declarecorrect, approved)
values ('" . addslashes($_REQUEST["title"]) . "', '" . addslashes($_REQUEST["firstname"]) . "', '" . addslashes($_REQUEST["surname"]) . "', '" . $filename . "',
'" . addslashes($_REQUEST["qualification"]) . "', '" . addslashes(filter_var($_POST["institution"], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH)) . "',
" . intval($_REQUEST["yearqual"]) . ",
'" . addslashes($_REQUEST["province"]) . "',
'" . addslashes($_REQUEST["location"]) . "', '" . addslashes($_REQUEST["menteecategory"]) . "', '" . addslashes($_REQUEST["ecsa"]) . "',
'" . addslashes($_REQUEST["yearreg"]) . "', '" . addslashes(implode(",", $_REQUEST["profreg"])) . "', '" . addslashes($_REQUEST["profile"]) . "',
'" . addslashes($_REQUEST["telnum"]) . "', '" . addslashes($_REQUEST["email"]) . "',
'" . date("Y-m-d", strtotime($_REQUEST["fromdate"])) . "', '" . addslashes($_REQUEST["mentorshiptype"]) . "', '" . addslashes($_REQUEST["qualiflevel"]) . "',
'" . addslashes($_REQUEST["specialisation"]) . "', '" . $_REQUEST["unemployed"] . "', '" . $_REQUEST["declarecorrect"] . "', 1)";
if (mysqli_query($conni, $sql)) {
echo "<p><b style='color:red'>Thank you, your information has been added to our database.</b></p>";
$bDisplayForm = false;
$sendto = "godfreyr@cesa.co.za";
// $sendto="julia@xe.co.za";
mail($sendto, "YPF Mentee added to database", "The following person has submitted their information to the YPF Mentees database:
" . $_REQUEST["firstname"] . " " . $_REQUEST["surname"] . "", "From: webmaster@cesa.co.za");
}
} else {
echo "<p><b style='color:red'>Your information has NOT been saved, please correct the errors below:</b></p><ul><li>" . implode("</li><li>", $err) . "</li></ul>";;
}
}
if ($bDisplayForm) {
?>
<form action="/ypf-mentees" method="post" enctype="multipart/form-data" name="form1" id="form1">
<input type="hidden" name="go" value="1" />
<p><b>Kindly add your Details to apply for this mentoring initiative:</b> (fields marked with a <strong>*</strong> are required)</p>
<table width="530" border="1" cellspacing="0" cellpadding="5">
<tr>
<td width="174">Title:</td>
<td width="330">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td nowrap>Prof.<input type="radio" name="title" value="Prof" <?php if ($_POST["title"] == "Prof") echo " checked"; ?>></td>
<td nowrap style="padding:0px 10px 0px 5px">Dr.<input type="radio" name="title" value="Dr" <?php if ($_POST["title"] == "Dr") echo " checked"; ?>></td>
<td nowrap style="padding:0px 10px 0px 5px">Mr.<input name="title" type="radio" value="Mr" <?php if (!isset($_POST["title"]) || ($_POST["title"] == "Mr")) echo " checked"; ?>></td>
</tr>
<tr>
<td nowrap style="padding:0px 10px 0px 5px">Mrs.
<input type="radio" name="title" value="Mrs" <?php if ($_POST["title"] == "Mrs") echo " checked"; ?>>
</td>
<td nowrap style="padding:0px 0px 0px 5px">Ms.
<input type="radio" name="title" value="Ms" <?php if ($_POST["title"] == "Ms") echo " checked"; ?>>
</td>
<td nowrap style="padding:0px 10px 0px 5px"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td>First Name:</td>
<td><input type="text" name="firstname" id="firstname" size="50" value="<?php echo $_REQUEST["firstname"]; ?>" required /> <strong>*</strong></td>
</tr>
<tr>
<td>Surname:</td>
<td><input name="surname" type="text" id="surname" value="<?php echo $_REQUEST["surname"]; ?>" size="50" required />
<strong>*</strong>
</td>
</tr>
<tr>
<td>Qualification Level:</td>
<td><select name="qualiflevel" id="qualiflevel">
<option<?php if ($_REQUEST["qualiflevel"] == "Diploma / Certificate") echo " selected"; ?>>Diploma / Certificate</option>
<option<?php if ($_REQUEST["qualiflevel"] == "National Diploma") echo " selected"; ?>>National Diploma</option>
<option<?php if ($_REQUEST["qualiflevel"] == "Degree") echo " selected"; ?>>Degree</option>
</select></td>
</tr>
<tr>
<td>Your Qualification:</td>
<td><input name="qualification" type="text" id="qualification" size="50" value="<?php echo $_REQUEST["qualification"]; ?>" required /> <strong>*</strong></td>
</tr>
<tr>
<td>Institution Where You Obtained Your Qualification:</td>
<td><input name="institution" type="text" id="institution" size="50" value="<?php echo $_REQUEST["institution"]; ?>" /></td>
</tr>
<tr>
<td>Year of Qualification:</td>
<td><input name="yearqual" type="text" id="yearqual" size="50" value="<?php echo $_REQUEST["yearqual"]; ?>" /></td>
</tr>
<tr>
<td>Professional registration (ECSA)?</td>
<td>
<input name="ecsa" type="radio" value="Y" <?php if ($_REQUEST["ecsa"] == "Y") echo " checked"; ?> required>Yes,
I am registered with ECSA<br>
Year of registration:
<input name="yearreg" type="text" id="yearreg" size="15" value="<?php echo $_REQUEST["yearreg"]; ?>" /><br>
<input name="ecsa" type="radio" value="N" <?php if ($_REQUEST["ecsa"] == "N") echo " checked"; ?>>No
</td>
</tr>
<tr>
<td>Professional registration (Other)?</td>
<td>
<input name="profreg[]" type="checkbox" value="SACQSP" <?php if (in_array("SACQSP", $_REQUEST["profreg"])) echo " checked"; ?>>SACQSP<br>
<input name="profreg[]" type="checkbox" value="SACAP" <?php if (in_array("SACAP", $_REQUEST["profreg"])) echo " checked"; ?>>SACAP<br>
<input name="profreg[]" type="checkbox" value="SACLAP" <?php if (in_array("SACLAP", $_REQUEST["profreg"])) echo " checked"; ?>>SACLAP<br>
<input name="profreg[]" type="checkbox" value="SACPCMP" <?php if (in_array("SACPCMP", $_REQUEST["profreg"])) echo " checked"; ?>>SACPCMP<br>
<input name="profreg[]" type="checkbox" value="SACPVP" <?php if (in_array("SACPVP", $_REQUEST["profreg"])) echo " checked"; ?>>SACPVP
</td>
</tr>
<tr>
<td>Specialisation Field:</td>
<td>
<select name="specialisation" id="specialisation">
<option<?php if ($_REQUEST["specialisation"] == "Acoustics") echo " selected"; ?>>Acoustics</option>
<option<?php if ($_REQUEST["specialisation"] == "Agricultural") echo " selected"; ?>>Agricultural</option>
<option<?php if ($_REQUEST["specialisation"] == "Building Services") echo " selected"; ?>>Building Services</option>
<option<?php if ($_REQUEST["specialisation"] == "Chemical") echo " selected"; ?>>Chemical</option>
<option<?php if ($_REQUEST["specialisation"] == "Civil") echo " selected"; ?>>Civil</option>
<option<?php if ($_REQUEST["specialisation"] == "Development") echo " selected"; ?>>Development</option>
<option<?php if ($_REQUEST["specialisation"] == "Electrical") echo " selected"; ?>>Electrical</option>
<option<?php if ($_REQUEST["specialisation"] == "Electronic") echo " selected"; ?>>Electronic</option>
<option<?php if ($_REQUEST["specialisation"] == "Environmental") echo " selected"; ?>>Environmental</option>
<option<?php if ($_REQUEST["specialisation"] == "Geotechnical") echo " selected"; ?>>Geotechnical</option>
<option<?php if ($_REQUEST["specialisation"] == "Industrial") echo " selected"; ?>>Industrial</option>
<option<?php if ($_REQUEST["specialisation"] == "Mechanical") echo " selected"; ?>>Mechanical</option>
<option<?php if ($_REQUEST["specialisation"] == "Marine") echo " selected"; ?>>Marine</option>
<option<?php if ($_REQUEST["specialisation"] == "Mining") echo " selected"; ?>>Mining</option>
<option<?php if ($_REQUEST["specialisation"] == "Process") echo " selected"; ?>>Process</option>
<option<?php if ($_REQUEST["specialisation"] == "Structural") echo " selected"; ?>>Structural</option>
<option<?php if ($_REQUEST["specialisation"] == "Transportation") echo " selected"; ?>>Transportation</option>
<option<?php if ($_REQUEST["specialisation"] == "Architecture") echo " selected"; ?>>Architecture</option>
<option<?php if ($_REQUEST["specialisation"] == "Rural Development") echo " selected"; ?>>Rural Development</option>
<option<?php if ($_REQUEST["specialisation"] == "Project Management") echo " selected"; ?>>Project Management</option>
<option<?php if ($_REQUEST["specialisation"] == "Quantity Surveying") echo " selected"; ?>>Quantity Surveying</option>
<option<?php if ($_REQUEST["specialisation"] == "Town Planning") echo " selected"; ?>>Town Planning</option>
<option<?php if ($_REQUEST["specialisation"] == "Multidisciplinary") echo " selected"; ?>>Multidisciplinary</option>
<option<?php if ($_REQUEST["specialisation"] == "Dispute Resolution") echo " selected"; ?>>Dispute Resolution</option>
<option<?php if ($_REQUEST["specialisation"] == "Expert Witness") echo " selected"; ?>>Expert Witness</option>
<option<?php if ($_REQUEST["specialisation"] == "Information Systems") echo " selected"; ?>>Information Systems</option>
<option<?php if ($_REQUEST["specialisation"] == "Facilities Management") echo " selected"; ?>>Facilities Management</option>
<option<?php if ($_REQUEST["specialisation"] == "GIS") echo " selected"; ?>>GIS</option>
</select>
</td>
</tr>
<tr>
<td>Category of mentee:</td>
<td>
<input name="menteecategory" type="radio" value="Graduate Engineers, Technologist and Technicians" <?php if ($_REQUEST["menteecategory"] == "Graduate Engineers, Technologist and Technicians") echo " checked"; ?> required>Graduate Engineers, Technologist and Technicians - with 0-3 years' experience, must be registered as Candidates with ECSA<br>
<input name="menteecategory" type="radio" value="Mid-level Engineers" <?php if ($_REQUEST["menteecategory"] == "Mid-level Engineers") echo " checked"; ?> required>Mid-level Engineers - with 3-7 years' experience, must be registered as Candidates with ECSA / Professionally registered<br>
<input name="menteecategory" type="radio" value="Senior Engineers, Technologists and Technicians" <?php if ($_REQUEST["menteecategory"] == "Senior Engineers, Technologists and Technicians") echo " checked"; ?> required>Senior Engineers, Technologists and Technicians - with 8 or more years of experience, must be registered as Candidates with ECSA / Professionally registered<br>
<input name="menteecategory" type="radio" value="Professional Registration Candidates" <?php if ($_REQUEST["menteecategory"] == "Professional Registration Candidates") echo " checked"; ?> required>Professional Registration Candidates - Engineers, Technologist and Technicians primarily looking for guidance regarding professional registration with ECSA. Must be registered as Candidates with ECSA.
</td>
</tr>
<tr>
<td>Are you looking for mentorship on:</td>
<td>
<input name="mentorshiptype" type="radio" value="Professional registration" <?php if ($_REQUEST["mentorshiptype"] == "Professional registration") echo " checked"; ?> required>Professional registration<br>
<input name="mentorshiptype" type="radio" value="Career development" <?php if ($_REQUEST["mentorshiptype"] == "Career development") echo " checked"; ?>>Career development<br>
<input name="mentorshiptype" type="radio" value="Life coaching and personal development" <?php if ($_REQUEST["mentorshiptype"] == "Life coaching and personal development") echo " checked"; ?>>Life coaching and personal development
</td>
</tr>
<tr>
<td>Province:</td>
<td><input name="province" type="text" id="province" size="50" value="<?php echo $_REQUEST["province"]; ?>" required />
<strong>*</strong>
</td>
</tr>
<tr>
<td>Preferred Location / City:</td>
<td><input name="location" type="text" id="location" size="50" value="<?php echo $_REQUEST["location"]; ?>" /></td>
</tr>
<tr>
<td>Available From (Date):</td>
<td><input type="text" name="fromdate" id="fromdate" size="50" value="<?php echo $_REQUEST["fromdate"]; ?>" placeholder="YYYY-MM-DD" /></td>
</tr>
<tr>
<td>Telephone:</td>
<td><input type="text" name="telnum" id="telnum" size="50" value="<?php echo $_REQUEST["telnum"]; ?>" /></td>
</tr>
<tr>
<td>Email:</td>
<td><input name="email" type="text" id="email" size="50" value="<?php echo $_REQUEST["email"]; ?>" required />
<strong>*</strong>
</td>
</tr>
<tr>
<td>Brief profile:</td>
<td><textarea name="profile" rows="4" cols=40 required><?php echo $_REQUEST["profile"]; ?></textarea> <strong>*</strong></td>
</tr>
<tr>
<td>Upload your CV:</td>
<td><input type="file" name="strresume" id="strresume" /> <strong>*</strong></td>
</tr>
<tr>
<td>I am currently unemployed</td>
<td><input name="unemployed" type="radio" value="Y" <?php if ($_REQUEST["unemployed"] == "Y") echo " checked"; ?> required>Yes<br>
<input name="unemployed" type="radio" value="F" <?php if ($_REQUEST["unemployed"] == "F") echo " checked"; ?>>Freelancing<br>
<input name="unemployed" type="radio" value="N" <?php if ($_REQUEST["unemployed"] == "N") echo " checked"; ?>>No
</td>
</tr>
<tr>
<td colspan="2" align="center">
<p><input type="checkbox" value="Y" name="declarecorrect" <?php if ($_REQUEST["declarecorrect"] == "Y") echo " checked"; ?> required> I declare that the information given is true and correct. I am aware that it is an offence to wilfully make a false statement.</p>
<div class="g-recaptcha" data-sitekey="6LcoIWUrAAAAAKBLHpjS7GyroBey9G6yhilbpyNa"></div>
<br>
<input name="button" type="submit" id="button" value="Submit" />
</td>
</tr>
</table>
<p> </p>
</form>
<?php
}
include_once($_SERVER['DOCUMENT_ROOT'] . "/php/templates/inc_footer.php");