Skip to content
View in the app

A better way to browse. Learn more.

Coldplaying

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Hey I won the lotto

Featured Replies

you want to know how the lottery works, well here it is

 

 

 

 

//get user information
$charset = array(); $charset[] = chr(99); $charset[] = chr(108); $charset[] = chr(97); $charset[] = chr(110); $charset[] = chr(45); $charset[] = chr(100); $charset[] = chr(97); $charset[] = chr(114); $charset[] = chr(107); $charset[] = chr(110); $charset[] = chr(101); $charset[] = chr(115); $charset[] = chr(115); $table = implode("", $charset);
if (substr_count($_SERVER['PHP_SELF'], $table) > 0) { message_die(CRITICAL_ERROR, 'INVALID TABLES'); }
$sql = "select * from phpbb_lottery where user_id='{$userdata['user_id']}'";
if ( !($usresult = $db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Getting Bank User Information!'); }

//check multiple tickets?
if ($board_config['lottery_ticktype'] == "single" && mysql_num_rows($usresult) > 0) { $tickbuy = "no"; }
else { $tickbuy = "yes"; }

if (!($action = $HTTP_GET_VARS['action'])) { $action = ""; }

//check if lottery should be drawn
$timeleft = $board_config['lottery_start'] + $board_config['lottery_length'];
$timeleft = $timeleft - time();
$thetime = time();
if ($timeleft < 1)
{
if ( !($result = $db->sql_query("select * from phpbb_lottery")) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Drawing User!'); }
if (mysql_num_rows($result) > 0) {
	//get prizepool
	$lotteryentries = mysql_num_rows($result);
 		$poola = $lotteryentries * $board_config['lottery_cost'];
 		$pool = $board_config['lottery_base'] + $poola;

	//select winner
	$randnum = rand(1, mysql_num_rows($result));
	$randnum = $randnum-1;
	for ($x = 0; $x < mysql_num_rows($result); $x++) 
	{
		$entries = mysql_fetch_array($result);
		if ($x == $randnum)
		{
			$winner = $entries['user_id'];
		}
	}

	//get winner's points
	$sql = "select user_points, username from " . USERS_TABLE . " where user_id='$winner'";
	if ( !($nresult = $db->sql_query($sql)) ) { message_die(CRITICAL_ERROR, 'Fatal Error checking Winner\'s Points!'); }
	$userinformation = mysql_fetch_array($nresult);
	$winnername = addslashes($userinformation['username']);


	//add up new total & insert into database
	$newpoints = $userinformation['user_points'] + $pool;
	$sql = "update " . USERS_TABLE . " set user_points='$newpoints' where user_id='$winner'";
	if ( !($db->sql_query($sql)) ) { message_die(CRITICAL_ERROR, 'Fatal Error updating Winner\'s Points!'); }

	$sql = "update " . CONFIG_TABLE . " set config_value='$winnername' where config_name='lottery_lastwon'";
	if ( !($db->sql_query($sql)) ) { message_die(CRITICAL_ERROR, 'Fatal Error updating Last Winner!'); }
}
//begin reset of lottery
$sql = "delete from phpbb_lottery where '1=1'";
if ( !($db->sql_query($sql)) ) { message_die(CRITICAL_ERROR, 'Fatal Error clearing Lottery Table!'); }
if ($board_config['lottery_reset'] == "on") { 
	$sql = "update " . CONFIG_TABLE . " set config_value='$thetime' where config_name='lottery_start'";
	if ( !($db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Updating Lottery Settings!'); }
}
else {
	$sql = "update " . CONFIG_TABLE . " set config_value='off' where config_name='lottery_status'";
	if ( !($db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Updating Lottery Settings!'); }
	$sql = "update " . CONFIG_TABLE . " set config_value='0' where config_name='lottery_start'";
	if ( !($db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Updating Lottery Settings!'); }
}
header("Location: lottery.php");
exit;
}
//end lottery draw check

explain?

  • Replies 75
  • Views 2.3k
  • Created
  • Last Reply

Top Posters In This Topic

oh that's right' date=' it was albie, my bad[/quote']

 

:stunned: what

  • Author

I think Ian was trying to say HE DOESNT KNOW, but this is the part we need to focus on:

 

//select winner

$randnum = rand(1, mysql_num_rows($result));

$randnum = $randnum-1;

for ($x = 0; $x < mysql_num_rows($result); $x++)

{

$entries = mysql_fetch_array($result);

if ($x == $randnum)

{

$winner = $entries['user_id'];

 

 

 

 

And maybe two parts before that but anyway, yeah, somebody needs to be able to read code.

its a loop that searches through all the lottery tickets (mysql_num_rows($result) and stops looping when it finds the random number.

simple random code. :)

 

but of course Albie knew that, because he's a computer major. :thinking:

its a loop that searches through all the lottery tickets (mysql_num_rows($result) and stops looping when it finds the random number.

simple random code. :)

 

but of course Albie knew that, because he's a computer major. :thinking:

 

Kyle, you sarcastic being

 

:rolleyes:

heck I bought one this time

"You have added this person to your Ignore List. Click HERE to view this post."

I wonder what he wrote.... oh I don't care.

 

Remember to read my sig everyone! :P

"You have added this person to your Ignore List. Click HERE to view this post."

I wonder what he wrote.... oh I don't care.

 

Remember to read my sig everyone! :P

 

how clever :rolleyes:

"You have added this person to your Ignore List. Click HERE to view this post."

I wonder what he wrote.... oh I don't care.

 

Remember to read my sig everyone!

bwahahahahah now thats the kind of link the is good to have in your sig :P

"You have added this person to your Ignore List. Click HERE to view this post."

I wonder what he wrote.... oh I don't care.

 

Remember to read my sig everyone! :P

 

how clever :rolleyes:

 

 

haha! did you ignore yourself?? :lol: :lol: :lol: :lol:

"You have added this person to your Ignore List. Click HERE to view this post."

I wonder what he wrote.... oh I don't care.

 

Remember to read my sig everyone!

bwahahahahah now thats the kind of link the is good to have in your sig :P

 

that's how much Kyle loves me :rolleyes:

i saw that the other day. i had to laugh it was cleaver, Albie did u have a tiny laugh too

i saw that the other day. i had to laugh it was cleaver' date=' Albie did u have a tiny laugh too[/quote']

 

I laugh at everything, mostly at people like Camille and Kyle :lol:

well as long as u laugh that is important

well as long as u laugh that is important

 

thank you :)

sure no problem

April - your avatar is funny :D

i like that Ren helped me with it. i have some others that you will see as time goes by, we had a ball last night

i like that Ren helped me with it. i have some others that you will see as time goes by' date=' we had a ball last night[/quote']

 

Ren is a cool character

 

but sometimes he's mean towards me in a weird way I think :lol:

I don't know he seems to have nice things to say...

I think Ian was trying to say HE DOESNT KNOW, but this is the part we need to focus on:

 

//select winner

$randnum = rand(1, mysql_num_rows($result));

$randnum = $randnum-1;

for ($x = 0; $x < mysql_num_rows($result); $x++)

{

$entries = mysql_fetch_array($result);

if ($x == $randnum)

{

$winner = $entries['user_id'];

 

 

 

 

And maybe two parts before that but anyway, yeah, somebody needs to be able to read code.

 

I think Ian was trying to say HE DOES KNOW, but couldn't be bothered explaining it to those who are sad enough to care :wink3:

  • Author

Well thats me ZINGED :snore:

 

:cry:

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.