FarrukhMalik Posted November 24, 2014 Share Posted November 24, 2014 I have a ptc site in phpI want that all my ads will refresh at midnight in Pakistani time but server based in USAplease let me know how it will happenI have a file name titulos.phpand this is code please help me thanks.<tr><td bgcolor="<?=$highlight?>"><?require('config.php');$sqle = "SELECT * FROM tb_ads WHERE user='$last' and ident='$id'";$resulte = mysql_query($sqle); $myrow = mysql_fetch_array($resulte);mysql_close($con);$time=$myrow['visitime'];$crok1 = date(time());$crok2 = date($time + (24 * 60 * 60));if($crok1 >= $crok2){ ?><?=$bold?><a href="view.php?ad=<?=$id?>" target="_blank"><?=$description?></a><?=$boldc?><?} else { ?><del><?=$description?><del><? }?></td><tD bgcolor="<?=$highlight?>"><?=$members?> </td><td bgcolor="<?=$highlight?>"><?=$outside?></td><td bgcolor="<?=$highlight?>"><?=$total?></td></tr> Quote Link to comment Share on other sites More sharing options...
mik_se7 Posted November 24, 2014 Share Posted November 24, 2014 you can set the default timezone for your country like this replacing Country with your country, but check out this link because i couldn't find Pakistan on the list so you will need to find the closest to you that will fit your needs. http://php.net/manual/en/timezones.php <?php date_default_timezone_set("Country"); echo date('d-m-Y H:i:s'); //Returns IST ?> Quote Link to comment Share on other sites More sharing options...
FarrukhMalik Posted November 24, 2014 Author Share Posted November 24, 2014 it will reset the timing /? Quote Link to comment Share on other sites More sharing options...
mik_se7 Posted November 24, 2014 Share Posted November 24, 2014 No that will just set your site to the time of your country and then your timing to midnight in Pakistan should work. you may have to reference it as a variable to get it to work with your crok1 and crok2 variables. Quote Link to comment Share on other sites More sharing options...
mik_se7 Posted November 24, 2014 Share Posted November 24, 2014 also while i'm thinking about your issue this would possibly be better handled with Javascript and ajax as PHP isn't actioned unless the page is refreshed in someway or the php code is called. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.