-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcronjob_aktivasi_lelang.php
121 lines (91 loc) · 4.13 KB
/
cronjob_aktivasi_lelang.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
include("/var/www/html/botlelang_buanakoi/db.php");
include("db.php");
include("saatini.php");
include("fonnte/function_fonnte_lelang.php");
ini_set("error_log", "cronjob_aktivasi_lelang.txt");
/*
Ini Code Cronjob untuk aktivasi dan deaktivasi lelang
+===========================================+
: Aplikasi Whatsapp BotLelang dibuat oleh :
: Kukuh TW :
: kukuhtw@gmail.com :
: https://linktr.ee/kukuhtw :
: https://wa.me/628129893706 :
+===========================================+
*/
$sql = " select * from `msbot` where `botid`='1' ";
$options = array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
);
$conn = new PDO("mysql:host=$mySQLserver;dbname=$mySQLdefaultdb", $mySQLuser, $mySQLpassword);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$no=0;
foreach($conn->query($sql) as $row) {
$no=$no+1;
$jambuka=$row['jambuka'];
$jamtutup=$row['jamtutup'];
$timestamp_jambuka = strtotime($jambuka);
$timestamp_jamtutup = strtotime($jamtutup);
$timestamp_sekarang = strtotime($saatini);
$isactive=0;
if ($timestamp_sekarang>=$timestamp_jambuka && $timestamp_sekarang<=$timestamp_jamtutup) {
$isactive = 1;
}
$sql_update = " update `msbot`
set `isactive`='$isactive' where `botid`='1' ";
echo "<Br>sql_update = ".$sql_update;
$query = mysqli_query($link,$sql_update)or die ('gagal update data'.mysqli_error($link));
}
$sql = " select * from `msproduct` where `ishapus`='0' and `botid`='1' ";
echo "<Br>sql = ".$sql;
$options = array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
);
$conn = new PDO("mysql:host=$mySQLserver;dbname=$mySQLdefaultdb", $mySQLuser, $mySQLpassword);
// set the PDO error mode to exception
$allproductexpire=0;
$no=0;
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
foreach($conn->query($sql) as $row) {
$no=$no+1;
$pid=$row['pid'];
$productname=$row['productname'];
$productdesc=$row['productdesc'];
$productcode=$row['productcode'];
$jambuka=$row['jambuka'];
$jamtutup=$row['jamtutup'];
$timestamp_jambuka = strtotime($jambuka);
$timestamp_jamtutup = strtotime($jamtutup);
$timestamp_sekarang = strtotime($saatini);
echo "<br>timestamp_sekarang = ".$timestamp_sekarang. " ".$saatini;
echo "<br>timestamp_jamtutup = ".$timestamp_jamtutup. " ".$jamtutup;
$isactive=0;
if ($timestamp_sekarang>=$timestamp_jambuka && $timestamp_sekarang<=$timestamp_jamtutup) {
$isactive = 1;
}
else {
$isactive = 0;
$allproductexpire= $allproductexpire+1;
}
$sql_update = " update `msproduct`
set `isactive`='$isactive' where `pid`='$pid' and `botid`='1' ";
echo "<Br>sql_update = ".$sql_update;
$query = mysqli_query($link,$sql_update)or die ('gagal update data'.mysqli_error($link));
}
if ($no==$allproductexpire) {
$sql_update = " update `msbot`
set `isactive`='0' where `botid`='1' ";
echo "<Br>sql_update = ".$sql_update;
$query = mysqli_query($link,$sql_update)or die ('gagal update data'.mysqli_error($link));
}
if ($no>$allproductexpire) {
$sql_update = " update `msbot`
set `isactive`='1' where `botid`='1' ";
echo "<Br>sql_update = ".$sql_update;
$query = mysqli_query($link,$sql_update)or die ('gagal update data'.mysqli_error($link));
}
$conn = null;
$query = null;
?>