Jump to content

If date is within 2 next days..


Incredinot

Recommended Posts

Hi..

 

Alright, first ill post the code - then ill explain

 

Line 1. <?php if(time() > $row3['expiredate']){echo "It's expired!</td>"; }?>

Line 2. <?php if(time() < $row3['expiredate']){echo "It's currently active!</td>"; } ?>

Line 3. <?php if(????????){echo "It will run out within "xx". Click to extend period.</td>"; } ?>

 

Okay let me explain..

 

Line 1: First i want to check the time. Now that i have checked if the current time is greater than the "expiredate" - if so - show a "REMAKE" button. If button is pressed, it should make a timestamp that is the current date + 14 days.

 

Line 2: Seems fine? (:

 

Line 3: Alright... Here i want something like...

If the current date is 2 (or less) days away from expire date, it should show something like "Expires in "xxx". Click here to extend".

And then when pressed, it should add +14 days to the timestamp...

 

How can this be done?

The expiredate is in my db.. (Example, one is "1256684400" and is contained in a database called "bw" in table "node_expire" and column name is "expire".)

 

Hope someone can help me out (:

Link to comment
https://forums.phpfreaks.com/topic/183566-if-date-is-within-2-next-days/
Share on other sites

<?php 
if(time() > $row3['expiredate']) {
echo "It's expired! <a href='webaddressTOredo'>Redo</a></td>"; 
}
if(time() < $row3['expiredate']) {
echo "It's currently active!</td>"; 
}
if () {
echo "It will run out within "xx". Click to extend period.</td>";
}
?>

 

Idk about dates.. ill leave that to someone else. also keep your code together

Have tried this, but that dont work...

 

    <?php $sometime = $row3['expire']+172800;
	  $currenttime = time();
	  $expiretime = $row3['expire'];
    if ($currenttime < $sometime && $currenttime > $expiretime){echo "blaaah!</td>";}
elseif($currenttime > $expiretime){echo "GENOPRET</td>"; }
elseif($currenttime < $expiretime){echo "aktiv </td>"; } ?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.