changed git call from https to git readonly
[atutor.git] / mods / job_board / confirm.php
1 <?php
2 /***********************************************************************/
3 /* ATutor                                                                                                                          */
4 /***********************************************************************/
5 /* Copyright (c) 2002-2009                                                                                         */
6 /* Adaptive Technology Resource Centre / Inclusive Design Institute        */
7 /* http://atutor.ca                                                                                                        */
8 /*                                                                                                                                         */
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 /***********************************************************************/
13 // $Id$
14 $_user_location = 'public';
15
16 define('AT_INCLUDE_PATH', '../../include/');
17 require(AT_INCLUDE_PATH.'vitals.inc.php');
18
19 if (isset($_GET['id'], $_GET['m'])) {
20         $id = intval($_GET['id']);
21         $m  = $_GET['m'];
22
23         $sql = "SELECT email, requested_date FROM ".TABLE_PREFIX."jb_employers WHERE id=$id AND approval_state=".AT_JB_STATUS_UNCONFIRMED;
24         $result = mysql_query($sql, $db);
25         if ($row = mysql_fetch_assoc($result)) {
26                 $code = substr(md5($row['email'] . $row['requested_date'] . $id), 0, 10);
27                 if ($code==$m){
28                         //confirmed
29                         $sql = "UPDATE ".TABLE_PREFIX."jb_employers SET approval_state=".AT_JB_STATUS_CONFIRMED.", last_login=NOW() WHERE id=$id";
30                         mysql_query($sql, $db);
31                         $msg->addFeedback('CONFIRM_GOOD');
32
33                 } else {
34                         //not confirmed
35                         $msg->addError('CONFIRM_BAD');                  
36                 }
37         }
38 }
39
40 header('Location: index.php');
41 exit;
42 ?>