-
Notifications
You must be signed in to change notification settings - Fork 0
/
cronproc.php
47 lines (41 loc) · 1.53 KB
/
cronproc.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
include_once 'dbconfig.php';
include_once 'process.php';
if(!isset($_GET['_token']) )
{
echo json_encode('{message:"error", code:401}');
exit;
}
if($_GET['_token'] !== $token)
{
echo json_encode('{message:"error", code:401}');
exit;
}
$res = getData($connection, 'Select * From cron_jobs where download_flag = 0 limit 0,1;');
if(sizeof($res) == 1)
{
try {
$res = $res[0];
$id = $res['id'];
$hostUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ?
"https" : "http") . "://" . $_SERVER['HTTP_HOST'];
//Upload your server
$detailZipUrl = $res['detail_zip_url'];
$storeZipName = $res['store_zip_name'];
@copy($detailZipUrl, "../Download/zip/$storeZipName");
$detailPreviewUrl = $res['detail_preview_url'];
$storePreviewName = $res['store_preview_name'];
@copy($detailPreviewUrl, "../Download/png/$storePreviewName");
if(file_exists("../Download/zip/$storeZipName") && file_exists("../Download/png/$storePreviewName"))
{
insertData($connection, "Update cron_jobs set download_flag = 1 Where id='$id'");
echo json_encode('{message:"success", code:200}');
}
} catch (Exception $e) {
echo json_encode('{message:"error", code:402}');
}
} else
{
echo json_encode('{message:"error", code:400}');
}
?>