-
Notifications
You must be signed in to change notification settings - Fork 0
/
CronJob.php
48 lines (42 loc) · 1.08 KB
/
CronJob.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
<?php
namespace SaleAlerts;
set_time_limit(180);
require_once('lib/Config.php');
if(isset($_GET['key']) && $_GET['key'] === Config::$apiKey)
{
require_once('lib/Application.php');
if(isset($_GET['action']) && !empty($_GET['action']))
{
switch ($_GET['action'])
{
case 'sales-alert':
case '1':
$controller = new SalesPriceController();
$success = $controller->sendReport();
break;
case 'build-report':
case '2':
$controller = new BuildReportController();
$success = $controller->sendReport();
break;
default:
http_response_code(403);
echo "Invalid request";
exit();
}
echo '<br/></br>';
echo 'Job finished '.($success ? 'with' : 'without').' success.';
}
else
{
http_response_code(403);
echo "Invalid request";
exit();
}
}
else
{
http_response_code(403);
echo "Not authorized";
exit();
}