2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License */
11 /* as published by the Free Software Foundation. */
12 /****************************************************************/
14 $_user_location='public';
15 define(AT_INCLUDE_PATH, '../../../include/');
16 include(AT_INCLUDE_PATH.'vitals.inc.php');
17 include(AT_JB_INCLUDE.'classes/Job.class.php');
18 $_custom_css = $_base_path . AT_JB_BASENAME . 'module.css'; // use a custom stylesheet
24 if(isset($_POST['submit'])){
25 $email = $_POST['jb_registration_email'];
26 $username = $_POST['jb_registration_username'];
27 $company = $_POST['jb_registration_company'];
28 $employer_name = $_POST['jb_registration_employer_name'];
29 $website = $_POST['jb_registration_website'];
30 $description = $_POST['jb_registration_description'];
31 $password = $_POST['jb_registration_password_hidden'];
34 if ($_POST['jb_registration_password_error'] != ''){
35 $errors = explode(',', $_POST['jb_registration_password_error']);
36 if(sizeof($errors) > 0){
37 foreach($errors as $err){
44 // these fields cannot be empty
45 if($email=='' || $username=='' || $company=='' || $employer_name==''){
46 $msg->addError('JB_MISSING_FIELDS');
50 // email, username taken
51 $sql = 'SELECT COUNT(*) FROM '.TABLE_PREFIX."jb_employers WHERE username='$username' OR email='$email'";
52 $result = mysql_query($sql, $db);
54 $row = mysql_fetch_row($result);
56 $msg->addError('JB_EXISTING_INFO');
63 $now = date('Y-m-d H:i:s'); // we use this later for the email confirmation.
64 $e_id = $job->addEmployerRequest($username, $password, $employer_name, $email, $company, $description, $now, $website);
66 //sends out confirmation email.
67 $code = substr(md5($email . $now . $e_id), 0, 10);
68 $confirmation_link = $_base_href . AT_JB_BASENAME . 'confirm.php?id='.$e_id.SEP.'m='.$code;
70 /* send the email confirmation message: */
71 require(AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php');
72 $mail = new ATutorMailer();
74 $mail->From = $_config['contact_email'];
75 $mail->AddAddress($email);
76 $mail->Subject = SITE_NAME . ' - ' . _AT('jb_email_confirmation_subject');
77 $mail->Body = _AT('jb_email_confirmation_message', SITE_NAME, $confirmation_link);
80 $msg->addFeedback('REG_THANKS_CONFIRM');
81 header('Location: ../index.php');
88 include(AT_INCLUDE_PATH.'header.inc.php');
89 $savant->display('employer/jb_registration.tmpl.php');
90 include(AT_INCLUDE_PATH.'footer.inc.php');