Monkuar
Members-
Posts
987 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Monkuar
-
Yeah I understand what it does now, I just didn't know what the += i never seen that operator before, Problem I am having is echo $correct_numbers; is echoing out 0 or 1 every other refresh And it's supposed to match if($correct_numbers == $lottery['balls']) $lottery['balls'] is my MAX number of Balls to match, which is set to 3. $winning_numbers are 8|18|3 And the $ticket['numbers_chosed'] are 8|18|3 It should be echoing out 3 instead of 0 or 1 right? ?because it's Matching each array with each individual ball? Here is the full function (not that long dont worry) if($end_date < time() and $lottery['type'] == 'exact') { //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ $this->drawn_lotto++; $winning_numbers = $this->choose_numbers($lottery['balls'],$lottery['max_number'], $lottery['type']); $wn = implode("|",$winning_numbers); $winning_numbers = explode("|", $wn); $query = $DB->query("SELECT l.*,m.name,m.id FROM ibf_lottery_tickets l LEFT JOIN ibf_members m ON (m.id=l.memberid) WHERE l.lotteryid='{$lottery['i_id']}' AND l.checked=0 ORDER BY l.t_id ASC"); $tickets_bought = $DB->get_num_rows(); while($ticket = $DB->fetch_row($query)) { $correct_numbers = 0; $correct = 0; $numbers_chosen = @explode("|",$ticket['numbers_chosed']); $your_numbers = array(); $array1 = array_count_values($numbers_chosen); $array2 = array_count_values($winning_numbers); foreach($array1 as $number1 => $count1) { foreach($array2 as $number2 => $count2) { if($number2 == $number1 and $count2==$count1) $correct_numbers = $correct_numbers + $count2; } } $use = 0; $numbers = @implode("|",$winning_numbers); echo $correct_numbers; echo "<br>"; echo $lottery['balls']; if($correct_numbers == $lottery['balls']) { foreach($numbers_chosen as $choice => $number) { if($winning_numbers[$choice] == $number) { $correct++; } } } } exit; Another weird problem is the $winning_numbers selects a randomize X|X|X number 1-32 for each | seperated. But it should be matching $ticket['numbers_chosed'] Cause that is from the Lottery ticket I purchased, which is "8|18|3", no idea why that $winning_number code is there when it should be reading off the "8|18|3" instead of grabbing a new generated one? I am probably Missing something, I tried to explain the best I could, I am so close to get this lottery thing done!
-
ty anyone else gonna chime in?
-
$correct_numbers = 0; $correct = 0; $numbers_chosen = @explode("|",$ticket['numbers_chosed']); $your_numbers = array(); $array1 = array_count_values($numbers_chosen); $array2 = array_count_values($winning_numbers); foreach($array1 as $number1 => $count1) { foreach($array2 as $number2 => $count2) { if($number2 == $number1 and $count2==$count1) $correct_numbers += $count2; } } $use = 0; $numbers = @implode("|",$winning_numbers); echo $correct_numbers; echo "<br>"; echo $lottery['balls']; I have no idea wthell this does $correct_numbers += $count2; What's that += suppose to mean? I know the $correct_numbers is supposed to be a matching array count from the for eachs right? $ticket['numbers_chosed'] is 8|18|3
-
WOW IM SO RETARDED $seconds = date("s", $e); LOL!!!! OMG...
-
Ok Let's say I have a timestamp: 1327482941 I want to convert this to output only "60" im not looking for a whole time_ago function, simply just need to convert a timestamp down to seconds ONLY not having minutes/years/etc no need none of that just purely seconds starting from 1-60 if so how is it possible? I tried to just $seconds = substr($e,1,4) . ""; $e is my timestamp, I did this because I could just grab the last 2 digits in the timestamp that would be what I want, but that's not possible because it goes 1-90 not 1-60 help Here is a code I am trying to make it only spit out 1-60 in seconds function timeAgo4($timestamp, $granularity=1){ $difference = $timestamp; if($difference < 0) return '0'; elseif($difference < 86400){ $periods = array(60,'' => 1); $output = ''; foreach($periods as $key => $value){ if($difference >= $value){ $time = round($difference / $value); $difference %= $value; $output .= ($output ? ' ' : '').$time.' '; $granularity--; } if($granularity == 0) break; } return ($output ? $output : '0').''; } else return date($format, $timestamp); }
-
ty sir quick fix
-
function timeAgo($tm,$rcs = 1) { $cur_tm = time(); $dif = $cur_tm-$tm; $pds = array('second','minute','hour','day','week','month','year','decade'); $lngh = array(1,60,3600,86400,604800,2630880,31570560,315705600); for($v = sizeof($lngh)-1; ($v >= 0)&&(($no = $dif/$lngh[$v])<=1); $v--); if($v < 0) $v = 0; $_tm = $cur_tm-($dif%$lngh[$v]); $no = floor($no); if($no <> 1) $pds[$v] .='s'; $x=sprintf("%d %s ",$no,$pds[$v]); if(($rcs > 0)&&($v >= 1)&&(($cur_tm-$_tm) > 0)) $x .= $this->timeAgo($_tm, --$rcs); return $x; } This is my function I use it alot My code: $endtime = $std->timeAgo($lotto['start_time']+3600); $lotto['start_time'] = 1327482941 +3600 is 1 Hour correct? But this displays: Next Drawing in: -3219 seconds each refresh it goes down 3218/etc which is GOOD! But why is it using the minus sign and not going through the function properly?
-
OKAY OKAY THANK YOU! Im making as RESOLVED! God bless! /wish u had a //comments on it to help
-
30|24|17,5|4|20,15|13|33,15|22|33,9|20|22 Let's say my output is that, Realistically every 3numbers is 1 Ticket they are seperated by a "," (comma) I want to wrap parenthesis around them so the output would look like this (30|24|17) (5|4|20) (15|13|33) (15|22|33) (9|20|22) Now would I have to use regex.. or not cuz regex is extremely difficult Thanks :confused:
-
Man I feel bad i added $count = count($numArray); now it works. Shows 7. =] Now I almost finished! But now how do I only accept X|X|X ? Because I dont want users to submit cheating/hacking material through Tamper data?
-
$numbers = "{$ibforums->input['balls']}"; $numArray = explode(",", $numbers); //$numArray[0] = "1|20|30"; //$numArray[1] = "20|10|5"; //To further break the array, you would do foreach($numArray as $numList) { $nums = explode("|", $numList); foreach($nums as $num) { $count++; //Validate each $num if ($num > 36){ $std->Error2("Your Lottery Balls cannot be higher then 36, stop trying to be nawty."); } } echo $count; exit; } Ok so the input for this one is: 1|7|13,14|8|2,9|3|10,4|5|11,16|15|14 Let's count that 1 2 3 4 5 the $count outputs "3" any idea?
-
I have ticket's for my lottery system. Somone chooses 3 random numbers out of 36, it will show 1|20|30 but now I want to beable to have my Members BUY multiple Tickets! So then I added a comma between the 3 arrays So the code will look like this when they select the balls they want 1|20|30,20|10|5 /etc /etc But now I have 1 problem. How do I go about validating the arrays for each COMMA inside the | ARRAY? Cause let's saY I don't want anyone to Submit a ball number higher then "36" how would I go about making it so it checks through each array and if it's higher then 32 I can give them a Error? Also, I each Ticket costs (5 Forum Gold) so the above code would be a total of 10 Forum Gold, because they're "2" Tickets being bought, how would I go about making a $counter++ in the arrays to count only the "," so I can tell how much Gold the member needs to have before he purchases Thanks
-
how hard is it do with debian linux 64bit? what i run also pikachu, the script alrdy does that.. but sum1's needs to view the lottery page for it run lol ! I'm not very familiar with Linux, but this article looks helpful. http://www.debian-administration.org/articles/56 Just know that .php files can be run with cron as well. thank u for this
-
how hard is it do with debian linux 64bit? what i run also pikachu, the script alrdy does that.. but sum1's needs to view the lottery page for it run lol !
-
ok i have a lottery system very nice one choose 36 balls/etc 3 numbers must be exaxt, odds of winning is like 1:45920 lol prob is for the lottery to countdown and select the lottery, somone needs to be at the site to refresh the "DELETE FROM" query/etc/etc how would I go about making it so after the time is run down, what if no1 is viewing the lottery page? then the new lottery wont run, i need something refresh that page every other 1hour, cron job?
-
Ok thanks, now can I add a & multiplier to that $gold variable let's say 20% out of 100% of getting 150 to 200 out of the 1-200?
-
I need to use the rand function but how would I go about incorporating into let's say.. somone spends some (Forum gold) on my site, (you get these golds from posting) Somone buys a Scratch Ticket and it will give them 1-200 forum Gold (random chance) how would I go about doing that with the rand function? Also, could there be something I add like a % value that it will be less then 200 inside the 1-200 phase? Kinda confusing, but pretty much can I say 50% of users will get less then 50 Forum Gold from the 1-200FG Chance Ticket? Pretty much adding a % modifier with the rand function so people don't get essentially "Free" forum gold, that there is a 20% of actually getting 100-200 AMOUNT, and 80% of actually getting less then 100? Any idea? i know how to code it with mysql/php I just need somone to lift me up right now and get a little boost of code/help to get me started and a explanation
-
OK EASY FIXED JUST CHANGED = 0 to = "0" TOPIC RESOLVED!!
-
if ($ibforums->input['display0'] == 0 OR $ibforums->input['display0'] == 1){ // }else{ $std->Error2("You're being Nawty!"); } and I just used tamper data to test my code and i put "csef" or whatever in the field, and it passes.... doesn't error out, something is wrong how do I check the input so it will only ACCEPT 0-10 (INTEGERS) (NOTHING ELSE) ?
-
what does WHERE p.pid IN(0,4561,0) mean? I know it's lokoing for DATA FROM p.pid = 4561, but WHAT THE HELL DOES THE 0, ,0 mean? Thanks
-
yea but that would still only do $display['0'] im looking for a forloop method to iniative all 4 arrays and go through each one it's fine tho the ternary operator works fine, i just changed $value to $value1 $value2 $value3 then used them on my html return <<<EOF functon But you are writing all the checkboxes anyway, right? yeah each 1 so i guess the ternary operator is awesome makes the code small and compact, i love it thanks for sharing!
-
yea but that would still only do $display['0'] im looking for a forloop method to iniative all 4 arrays and go through each one it's fine tho the ternary operator works fine, i just changed $value to $value1 $value2 $value3 then used them on my html return <<<EOF functon
-
o.o simply terny operator would work but then i would have to use $value = $display[0] == 1 ? 'checked' : ''; $value = $display[1] == 1 ? 'checked' : ''; $value = $display[2] == 1 ? 'checked' : ''; but hell w/e i guess it works thx