Repository navigation
Expand file tree
/
Copy pathcron.php
More file actions
31 lines (20 loc) · 1.58 KB
/
Copy pathcron.php
File metadata and controls
31 lines (20 loc) · 1.58 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
<?php
require_once('config.php');
$sql="SELECT * from posts where isConfirmed=0 and paid=1 and isDeleted=0 and CURRENT_TIMESTAMP()-INTERVAL 2 DAY>fullDate ";
$result=$conn-> query($sql);
if($result->num_rows>0)
{
while($row=$result->fetch_assoc())
{
$sql = "INSERT INTO posts (userName,date,city,street,houseNumber,time,revenue, amountA, amountB,paid,profilePic,fullDate,code,isConfirmed,tel)
VALUES ('".$row['userName']."',CURDATE(),'".$row['city']."','".$row['street']."','".$row['houseNumber']."',CURTIME()+1,'".$row['revenue']."','".$row['amountA']."','".$row['amountB']."',FALSE, '".$row['path']."',CURTIME(),'".$row['code']."',0,'".$row['tel']."')";
if (mysqli_query($conn, $sql));
}
}
$sql = "UPDATE posts SET isDeleted=1 , paidUser=NULL WHERE isConfirmed=0 and paid=1 and CURRENT_TIMESTAMP()-INTERVAL 2 DAY>fullDate";
if ($conn->query($sql) === TRUE) {
echo "work";
} else {
echo "Error updating record: " . $conn->error;
}
?>