| Server IP : 80.211.21.168 / Your IP : 216.73.217.33 Web Server : Apache System : Linux alex-webdesign.it 3.10.0-1160.119.1.el7.tuxcare.els22.x86_64 #1 SMP Mon Aug 18 06:07:12 UTC 2025 x86_64 User : admin_japan ( 10003) PHP Version : 8.2.32 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/cerchijapan.it/scaricoragazzon.com/aurez/ |
Upload File : |
<?php
$hostname = 'localhost'; // Adjust with your host
$database = 'admin_nscaricato';
$username = 'admin_nscaricato';
$password = 'Diomerdaio1994!?';
try {
$conn = new PDO("mysql:host=$hostname;dbname=$database", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// Use 'INTERVAL 1 HOUR' to select rules expiring in less than 1 hour
$sql = "SELECT * FROM ps_specific_price WHERE `to` <= DATE_ADD(NOW(), INTERVAL 1 HOUR)";
$stmt = $conn->prepare($sql);
$stmt->execute();
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach ($results as $row) {
// Calculate the new end date by adding 7 days to the current date
$newEndDate = date('Y-m-d H:i:s', strtotime('+7 days'));
// Update the end date of the price rule
$updateSQL = "UPDATE ps_specific_price SET `to` = :newEndDate WHERE id_specific_price = :id";
$updateStmt = $conn->prepare($updateSQL);
$updateStmt->execute([':newEndDate' => $newEndDate, ':id' => $row['id_specific_price']]);
}
echo "Price rules updated successfully.";
} catch(PDOException $e) {
echo "Connection error: " . $e->getMessage();
}
?>