[V0.1] - SteemCasino - Refferal System

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 data-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

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now