-
Notifications
You must be signed in to change notification settings - Fork 22
/
search.job.applied.php
72 lines (62 loc) · 1.84 KB
/
search.job.applied.php
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
<?php
ob_start();
session_start();
$conn = mysql_connect('localhost', 'root', '');
$db = mysql_select_db('jobsportal', $conn);
if($conn == false){ echo mysql_errno($conn).":".mysql_error($conn)."\n"; }
if($db == false){ echo mysql_errno($conn).":".mysql_error($conn)."\n"; }
$job_id = $_REQUEST['job_id'];
$id = $_SESSION['SEEK_ID'];
$query = "SELECT * FROM seeker_details WHERE id='$id'";
$query_run = mysql_query($query);
if(!empty($_SESSION['SEEK_ID']))
{
while($query_run_result = mysql_fetch_array($query_run))
{
$fname = $query_run_result['fname'];
$lname = $query_run_result['lname'];
$folder = 'upload\\seeker_job_applied\\';
$filename = $folder.$id.'_'.$fname." ".$lname.".txt";
$flag = 0;
if(file_exists($filename))
{
$applied_file = fopen($filename, 'r');
while(!feof($applied_file))
{
$applied = fgetc($applied_file);
if($applied == $job_id)
{
$flag = 1;
}
}
fclose($applied_file);
if($flag == 1)
{
$_SESSION['job_applied'] = 1;
echo '<script> window.location.href = "search.jobs.view.php?id='.$job_id.'"; </script>';
}
else if($flag == 0)
{
$handle_append = fopen($filename, 'a');
fwrite($handle_append, "\n".$job_id."\n");
fclose($handle_append);
$_SESSION['job_applied'] = 2;
echo '<script> window.location.href = "search.jobs.view.php?id='.$job_id.'"; </script>';
}
}
else
{
$handle_write = fopen($filename, 'w');
fwrite($handle_write, $job_id."\n");
fclose($handle_write);
$_SESSION['job_applied'] = 2;
echo '<script> window.location.href = "search.jobs.view.php?id='.$job_id.'"; </script>';
}
}
}
else
{
$_SESSION['view_loggedin'] = 1;
echo '<script> window.location.href = "search.jobs.view.php?id='.$job_id.'"; </script>';
}
?>