[V0.1] - SteemCasino - Refferal System

in #utopian-io7 years ago (edited)

image.png

Join our Official Discord Server.

You can see our github here.

And the V0.1 pull request here.

Bug Fixes

  • Roulette table would not truncate, and would truncate when a jackpot game would have finished.
    We just have removed this query from endJackpotGame and added it to createGame in sitebot
-       con.query("TRUNCATE roulette", function (err, result) {
-       });

New Features

  • We have removed balance from roulette and jackpot and added it to the navbar (this is on every page of the website, you can see your balance everywhere).

This got removed from roulette.php and jackpot.php.

-               <h5 id="balance" style="margin:0">Loading...</h5><br>

And this got added to the navbar.php.

+           <li class="nav-item">
+               <a id="balance" class="nav-link"></a> 
+           </li>

And the script that updates the balance was added in navbar too

+   function getBalanced() {
+                   $.getJSON( "../src/getbalance.php", function( data ) {
+                   if(data['status'] == 'success') {
+                       $("#balance").text("Balance: " + data['balance'] + " SBD");
+                   }
+               });
+               }
+               
+               getBalanced();
  • Added the current price of your Balance in US$ using CoinMarketCap data.
    We are requesting a json with the current price of SBD from CoinMarketCap and multiplying it with your current balance.
+                       $.getJSON( "https://api.coinmarketcap.com/v1/ticker/steem-dollars/?convert=usd", function( data ) {
+                           var curr = <?php echo $balance;?> * data[0]['price_usd'];
+                           curr = curr.toFixed(2);
+                           $("#underbalanced").text(curr + " US$");
+                       });
  • Added a signup login that redirects you to signup.steemit.com

  • Added a refferal system

Without refferals/reffered

image.png

With reffered

image.png

With Refferals

image.png

Refferal History

image.png

How does the refferal system work?

If you were reffered by someone, who you can set on your profile, he will recive everytime you bet 0.1% of your bet as a reward, if you bet 1 SBD he will recive 0.001 SBD. (This is subjected to change, maybe by adding Refferal Levels)

How did we implement it?

Each time you bet we check if you have a refferal, like we check if you have enough balance, if you do we run this

if($ref) {
                            $noyou = $db->prepare('SELECT * FROM users WHERE username = ?');
                            $noyou->bind_param('s', $ref);
                                    
                            $noyou->execute();
                                        
                            $rt = $noyou->get_result();
                            if($rt->num_rows) {
                                while ($refrow = $rt->fetch_assoc()) {
                                    $refbalance = $refrow['balance'];
                                }
                            }           
                            $refbalance = $refbalance + ($_GET['balanceTop']/1000);
                        
                            $noyou = $db->prepare('UPDATE users SET balance = ? WHERE username = ?');
                            $noyou->bind_param('ds', $refbalance, $ref);
                            $noyou->execute();
                        
                            $transType = 8;
                            
                            $refrew = $_GET['balanceTop']/1000;
                            
                            $noyou = $db->prepare('INSERT INTO history (transType, user1, user2, reward, timestamp) VALUES (?, ?, ?, ?, ?)');
                            $noyou->bind_param('issdi', $transType, $_COOKIE['username'], $ref, $refrew, $timestampedd);
                            
                            $noyou->execute();
                        }



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thanks for the contribution. It has been approved.


Need help? Write a ticket on https://support.utopian.io.
Chat with us on Discord.

[utopian-moderator]

Hey @andreistalker! Thank you for the great work you've done!

We're already looking forward to your next contribution!

Fully Decentralized Rewards

We hope you will take the time to share your expertise and knowledge by rating contributions made by others on Utopian.io to help us reward the best contributions together.

Utopian Witness!

Vote for Utopian Witness! We are made of developers, system administrators, entrepreneurs, artists, content creators, thinkers. We embrace every nationality, mindset and belief.

Want to chat? Join us on Discord https://discord.me/utopian-io

Apologize for the delay, been managing and speaking about Steem at the Steem Creators Conference in Las Vegas, NV all weekend. Expect to be within the the 24-48 hour upvote window in the next 48 hours.

As a friendly reminder, the upvote fee is $0.08 SBD ($0.081 for incognito). Current 300%+ upvote is now $0.24+ SBD.

That being said…

BOOOOOOOOOM!!!

The ground shakes as incredible power lights the sky. The thunder tests the quality of your post and deems it worthy, rewarding it with a 300% upvote, comment and resteem from @thundercurator.

Increase your chances of a 100% upvote and support the project by:

Investors who delegate SP to @thundercurator are entitled to 75% of @thundercurator income after curation. Get on-board early and grow with us!

Coin Marketplace

STEEM 0.23
TRX 0.28
JST 0.042
BTC 104956.85
ETH 3880.98
SBD 3.32