Server : LiteSpeed System : Linux nl-srv-web1396.main-hosting.eu 4.18.0-553.83.1.lve.el8.x86_64 #1 SMP Wed Nov 12 10:04:12 UTC 2025 x86_64 User : u107206879 ( 107206879) PHP Version : 7.2.34 Disable Function : NONE Directory : /home/u107206879/domains/annoncelights.dk/public_html/services_html/ |
<?php
include "../db_connection.php";
include "../sessioncheck.php";
if(isset($_POST['trans']) && ($_POST['trans']=='repress') && !empty($_POST['trans']) && isset($_POST['value']) && !empty($_POST['value'])){
$ad_id = $_POST['value'];
$date_sql=mysqli_query($connection,"SELECT update_date FROM advertise WHERE id=$ad_id");
$date_result = mysqli_fetch_assoc($date_sql);
$last_update = $date_result['update_date'];
$now_date = date('Y-m-d H:i:s');
$new_update = date('Y-m-d H:i:s',strtotime('+10 minutes',strtotime($last_update)));
if($now_date > $new_update || $last_update == '' || $last_update == '0000-00-00 00:00:00'){
$sql=mysqli_query($connection,"UPDATE advertise SET update_date='".$now_date."' WHERE id=$ad_id");
if($sql){
echo 'Din annonce er nu på toppen af planen !';
}
}else{
$last_dt = date_create($last_update);
$current_dt = date_create($now_date);
$new_dt = date_create($new_update);
$diff=date_diff($current_dt,$new_dt);
$minutes = ($diff->format("%a"))*24*60+($diff->format("%h"))*60+$diff->format("%i")+($diff->format("%s"))/60;
if($diff->invert){
$minutes_left = -1 * $minutes;
}else{
$minutes_left = $minutes;
}
echo 'Du kan repress din annonce til toppen af din plan om: <h4>'.round($minutes_left).' minutes </h4>';
}
}
?>