Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Php facebook app help
Old 03-12-2010, 02:17 PM Php facebook app help
Super Talker

Posts: 121
Trades: 0
Hi all i could use some help getting timers to show up from cron jobs here is the out put code
PHP Code:
<? $timer_item $appSetting["cron_energy_stemina"]-(time()-$user["last_charge_stemina"]);if($timer_item<=0)echo " More in <span style='color:#ffd004'>".$time.-last_charge_stemina.' sec<span>';else echo " More in <span style='color:#ffd004'>".$timer_item.' sec<span>'?>
and here is the functions for it

PHP Code:
  //Cron Job for Stemina
function CronJobForStemina()
{
    
$appSetting ApplicationSetting();
    
$time time();
    
db_execute("Update user set stemina=stemina+1, last_charge_stemina=".$time." where stemina<stemina_max and (".$time."-last_charge_stemina)>=".$appSetting["cron_energy_stemina"]);


the cron is set at 5 mins i would like for it to say show more in blank mins and blank sec

Im lost i cant figure this out thanks for help in advance

Thanks
bikerboys is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-12-2010, 06:29 PM Re: Php facebook app help
nayes84's Avatar
Extreme Talker

Latest Blog Post:
Difference between ASP And JSP
Posts: 232
Name: John
Location: Tokyo
Trades: 0
you need to modify both of
PHP Code:
$time.-last_charge_stemina.'sec' 
And
PHP Code:
$timer_item.' sec' 
to a check for seconds over 59.
first lets make a function to calculate that
PHP Code:
function sec2str($sec)
{
   if(
$sec>59)
   {
      
$str=round($sec/60,0) . 'min and ';
      
$sec%=60;
   }
   
$str.=$sec ' sec';

after that just call this function instead of displaying seconds your self
PHP Code:
$timer_item $appSetting["cron_energy_stemina"]-(time()-$user["last_charge_stemina"]);if($timer_item<=0)echo " More in <span style='color:#ffd004'>".str2time($time.-last_charge_stemina) .'<span>';else echo " More in <span style='color:#ffd004'>".sec2str($timer_item) .'<span>'?> 
hope I could help :-)
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

if(I'm("Helpful")) Add_Talkupation("nayes84");

Last edited by nayes84; 03-12-2010 at 06:30 PM..
nayes84 is offline
Reply With Quote
View Public Profile
 
Old 03-12-2010, 06:38 PM Re: Php facebook app help
Super Talker

Posts: 121
Trades: 0
Thanks for the help. Now i add the function to the fuctions File correct?
bikerboys is offline
Reply With Quote
View Public Profile
 
Old 03-12-2010, 07:15 PM Re: Php facebook app help
Super Talker

Posts: 121
Trades: 0
Dont seem to be working yet the issue is in here


PHP Code:
.str2time($time.-last_charge_stemina). 
bikerboys is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Php facebook app help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.10678 seconds with 12 queries