-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjob_apply2.php
More file actions
90 lines (85 loc) · 2.77 KB
/
job_apply2.php
File metadata and controls
90 lines (85 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
//============================================================+
// File name : job_apply2.php
//
// Description : This file let the user to apply for the task.
//
// Author: Aditya Mathur
//
// (c) Copyright:
// Aditya Mathur
// eztasker.com
//
// License:
// Copyright (C) 2014 Aditya Mathur - eztasker.com
//============================================================+
session_start();
if(isset($_SESSION['li_uname333'])){
$e=$_SESSION['li_uname333'];
$type=3;
$title="Task Worker";
require_once './includes/db_config.php';
connect();
$q = "SELECT worker_id,fname,lname,gender,address,telephone FROM worker_profile WHERE email='".$e."'";
$r=mysql_query($q) or die(mysql_error());
$row = mysql_fetch_array($r);
//gathering worker's data
$worker_id= $row['worker_id'];
$wname=$row['fname'];
$gender=$row['gender'];
if($gender==1){$gen="Mr.";} elseif($gender==2){$gen="Ms.";}
}else{
header('location:login.php');die;//redirect to login page
}
?>
<?php
$formElement = $_REQUEST;
$poster_id = $formElement['pid'];
$pname = $formElement['fname'];
$pemail = $formElement['email'];
//task details
$task_id = $formElement['task_id'];
$comment= $formElement['comment'];
$today = mktime(0,0,0,date("m"),date("d"),date("Y"));
$applied_date = date("m/d/y", $today);
//save the applied tasks into dB.
require_once './includes/db_config.php';
connect();
$q9 = "select task_id, worker_id from task_applied where task_id='".$task_id."' && worker_id='".$worker_id."' ";
$r9=mysql_query($q9) or die(mysql_error());
if (mysql_num_rows($r9) > 0) {
echo "<script> alert('You have already applied for this post.') </script>" ;
echo "<script>window.location='index.php'</script>" ;die;
}
else{
$query1= "insert into task_applied values('','$task_id','$poster_id','$worker_id','$comment','$applied_date','0','0','0')";
$result1=mysql_query($query1);
if($result1){
//send mail
require_once './includes/mail.php';
$obj = new mail();
$url="http://eztasker.com/";
$from=$e;
$to = $pemail;
$subject = "EasyTask: A Candidate made offer for your task. ";
$message='<html>
<head>
<title>EasyTask</title>
</head>
<body>
<br><p>Hi '.$pname.',<br/><br/>
'.$gen.' '.$wname.' is made offer for the task you posted on EasyTask.<br>
Please login your account at <a href='.$url.'>EasyTask</a> and view notifications.<br><br>
Best Regards,<br>
EasyTask</p>
</body>
</html>';
if ($obj->mail_sender($from,$to, $subject, $message)){
echo "<script> alert('You have applied for this post.') </script>" ;
echo "<script>window.location='index.php'</script>" ;
}else{
echo "<p>Oops! problem sending mail!</p>";
}
}
}
?>