Gayner Posted August 15, 2009 Share Posted August 15, 2009 $last_draw=$plot['last_draw']; $time_now=time(); $next_draw=$last_draw+($plot['draw_days']*(3600*24)); $plot['next_draw_time']=$next_draw; $sec_left=$next_draw-$time_now; $plot['next_draw'] = date("dS of F Y h:i A",$next_draw); $plot['last_draw'] = date("dS of F Y h:i A",$last_draw); I need to edit $next_draw=$last_draw+($plot['draw_days']*(3600*24)); so it's only 1hour, what do I times it by using *? thx Quote Link to comment https://forums.phpfreaks.com/topic/170386-only-1hour-time-php-time-help-thanks/ Share on other sites More sharing options...
wildteen88 Posted August 15, 2009 Share Posted August 15, 2009 You wont need to times 3600 by anything, if there's 60 secounds in a minute and there's 60 minutes in an hour, 60 * 60 = 3600 Quote Link to comment https://forums.phpfreaks.com/topic/170386-only-1hour-time-php-time-help-thanks/#findComment-898821 Share on other sites More sharing options...
Gayner Posted August 15, 2009 Author Share Posted August 15, 2009 SO what is my *24 doing in there? Thanks in advance for ur help Quote Link to comment https://forums.phpfreaks.com/topic/170386-only-1hour-time-php-time-help-thanks/#findComment-898822 Share on other sites More sharing options...
oni-kun Posted August 15, 2009 Share Posted August 15, 2009 SO what is my *24 doing in there? Thanks in advance for ur help Your code is 1 hour * 24 hours, which is one day. $next_draw=$last_draw+($plot['draw_days']*(3600*24)); It should be this to be an hour: $next_draw=$last_draw+($plot['draw_days']*(60*60)); Why are you doing draw_days when you want hours? or is it supposed to be one hour->day for your program? Quote Link to comment https://forums.phpfreaks.com/topic/170386-only-1hour-time-php-time-help-thanks/#findComment-898825 Share on other sites More sharing options...
Gayner Posted August 15, 2009 Author Share Posted August 15, 2009 HMm now it took away the Day and made it 6hours, lol 0 days 6 hrs 49 mins and 36 secs This is weird. I think ur missing some more scripts to find out problem but I dont really want to post a 5000 line php code.. lol We fixed the day tho.. now it's by hours, that's good but my draw_days varchar(6) field is set to 1.. and it shows 6hours because we edited that codes, should i try my draw days field to like 0.01? then will it go to 1hour ? lol EDIT: I tryed to make it 0.10 and my time went to 5hours lol if i put anything below that it messes it up Quote Link to comment https://forums.phpfreaks.com/topic/170386-only-1hour-time-php-time-help-thanks/#findComment-898828 Share on other sites More sharing options...
wildteen88 Posted August 15, 2009 Share Posted August 15, 2009 I think this is what you're after $next_draw = $last_draw + 3600; Quote Link to comment https://forums.phpfreaks.com/topic/170386-only-1hour-time-php-time-help-thanks/#findComment-898837 Share on other sites More sharing options...
Gayner Posted August 15, 2009 Author Share Posted August 15, 2009 I think this is what you're after $next_draw = $last_draw + 3600; im at ' 0 days 5 hrs 48 mins and 19 secs moved up an houir ? then when i did that it went to Were getting so close!! Quote Link to comment https://forums.phpfreaks.com/topic/170386-only-1hour-time-php-time-help-thanks/#findComment-898857 Share on other sites More sharing options...
wildteen88 Posted August 15, 2009 Share Posted August 15, 2009 I think this is what you're after $next_draw = $last_draw + 3600; im at ' 0 days 5 hrs 48 mins and 19 secs moved up an houir ? then when i did that it went to Were getting so close!! Pardon? I did not understand what you just said Quote Link to comment https://forums.phpfreaks.com/topic/170386-only-1hour-time-php-time-help-thanks/#findComment-898858 Share on other sites More sharing options...
Gayner Posted August 15, 2009 Author Share Posted August 15, 2009 My script says: 0 days 4 hrs 48 mins and 19 secs Then when I added $next_draw = $last_draw + 3600; to it it went to 0 days 5 hrs 48 mins and 19 secs 1 Hour ahead, Quote Link to comment https://forums.phpfreaks.com/topic/170386-only-1hour-time-php-time-help-thanks/#findComment-898867 Share on other sites More sharing options...
wildteen88 Posted August 15, 2009 Share Posted August 15, 2009 Sorry I meant to say this line $next_draw = $last_draw + 3600; replaces this $next_draw=$last_draw+($plot['draw_days']*(3600*24)); If it still doesn't work then please tell us, what your script is supposed to do and you're trying to. Post all relevant code here. Quote Link to comment https://forums.phpfreaks.com/topic/170386-only-1hour-time-php-time-help-thanks/#findComment-898873 Share on other sites More sharing options...
Gayner Posted August 15, 2009 Author Share Posted August 15, 2009 Sorry I meant to say this line $next_draw = $last_draw + 3600; replace this $next_draw=$last_draw+($plot['draw_days']*(3600*24)); If it still doesn't work then please tell us, what your script is supposed to do and you're trying to. Post all relevant code here. Once I Did that, now it turns into: 1 day 4 hrs 15 mins and 45 secs herE is my code : function make_countdown(){ global $ibforums,$plot; $last_draw=$plot['last_draw']; $time_now=time(); $next_draw=$last_draw+($plot['draw_days']*(3600*24)); $plot['next_draw_time']=$next_draw; $sec_left=$next_draw-$time_now; $plot['next_draw'] = date("dS of F Y h:i A",$next_draw); $plot['last_draw'] = date("dS of F Y h:i A",$last_draw); if($sec_left <= '0'){ $this->do_drawing(); exit; } return $sec_left; } function do_drawing(){ global $ibforums,$plot,$INFO,$DB; $count=0; $winning_numbers=array(); while($count < $plot['total_picks']){ $this_num = mt_rand ( $plot['min_number'], $plot['max_number']); if(!in_array($this_num, $winning_numbers)){ array_push($winning_numbers,$this_num); $count++; } } $db_pre=$INFO['sql_tbl_prefix']; $db_tickets = "$db_pre"."p_lottery_tickets"; //delete old tickets $DB->query("delete FROM $db_tickets WHERE status != 'Pending'") or print mysql_error(); $DB->query("SELECT * FROM $db_tickets WHERE status='Pending'") or print mysql_error(); while($row = $DB->fetch_row()){ $picks=explode(',',$row['picks']); $matched=0; foreach($picks as $pick){ if(in_array($pick,$winning_numbers)){ $matched++; } } if($matched >> '0'){ if(!is_array($all_matched[$matched])){$all_matched[$matched]=array();} array_push($all_matched[$matched],$row); } } ##make this draw time today at the set time $b_day=date("d"); $b_month=date("m"); $b_year=date("Y"); $b_time=explode(':',$plot['draw_time']); $bought=mktime ( $b_time['0'], $b_time['1'], 0, $b_month, $b_day, $b_year); //go through all matches of wins foreach($plot['payouts'] as $mc){ //do we have any with this no. of matches? if(is_array($all_matched[$mc['match']])){ //yes there is atleast 1 match $count_match=count($all_matched[$mc['match']]); //is this a percentage? if($mc['type']=='percent'){ $won=round( ($plot['pot']/100) * $mc['pays']); $plot['pot']=$plot['pot']-$won; }else{ $won=$mc['pays']; } //do we divide it? if($mc['divide']=='1'){ $won=$won/$count_match; $plot['pot']=$plot['pot']-$mc['pays']; }else{ $plot['pot']=$plot['pot']-($mc['pays']*$count_match); } $status='Winner'; $matched=$mc['match']; $where='WHERE (id=-99 '; foreach($all_matched[$mc['match']] as $m){ $where .= 'OR id='.$m['id'].' '; } $where.=')'; //make the update query $query= "UPDATE $db_tickets set `status`='$status', `won`='$won', `matched`='$matched', `bought_time`='$bought' $where"; $DB->query($query) or print mysql_error(); } } //make the rest losers $query= "UPDATE $db_tickets set `status`='Loser', `won`='n/a', `matched`='n/a', `bought_time`='$bought' WHERE `status` != 'winner'"; $DB->query($query) or print mysql_error(); //update lottery settings sort($winning_numbers); $winning_numbers=implode('-',$winning_numbers); $db_pre = $INFO['sql_tbl_prefix']; $db_settings = "$db_pre" . "p_lottery"; if($plot['pot'] <= $plot['pot_start']){$plot['pot']=$plot['pot_start'];} $DB->query( "UPDATE $db_settings set `pot` = '{$plot['pot']}', `ticket_count` = '0', `last_draw` = '$bought', `last_numbers` = '$winning_numbers' " ) or print mysql_error(); $this->give_winners_points(); $loc = $this->base_url; header("location:$loc"); } Quote Link to comment https://forums.phpfreaks.com/topic/170386-only-1hour-time-php-time-help-thanks/#findComment-898879 Share on other sites More sharing options...
wildteen88 Posted August 15, 2009 Share Posted August 15, 2009 The only bit that is relavent there is the make_countdown function. The do_drawing function is not relevant. Where do you call the make_countdown function? Quote Link to comment https://forums.phpfreaks.com/topic/170386-only-1hour-time-php-time-help-thanks/#findComment-898890 Share on other sites More sharing options...
Gayner Posted August 15, 2009 Author Share Posted August 15, 2009 function p_show_front($message=''){ global $ibforums,$plot; $cd = $this->make_countdown(); $last_draw = $this->make_last_draw(); $next_draw = $this->next_draw(); $form = $this->make_form(); $records = $this->make_records(); if($plot['action']=='settings'){ $your_tickets = $this->p_settings(); }elseif($plot['action']=='payouts'){ $your_tickets = $this->p_payouts(); }elseif($plot['action']=='holders'){ $your_tickets = $this->p_holders(); }else{ $your_tickets = $this->make_your_tickets(); } $this->output = $this->html->front_page($form,$your_tickets,$message,$next_draw,$last_draw,$cd,$records); } This one ? it shows $this->make_countdown(); I know what u mean tho, this is all i can find of make_countdown do i need to find more for u Im trying im best to help u help me. dont worry Quote Link to comment https://forums.phpfreaks.com/topic/170386-only-1hour-time-php-time-help-thanks/#findComment-898896 Share on other sites More sharing options...
wildteen88 Posted August 15, 2009 Share Posted August 15, 2009 WTF! This script is terrible. Where on earth did you get this crap! Sorry but I'm not going to help you any further. You should dump the script and find something else. Quote Link to comment https://forums.phpfreaks.com/topic/170386-only-1hour-time-php-time-help-thanks/#findComment-898902 Share on other sites More sharing options...
Gayner Posted August 15, 2009 Author Share Posted August 15, 2009 WTF! This script is terrible. Where on earth did you get this crap! Sorry but I'm not going to help you any further. You should dump the script and find something else. :facewall: What do u mean? This script is a wonderful lottery script man.. It works fine, I know i need to add mysqlreal escape to secure it but other then that it's fine bro.. just little dirty i guess? I just want to make it so it's not 1 day 24 hours 59 min and 59 seconds I want it to be 0 days 1 hour.. lol that's all Then $cd is for: <script language='JavaScript' type="text/javascript">countdown($cd);</script> which is: function countdown(Time_Left) { Today = new Date(); if(Time_Left < 0) Time_Left = 0; time_left2=Time_Left; days = Math.floor(Time_Left / (60 * 60 * 24)); Time_Left %= (60 * 60 * 24); hours = Math.floor(Time_Left / (60 * 60)); Time_Left %= (60 * 60); minutes = Math.floor(Time_Left / 60); Time_Left %= 60; seconds = Time_Left; dps = 's'; hps = 's'; mps = 's'; sps = 's'; //ps is short for plural suffix. if(days == 1) dps =''; if(hours == 1) hps =''; if(minutes == 1) mps =''; if(seconds == 1) sps =''; document.getElementById("countdown").innerHTML = days + ' day' + dps + ' '; document.getElementById("countdown").innerHTML += hours + ' hr' + hps + ' '; document.getElementById("countdown").innerHTML += minutes + ' min' + mps + ' and '; document.getElementById("countdown").innerHTML += seconds + ' sec' + sps; //Recursive call, keeps the clock ticking. time_left2--; setTimeout('countdown('+time_left2+');', 1000); } But that's client side htat has nothing to do with, the php is the part that makes that javascript work that's what I need help on the php part There is some more code u might find useful sir, please help! Quote Link to comment https://forums.phpfreaks.com/topic/170386-only-1hour-time-php-time-help-thanks/#findComment-898908 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.