Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Releases
lottery remake from revcms
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="DDDDec" data-source="post: 467497" data-attributes="member: 75952"><p>[CODE=php]</p><p>$enable = array(</p><p> "buyLotteryTicket" => true,</p><p> "lottery" => true</p><p>);</p><p></p><p>function randomChance($min, $max) {</p><p> Return random_int($min, $max) ;</p><p>}</p><p></p><p>public function randomLotteryNumber() {</p><p> $randomNum1 = randomChance(0, 9);</p><p> $randomNum2 = randomChance(0, 9);</p><p> $randomNum3 = randomChance(0, 9);</p><p> $randomNum4 = randomChance(0, 9);</p><p> $lotteryNumber = $randomNum1.$randomNum2.$randomNum3.$randomNum4;</p><p> return $lotteryNumber;</p><p> }</p><p></p><p> public function lottery() {</p><p> global $db, $enable;</p><p> if ($enable['lottery'] == true) {</p><p> if (isset($_POST['lottery'])) {</p><p> $getLottery = $db->prepare("</p><p> SELECT * FROM cms_lottery WHERE active = '1'</p><p> ");</p><p> $getLottery->execute();</p><p> if ($getLottery->RowCount() > 0) {</p><p> $winningTicketNumbers = $getLottery->fetch();</p><p> $getLotteryTickets = $db->prepare("SELECT * FROM cms_lottery_tickets WHERE ticket_number = :winninglotteryticket");</p><p> $getLotteryTickets->bindParam(":winninglotteryticket", $winningTicketNumbers['lottery_ticket']);</p><p> $getLotteryTickets->execute();</p><p> if ($getLotteryTickets->RowCount() > 0) {</p><p> while ($winners = $getLotteryTickets->fetch()) {</p><p> $giftPrize = $db->prepare("UPDATE users SET {$winningTicketNumbers['type']} = coins + {$winningTicketNumbers['amount']} WHERE id = :user_id");</p><p> $giftPrize->bindParam(":user_id", $winners['user_id']);</p><p> $giftPrize->execute();</p><p> }</p><p> $deleteWinningTicket = $db->prepare("DELETE from cms_lottery WHERE id = :winninglotteryticket");</p><p> $deleteWinningTicket->bindParam(":winninglotteryticket", $winningTicketNumbers['id']);</p><p> $deleteWinningTicket->execute();</p><p> $deleteOldTickets = $db->prepare("TRUNCATE TABLE cms_lottery_tickets");</p><p> $deleteOldTickets->execute();</p><p> } else {</p><p> echo "No tickets were bought this week";</p><p> }</p><p> }</p><p> }</p><p> }</p><p> }</p><p></p><p> public function buyLotteryTicket() {</p><p> global $db, $enable;</p><p> if ($enable['buyLotteryTicket'] == true) {</p><p> if (isset($_POST['buyLotteryTicket'])) {</p><p> if (!empty($_POST['num1']) && $_POST['num1'] < 10 && ctype_digit($_POST['num1'])) {</p><p> if (!empty($_POST['num2']) && $_POST['num2'] < 10 && ctype_digit($_POST['num2'])) {</p><p> if (!empty($_POST['num3']) && $_POST['num3'] < 10 && ctype_digit($_POST['num3'])) {</p><p> if (!empty($_POST['num4']) && $_POST['num4'] < 10 && ctype_digit($_POST['num4'])) {</p><p> $lotteryTicket = $_POST['num1'].$_POST['num2'].$_POST['num3'].$_POST['num4'];</p><p> $date = 123;</p><p> $getLotteryTicket = $db->prepare("</p><p> INSERT INTO cms_lottery_tickets (user_id, ticket_number, buy_date) VALUES (:user_id, :ticket_number, :buy_date)</p><p> ");</p><p> $getLotteryTicket->bindParam(":user_id", $_SESSION['id']);</p><p> $getLotteryTicket->bindParam(":ticket_number", $lotteryTicket);</p><p> $getLotteryTicket->bindParam(":buy_date", $date);</p><p> $getLotteryTicket->execute();</p><p> } else {</p><p> echo "Something wrong with number picker field 4";</p><p> }</p><p> } else {</p><p> echo "Something wrong with number picker field 3";</p><p> }</p><p> } else {</p><p> echo "Something wrong with number picker field 2";</p><p> }</p><p> } else {</p><p> echo "Something wrong with number picker field 1";</p><p> } </p><p> }</p><p> }</p><p> }[/CODE]</p><p></p><p>[CODE=html]<form method='POST'></p><p><input name="num1" type="number" min="0" max="9" placeholder="0-9"></input></p><p><input name="num2" type="number" min="0" max="9" placeholder="0-9"></input></p><p><input name="num3" type="number" min="0" max="9" placeholder="0-9"></input></p><p><input name="num4" type="number" min="0" max="9" placeholder="0-9"></input></p><p><button type="submit" name="buyLotteryTicket">buy ticket</button></p><p></form></p><p></p><p><form method="POST"></p><p><button name="lottery" type="submit">run the lottery</button></p><p></form>[/CODE]</p><p></p><p>lottery sql:</p><p>[URL unfurl="true"]https://mega.nz/file/rJlD1QQT#ECmDgT7mGeHNJa33EhToToagi3Gqsk8_KpiplP8tVd8[/URL]</p><p></p><p>tickets sql:</p><p>[URL unfurl="true"]https://mega.nz/file/KFlFEAxQ#B-xkkEM6fJsg9K8F40BA70jC8lGFAB7iS2N5LA4ItpU[/URL]</p><p></p><p>i couldnt be arsed to sort the dates out do it yourself</p></blockquote><p></p>
[QUOTE="DDDDec, post: 467497, member: 75952"] [CODE=php] $enable = array( "buyLotteryTicket" => true, "lottery" => true ); function randomChance($min, $max) { Return random_int($min, $max) ; } public function randomLotteryNumber() { $randomNum1 = randomChance(0, 9); $randomNum2 = randomChance(0, 9); $randomNum3 = randomChance(0, 9); $randomNum4 = randomChance(0, 9); $lotteryNumber = $randomNum1.$randomNum2.$randomNum3.$randomNum4; return $lotteryNumber; } public function lottery() { global $db, $enable; if ($enable['lottery'] == true) { if (isset($_POST['lottery'])) { $getLottery = $db->prepare(" SELECT * FROM cms_lottery WHERE active = '1' "); $getLottery->execute(); if ($getLottery->RowCount() > 0) { $winningTicketNumbers = $getLottery->fetch(); $getLotteryTickets = $db->prepare("SELECT * FROM cms_lottery_tickets WHERE ticket_number = :winninglotteryticket"); $getLotteryTickets->bindParam(":winninglotteryticket", $winningTicketNumbers['lottery_ticket']); $getLotteryTickets->execute(); if ($getLotteryTickets->RowCount() > 0) { while ($winners = $getLotteryTickets->fetch()) { $giftPrize = $db->prepare("UPDATE users SET {$winningTicketNumbers['type']} = coins + {$winningTicketNumbers['amount']} WHERE id = :user_id"); $giftPrize->bindParam(":user_id", $winners['user_id']); $giftPrize->execute(); } $deleteWinningTicket = $db->prepare("DELETE from cms_lottery WHERE id = :winninglotteryticket"); $deleteWinningTicket->bindParam(":winninglotteryticket", $winningTicketNumbers['id']); $deleteWinningTicket->execute(); $deleteOldTickets = $db->prepare("TRUNCATE TABLE cms_lottery_tickets"); $deleteOldTickets->execute(); } else { echo "No tickets were bought this week"; } } } } } public function buyLotteryTicket() { global $db, $enable; if ($enable['buyLotteryTicket'] == true) { if (isset($_POST['buyLotteryTicket'])) { if (!empty($_POST['num1']) && $_POST['num1'] < 10 && ctype_digit($_POST['num1'])) { if (!empty($_POST['num2']) && $_POST['num2'] < 10 && ctype_digit($_POST['num2'])) { if (!empty($_POST['num3']) && $_POST['num3'] < 10 && ctype_digit($_POST['num3'])) { if (!empty($_POST['num4']) && $_POST['num4'] < 10 && ctype_digit($_POST['num4'])) { $lotteryTicket = $_POST['num1'].$_POST['num2'].$_POST['num3'].$_POST['num4']; $date = 123; $getLotteryTicket = $db->prepare(" INSERT INTO cms_lottery_tickets (user_id, ticket_number, buy_date) VALUES (:user_id, :ticket_number, :buy_date) "); $getLotteryTicket->bindParam(":user_id", $_SESSION['id']); $getLotteryTicket->bindParam(":ticket_number", $lotteryTicket); $getLotteryTicket->bindParam(":buy_date", $date); $getLotteryTicket->execute(); } else { echo "Something wrong with number picker field 4"; } } else { echo "Something wrong with number picker field 3"; } } else { echo "Something wrong with number picker field 2"; } } else { echo "Something wrong with number picker field 1"; } } } }[/CODE] [CODE=html]<form method='POST'> <input name="num1" type="number" min="0" max="9" placeholder="0-9"></input> <input name="num2" type="number" min="0" max="9" placeholder="0-9"></input> <input name="num3" type="number" min="0" max="9" placeholder="0-9"></input> <input name="num4" type="number" min="0" max="9" placeholder="0-9"></input> <button type="submit" name="buyLotteryTicket">buy ticket</button> </form> <form method="POST"> <button name="lottery" type="submit">run the lottery</button> </form>[/CODE] lottery sql: [URL unfurl="true"]https://mega.nz/file/rJlD1QQT#ECmDgT7mGeHNJa33EhToToagi3Gqsk8_KpiplP8tVd8[/URL] tickets sql: [URL unfurl="true"]https://mega.nz/file/KFlFEAxQ#B-xkkEM6fJsg9K8F40BA70jC8lGFAB7iS2N5LA4ItpU[/URL] i couldnt be arsed to sort the dates out do it yourself [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
lottery remake from revcms
Top