Jump to content
MakeWebGames

AnonymousUser

Members
  • Posts

    218
  • Joined

  • Last visited

Everything posted by AnonymousUser

  1. lol i just used whatever was already there, thanks for the constructive criticism :D
  2. ohh lol forgot to tell you i did change the sql for that code just because my money one is using the original sql just change chance to tchance CREATE TABLE `tchance` ( `logID` int( 20 ) NOT NULL AUTO_INCREMENT , `userID` int( 11 ) NOT NULL default '0', `amount` int( 11 ) NOT NULL default '0', `active` tinyint( 1 ) NOT NULL default '0', PRIMARY KEY ( `logID` ) ) ENGINE = MYISAM DEFAULT CHARSET = latin1;
  3. thanks :D sorry it took so long i've been quite busy with other projects
  4. lol okay was just thinking of how you would be able to support more players with all that lag just from a small amount of people
  5. here you go guys! this one's set for crystals but you know how to edit lol if you dont then you shouldnt own a game in my opinion   <?php include_once "globals.php" $minbet=1; $maxg=5; echo "<big>50 / 50 Crystals Game</big><br><br>"; function add_game() { global $ir,$c,$userid, $db, $minbet, $maxg; if(!isset($_POST['amt'])) { echo "<big>Adding a game</big><br><br> <form action='C5050.php?add=1' method='post'> Amount of Crystals:<input type='text' name='amt' size=10 maxlength=10><br> <br><input type='submit' value='Add!'></form><br>($maxg games max per user)<br><br><a href='C5050.php'>Back</a>"; } else { $_POST['amt'] = abs((int) $_POST['amt']); if($_POST['amt'] < $minbet){echo "The minimum bet is $minbet<br><br><a href='C5050.php?add=1'>Back</a>";exit;} $theckcount=mysql_query("SELECT logID FROM tchance WHERE userID={$ir['userid']} and active=1"); if(mysql_num_rows($theckcount) > ($maxg-1)){echo "There is a maximum of $maxg games per user.<br><br><a href='C5050.php'>Back</a>";exit;} if($ir['crystals'] < $_POST['amt']){echo "You cannot afford that amount.<br><br><a href='C5050.php'>Back</a>";exit;} mysql_query("UPDATE users SET crystals = crystals - {$_POST['amt']} WHERE userid = {$ir['userid']}"); $ir['crystals']=$ir['crystals'] - $_POST['amt']; mysql_query("INSERT INTO tchance VALUES ('', {$ir['userid']}, {$_POST['amt']}, 1)"); echo "Your game has been set. Good Luck.<br><br><a href='C5050.php'>Back</a>"; } } function view_games() { global $ir,$c,$userid, $db, $maxg; $q=mysql_query("SELECT t.*, u.username FROM tchance t left join users u on u.userid = t.userID WHERE t.active = 1 ORDER BY t.logID ASC"); echo "<a href='C5050.php?add=1'>Add Game</a><br><br>Table of users awaiting a challenge<br><br><table width='75%' border='1'><tr background='header.jpg'><th>User</th><th>Cost</th><th>Prize</th><th>Challenge</th><th>Cancel</th></tr>"; if(mysql_num_rows($q) < 1){echo "<tr background='images/background.gif'><td colspan=5>There are currently no challenges</td></tr>";} while($r=mysql_fetch_array($q)) { echo "<tr background='images/background.gif'><td align='center'><a href='viewuser.php?u={$r['userID']}'>{$r['username']}</a> [{$r['userID']}]</td><td align='center'>{$r['amount']} Crystals</td><td align='Center'>".number_format(($r['amount'])*2)." Crystals</td><td align='center'><a href='C5050.php?chal={$r['logID']}'>Challenge</a></td><td align='center'>"; if($ir['userid']==$r['userID']){echo "<a href='C5050.php?cancel={$r['logID']}'>Cancel</a>";} echo "</td></tr>"; } echo "</table>"; } function dogame() { global $ir,$c,$userid, $db; $_GET['chal'] = abs((int) $_GET['chal']); $q=mysql_query("SELECT t.*, u.username from tchance t LEFT JOIN users u ON t.userID = u.userid Where t.logID={$_GET['chal']} AND t.active = 1 LIMIT 1"); if(mysql_num_rows($q) > 0) { $r=mysql_fetch_array($q); if($ir['crystals'] < $r['amount']){echo "You cannot afford the challenge amount.<br><br><a href='C5050.php'>Back</a>";exit;} if($ir['userid'] == $r['userID']){echo "You cannot accept your own challenge.<br><br><a href='C5050.php'>Back</a>";exit;} if(rand(1,2) == 1) { $winner=$r['userID']; $loser=$ir['userid']; $winnername=$r['username']; $losername=$ir['username']; $tstring="Sorry, you Lost. Better luck next time.<br><br><a href='C5050.php'>Back</a>"; mysql_query("UPDATE users SET crystals = crystals - {$r['amount']} WHERE userid={$ir['userid']}"); mysql_query("UPDATE users SET crystals = crystals + ({$r['amount']} * 2) WHERE userid={$r['userID']}"); } else { $winner=$ir['userid']; $loser=$r['userID']; $winnername=$ir['username']; $losername=$r['username']; $tstring="You Won! Congratulations! You Won ".number_format(($r['amount']) * 2)." Crystals. <br><br><a href='C5050.php'>Back</a>"; mysql_query("UPDATE users SET crystals = crystals + {$r['amount']} WHERE userid={$ir['userid']}"); } event_add($winner, "You Won the 50/50 Crystals against <a href='viewuser.php?u={$loser}'>{$losername}</a> and collected ".number_format(($r['amount']) * 2)." Crystals.", $c); event_add($loser, "You Lost the 50/50 Crystals against <a href='viewuser.php?u={$winner}'>{$winnername}</a>.", $c); mysql_query("UPDATE tchance SET active = 0 WHERE logID={$_GET['chal']}"); echo $tstring; } else { echo "This game has either been cancelled or someone played before you got the 5050.<br><br><a href='C5050.php'>Back</a>"; exit; } } function cancel() { global $ir,$c,$userid, $db; $_GET['cancel'] = abs((int) $_GET['cancel']); $q=mysql_query("SELECT * from tchance where logID={$_GET['cancel']} AND userID=$userid AND active = 1"); if(mysql_num_rows($q) > 0) { $r=mysql_fetch_array($q); mysql_query("UPDATE users SET crystals = crystals + {$r['amount']} WHERE userid = {$ir['userid']}"); $ir['crystals']=$ir['crystals'] + $r['amount']; mysql_query("UPDATE tchance SET active = -1 WHERE logID = {$_GET['cancel']}"); echo "The game has been cancelled, and your Crystals have been returned.<br><br><a href='C5050.php'>Back</a>"; } else { echo "This game has already been canceled, does not exist, or someone already played.<br><br><a href='C5050.php'>Back</a>"; } } if(isset($_GET['cancel'])){cancel();} elseif(isset($_GET['chal'])){dogame();} elseif(isset($_GET['add'])){add_game();} else{view_games();} $h->endpage(); ?>
  6. FIND A BETTER SERVER lol its so damn laggy in the beginning i didnt want to go any further :D
  7. got the images or u just want us to see [ X ]
  8. lol my thoughts exactly on the $password DJK :p
  9. hey heres a plan lol FIX IT :D why should someone else have to do the work just for you to be lazy and make this an opportunity to learn how to fix it...
  10. my mistake looks like ill keep working lol
  11. C5050.php (so far)   <?php // BAH - isomerizer.com/ require_once("globals.php"); class chance extends headers { public $error = array(); public $minbet = 10; public $maxbet = 100000; public $maxgames = 5; public function _back() { echo ' <br /> <a href="C5050.php">Back</a>'; } public function _errors($error) { if (!empty($error)) { echo'The following errors occured'; foreach ($error as $er) { echo ' '. $er; } unset($error); $this->_back(); $this->endpage(); exit; } } public function _fetchUser($col) { $SQL = sprintf("SELECT `". $col ."` FROM `users` WHERE `userid` = %u", $_SESSION['userid']); $exe = mysql_query($SQL); $fetch = mysql_fetch_array($exe); return $fetch[$col]; } public function _add() { if(isset($_POST['submit'])) { if (preg_match("/[^0-9]/i", $_POST['amt'])) { $this->error[] = 'Amount must be numeric'; } if($_POST['amt'] < $this->minbet) { $this->error[] = 'The minimum bet is '. $this->minbet; } $SQL = sprintf("SELECT COUNT(`logID`) amount FROM `pchance` WHERE `userID` = %u AND `active` = 1", $this->_fetchUser('userid')); $exe = mysql_query($SQL); $check = mysql_fetch_array($exe); if($check['amount'] >= $this->maxgames) { $this->error[] = 'There is a maximum of '. $this->maxgames; } if($_POST['amt'] > $this->_fetchUser('crystals')) { $this->error[] = 'You cannot afford that amount.'; } $this->_errors($this->error); $SQL_2 = sprintf("UPDATE `users` SET `crystals` = `crystals` - %u WHERE `userid` = %u", $_POST['amt'], $this->_fetchUser('userid')); mysql_query($SQL_2); $SQL_3 = sprintf("INSERT INTO `pchance` (`logID`, `userID`, `amount`, `active`) VALUES (NULL, %u, %u, 1)", $this->_fetchUser('userid'), $_POST['amt']); mysql_query($SQL_3); echo 'Your game has been set. Good Luck.'; } else { echo 'Adding a game <form action="'.$_SERVER['PHP_SELF'].'?act=add" method="POST"> Crystals: <input type="text" name="amt" size="10" maxlength="10" /> <input type="submit" name="submit" value="Add!"></form> « '. $this->maxgames .' games max per user »'; } } public function _view_games() { $SQL = "SELECT t.* , u.username FROM `pchance` t LEFT JOIN `users` u on u.userid = t.userID WHERE t.active = 1 ORDER BY t.logID ASC"; $exe = mysql_query($SQL); echo '« <a href="'.$_SERVER['PHP_SELF'].'?act=add">Add Game</a> » Table of users awaiting a challenge <table width="75%" border="1"> <tr background="header.jpg"> <td><u>Game ID</u></td> <td><u>User</u></td> <td><u>Amount</u></td> <td><u>Challenge</u></td> <td><u>Cancel</u></td> </tr>'; while($r = mysql_fetch_array($exe)) { echo '<tr background="images/background.gif"> <td>'. $r['logID'] .'</td> <td><a href="viewuser.php?u='.$r['userID'] .'">'. $r['username'] .'</a> ['. $r['userID'] .']</td> <td>'. $r['amount'] .'</td> <td><a href="'.$_SERVER['PHP_SELF'] .'?act=challenge&ID='. urlencode($r['logID']) .'">Challenge</a></td> <td>'; if($this->_fetchUser('userid') == $r['userID']){ echo '<a href="'.$_SERVER['PHP_SELF'] .'?act=cancel&ID='. urlencode($r['logID']) .'">Cancel</a>'; } echo '</td> </tr>'; } echo '</table>'; } public function _challenge() { $SQL = sprintf("SELECT t.*, u.username FROM `pchance` t LEFT JOIN `users` u ON t.userID = u.userid WHERE t.logID = %u AND t.active = 1 LIMIT 1", $_GET['ID']); $exe = mysql_query($SQL); $fetch = mysql_fetch_array($exe); if(!empty($fetch['logID'])) { if($fetch['amount'] > $this->_fetchUser('crystals')){ $this->error[] = 'You cannot afford the challenge amount.'; } if($this->_fetchUser('userid') == $r['userID']){ $this->error[] = 'You cannot accept your own challenge.'; } $this->_errors($this->error); if(mt_rand(1,2) == 1) { $winner = $fetch['userID']; $loser = $this->_fetchUser('userid'); $winnername = $fetch['username']; $losername = $this->_fetchUser('username'); $string = '<font color="red">Sorry, you Lost. Better luck next time.</font>'; $SQL_2 = sprintf("UPDATE `users` SET `crystals` = `crystals` - %u WHERE `userid` = %u", $fetch['amount'], $this->_fetchUser('userid')); $SQL_3 = sprintf("UPDATE `users` SET `crystals` = `crystals` + (%u * 2) WHERE `userid` = %u", $fetch['amount'], $fetch['userID']); mysql_query($SQL_2); mysql_query($SQL_3); } else { $winner = $this->_fetchUser('userid'); $loser = $fetch['userID']; $winnername = $this->_fetchUser('username'); $losername = $fetch['username']; $string = 'You Won! Congratulations! <font color="green"> You Won '. money_formatter($fetch['amount']) .'!</font>'; $SQL_4 = sprintf("UPDATE `users` SET `crystals` = `crystals` + %u WHERE `userid` = %u", $fetch['amount'], $this->_fetchUser('userid')); mysql_query($SQL_4); } event_add($winner, 'The game of '. money_formatter($fetch['amount']) .' challenged by <a href="viewuser.php?u= '. urlencode($this->_fetchUser('userid')) .'">'. $this->_fetchUser('username') .'</a> was won by <a href="viewuser.php?u='.urlencode($winner) .'">'. $winnername .'</a>.', $t); event_add($loser, 'The game of '. money_formatter($fetch['amount']) .' challenged by <a href="viewuser.php?u='.urlencode($this->_fetchUser('userid')) .'">'. $this->_fetchUser('username') .'</a> was won by <a href="viewuser.php?u='.urlencode($winner) .'">'. $winnername .'</a>.', $t); $SQL_5 = sprintf("UPDATE `pchance` SET `active` = 0 WHERE `logID` = %u", $_GET['ID']); mysql_query($SQL_5); echo $string; } else{ echo 'This game has either been cancelled or someone played before you got the 5050.'; } } public function _cancel() { $SQL = sprintf("SELECT `amount` from `chance` where `logID` = %u && `userID` = %u AND `active` = 1", $_GET['ID'], $_SESSION['userid']); $exe = mysql_query($SQL); $fetch = mysql_fetch_array($exe); if(!empty($fetch['amount'])) { $SQL_2 = sprintf("UPDATE `users` SET `crystals` = `crystals` + %u WHERE `userid` = %u", $fetch['amount'], $this->_fetchUser('userid')); $SQL_3 = sprintf("UPDATE `pchance` SET `active` = -1 WHERE `logID` = %u", $_GET['ID']); mysql_query($SQL_2); mysql_query($SQL_3); echo 'The game has been cancelled, and your Crystals have been returned.'; } else { echo 'This game has already been canceled, does not exist, or someone already played.'; } } } $cha = new chance(); echo '<h1>50 / 50 Crystals Game</h1>'; switch($_GET['act']) { case 'cancel': $cha->_cancel(); break; case 'challenge': $cha->_challenge(); break; case 'add': $cha->_add(); break; default: $cha->_view_games(); break; } ?>   M5050.php (so far) Same thing just money instead of crystals...   <?php // BAH - isomerizer.com/ require_once("globals.php"); class chance extends headers { public $error = array(); public $minbet = 100; public $maxbet = 10000000000; public $maxgames = 5; public function _back() { echo ' <br /> <a href="M5050.php">>Back</a>'; } public function _errors($error) { if (!empty($error)) { echo'The following errors occured'; foreach ($error as $er) { echo ' '. $er; } unset($error); $this->_back(); $this->endpage(); exit; } } public function _fetchUser($col) { $SQL = sprintf("SELECT `". $col ."` FROM `users` WHERE `userid` = %u", $_SESSION['userid']); $exe = mysql_query($SQL); $fetch = mysql_fetch_array($exe); return $fetch[$col]; } public function _add() { if(isset($_POST['submit'])) { if (preg_match("/[^0-9]/i", $_POST['amt'])) { $this->error[] = 'Amount must be numeric'; } if($_POST['amt'] < $this->minbet) { $this->error[] = 'The minimum bet is '. $this->minbet; } $SQL = sprintf("SELECT COUNT(`logID`) amount FROM `chance` WHERE `userID` = %u AND `active` = 1", $this->_fetchUser('userid')); $exe = mysql_query($SQL); $check = mysql_fetch_array($exe); if($check['amount'] >= $this->maxgames) { $this->error[] = 'There is a maximum of '. $this->maxgames; } if($_POST['amt'] > $this->_fetchUser('money')) { $this->error[] = 'You cannot afford that amount.'; } $this->_errors($this->error); $SQL_2 = sprintf("UPDATE `users` SET `money` = `money` - %u WHERE `userid` = %u", $_POST['amt'], $this->_fetchUser('userid')); mysql_query($SQL_2); $SQL_3 = sprintf("INSERT INTO `chance` (`logID`, `userID`, `amount`, `active`) VALUES (NULL, %u, %u, 1)", $this->_fetchUser('userid'), $_POST['amt']); mysql_query($SQL_3); echo 'Your game has been set. Good Luck.'; } else { echo 'Adding a game <form action="'.$_SERVER['PHP_SELF'].'?act=add" method="POST"> Cash: <input type="text" name="amt" size="10" maxlength="10" /> <input type="submit" name="submit" value="Add!"></form> « '. $this->maxgames .' games max per user »'; } } public function _view_games() { $SQL = "SELECT t.* , u.username FROM `chance` t LEFT JOIN `users` u on u.userid = t.userID WHERE t.active = 1 ORDER BY t.logID ASC"; $exe = mysql_query($SQL); echo '« <a href="'.$_SERVER['PHP_SELF'].'?act=add">Add Game</a> » Table of users awaiting a challenge <table width="75%" border="1"> <tr background="header.jpg"> <td><u>Game ID</u></td> <td><u>User</u></td> <td><u>Amount</u></td> <td><u>Challenge</u></td> <td><u>Cancel</u></td> </tr>'; while($r = mysql_fetch_array($exe)) { echo '<tr background="images/background.gif"> <td>'. $r['logID'] .'</td> <td><a href="viewuser.php?u='.$r['userID'] .'">'. $r['username'] .'</a> ['. $r['userID'] .']</td> <td>$'.$r['amount'] .'</td> <td><a href="'.$_SERVER['PHP_SELF'] .'?act=challenge&ID='. urlencode($r['logID']) .'">Challenge</a></td> <td>'; if($this->_fetchUser('userid') == $r['userID']){ echo '<a href="'.$_SERVER['PHP_SELF'] .'?act=cancel&ID='. urlencode($r['logID']) .'">Cancel</a>'; } echo '</td> </tr>'; } echo '</table>'; } public function _challenge() { $SQL = sprintf("SELECT t.*, u.username FROM `chance` t LEFT JOIN `users` u ON t.userID = u.userid WHERE t.logID = %u AND t.active = 1 LIMIT 1", $_GET['ID']); $exe = mysql_query($SQL); $fetch = mysql_fetch_array($exe); if(!empty($fetch['logID'])) { if($fetch['amount'] > $this->_fetchUser('money')){ $this->error[] = 'You cannot afford the challenge amount.'; } if($this->_fetchUser('userid') == $r['userID']){ $this->error[] = 'You cannot accept your own challenge.'; } ///if($userid == $r['userID']){ $this->error[] = 'You cannot accept your own challenge.'; } $this->_errors($this->error); if(mt_rand(1,2) == 1) { $winner = $fetch['userID']; $loser = $this->_fetchUser('userid'); $winnername = $fetch['username']; $losername = $this->_fetchUser('username'); $string = '<font color="red">Sorry, you Lost. Better luck next time.</font>'; $SQL_2 = sprintf("UPDATE `users` SET `money` = `money` - %u WHERE `userid` = %u", $fetch['amount'], $this->_fetchUser('userid')); $SQL_3 = sprintf("UPDATE `users` SET `money` = `money` + (%u * 2) WHERE `userid` = %u", $fetch['amount'], $fetch['userID']); mysql_query($SQL_2); mysql_query($SQL_3); } else { $winner = $this->_fetchUser('userid'); $loser = $fetch['userID']; $winnername = $this->_fetchUser('username'); $losername = $fetch['username']; $string = 'You Won! Congratulations! <font color="green"> You Won '. money_formatter($fetch['amount']) .'!</font>'; $SQL_4 = sprintf("UPDATE `users` SET `money` = `money` + %u WHERE `userid` = %u", $fetch['amount'], $this->_fetchUser('userid')); mysql_query($SQL_4); } event_add($winner, 'The game of '. money_formatter($fetch['amount']) .' challenged by <a href="viewuser.php?u= '. urlencode($this->_fetchUser('userid')) .'">'. $this->_fetchUser('username') .'</a> was won by <a href="viewuser.php?u='.urlencode($winner) .'">'. $winnername .'</a>.', $t); event_add($loser, 'The game of '. money_formatter($fetch['amount']) .' challenged by <a href="viewuser.php?u='.urlencode($this->_fetchUser('userid')) .'">'. $this->_fetchUser('username') .'</a> was won by <a href="viewuser.php?u='.urlencode($winner) .'">'. $winnername .'</a>.', $t); $SQL_5 = sprintf("UPDATE `chance` SET `active` = 0 WHERE `logID` = %u", $_GET['ID']); mysql_query($SQL_5); echo $string; } else{ echo 'This game has either been cancelled or someone played before you got the 5050.'; } } public function _cancel() { $SQL = sprintf("SELECT `amount` from `chance` where `logID` = %u && `userID` = %u AND `active` = 1", $_GET['ID'], $_SESSION['userid']); $exe = mysql_query($SQL); $fetch = mysql_fetch_array($exe); if(!empty($fetch['amount'])) { $SQL_2 = sprintf("UPDATE `users` SET `money` = `money` + %u WHERE `userid` = %u", $fetch['amount'], $this->_fetchUser('userid')); $SQL_3 = sprintf("UPDATE `chance` SET `active` = -1 WHERE `logID` = %u", $_GET['ID']); mysql_query($SQL_2); mysql_query($SQL_3); echo 'The game has been cancelled, and your money has been returned.'; } else { echo 'This game has already been canceled, does not exist, or someone already played.'; } } } $cha = new chance(); echo '<h1>50 / 50 money Game</h1>'; switch($_GET['act']) { case 'cancel': $cha->_cancel(); break; case 'challenge': $cha->_challenge(); break; case 'add': $cha->_add(); break; default: $cha->_view_games(); break; } ?>   these are 'functional'
  12. yeah i've been working on the crystals one too ill add once we've figured a way to not bet yourself lol   if($userid == $r['userID']){ $this->error[] = 'You cannot accept your own challenge.'; } didn't work   @ DJK yeah sorry i forgot to update post when you told me ill get it up and running tonight :) BOTH Crystal and Money 5050s will be posted shortly only need to fix the ability to accept own bets :p even though if one accepts there own bet it wont benefit them :p
  13. dang i have been looking for this forever lol i've done some editting for those who haven't upgraded your mccodes lol so here it is all spiffy and error-less far as i know   <?php // BAH - isomerizer.com/ require_once("globals.php"); class chance extends headers { public $error = array(); public $minbet = 1; public $maxbet = 1000; public $maxgames = 10; public function _back() { echo ' <a href="http://javascript<b></b>: history.go(-1)">Back</a>'; } public function _errors($error) { if (!empty($error)) { echo'The following errors occured'; foreach ($error as $er) { echo ' '. $er; } unset($error); $this->_back(); $this->endpage(); exit; } } public function _fetchUser($col) { $SQL = sprintf("SELECT `". $col ."` FROM `users` WHERE `userid` = %u", $_SESSION['userid']); $exe = mysql_query($SQL); $fetch = mysql_fetch_array($exe); return $fetch[$col]; } public function _add() { if(isset($_POST['submit'])) { if (preg_match("/[^0-9]/i", $_POST['amt'])) { $this->error[] = 'Amount must be numeric'; } if($_POST['amt'] < $this->minbet) { $this->error[] = 'The minimum bet is '. $this->minbet; } $SQL = sprintf("SELECT COUNT(`logID`) amount FROM `chance` WHERE `userID` = %u AND `active` = 1", $this->_fetchUser('userid')); $exe = mysql_query($SQL); $check = mysql_fetch_array($exe); if($check['amount'] >= $this->maxgames) { $this->error[] = 'There is a maximum of '. $this->maxgames; } if($_POST['amt'] > $this->_fetchUser('money')) { $this->error[] = 'You cannot afford that amount.'; } $this->_errors($this->error); $SQL_2 = sprintf("UPDATE `users` SET `money` = `money` - %u WHERE `userid` = %u", $_POST['amt'], $this->_fetchUser('userid')); mysql_query($SQL_2); $SQL_3 = sprintf("INSERT INTO `chance` (`logID`, `userID`, `amount`, `active`) VALUES (NULL, %u, %u, 1)", $this->_fetchUser('userid'), $_POST['amt']); mysql_query($SQL_3); echo 'Your game has been set. Good Luck.'; } else { echo 'Adding a game <form action="'.$_SERVER['PHP_SELF'].'?act=add" method="POST"> Cash: <input type="text" name="amt" size="10" maxlength="10" /> <input type="submit" name="submit" value="Add!"></form> « '. $this->maxgames .' games max per user »'; } } public function _view_games() { $SQL = "SELECT t.* , u.username FROM `chance` t LEFT JOIN `users` u on u.userid = t.userID WHERE t.active = 1 ORDER BY t.logID ASC"; $exe = mysql_query($SQL); echo '« <a href="'.$_SERVER['PHP_SELF'].'?act=add">Add Game</a> » Table of users awaiting a challenge <table width="75%"> <tr> <td><u>Game ID</u></td> <td><u>User</u></td> <td><u>Amount</u></td> <td><u>Challenge</u></td> <td><u>Cancel</u></td> </tr>'; while($r = mysql_fetch_array($exe)) { echo '<tr> <td>'. $r['logID'] .'</td> <td><a href="viewuser.php?u='.$r['userID'] .'">'. $r['username'] .'</a> ['. $r['userID'] .']</td> <td>'. $r['amount'] .'</td> <td><a href="'.$_SERVER['PHP_SELF'] .'?act=challenge&ID='. urlencode($r['logID']) .'">Challenge</a></td> <td>'; if($this->_fetchUser('userid') == $r['userID']){ echo '<a href="'.$_SERVER['PHP_SELF'] .'?act=cancel&ID='. urlencode($r['logID']) .'">Cancel</a>'; } echo '</td> </tr>'; } echo '</table>'; } public function _challenge() { $SQL = sprintf("SELECT t.*, u.username FROM `chance` t LEFT JOIN `users` u ON t.userID = u.userid WHERE t.logID = %u AND t.active = 1 LIMIT 1", $_GET['ID']); $exe = mysql_query($SQL); $fetch = mysql_fetch_array($exe); if(!empty($fetch['logID'])) { if($fetch['amount'] > $this->_fetchUser('money')){ $this->error[] = 'You cannot afford the challenge amount.'; } if($this->_fetchUser('userid') == $r['userID']){ $this->error[] = 'You cannot accept your own challenge.'; } $this->_errors($this->error); if(mt_rand(1,2) == 1) { $winner = $fetch['userID']; $loser = $this->_fetchUser('userid'); $winnername = $fetch['username']; $losername = $this->_fetchUser('username'); $string = '<font color="red">Sorry, you Lost. Better luck next time.</font>'; $SQL_2 = sprintf("UPDATE `users` SET `money` = `money` - %u WHERE `userid` = %u", $fetch['amount'], $this->_fetchUser('userid')); $SQL_3 = sprintf("UPDATE `users` SET `money` = `money` + (%u * 2) WHERE `userid` = %u", $fetch['amount'], $fetch['userID']); mysql_query($SQL_2); mysql_query($SQL_3); } else { $winner = $this->_fetchUser('userid'); $loser = $fetch['userID']; $winnername = $this->_fetchUser('username'); $losername = $fetch['username']; $string = 'You Won! Congratulations! <font color="green"> You Won '. money_formatter($fetch['amount']) .'!</font>'; $SQL_4 = sprintf("UPDATE `users` SET `money` = `money` + %u WHERE `userid` = %u", $fetch['amount'], $this->_fetchUser('userid')); mysql_query($SQL_4); } event_add($winner, 'The game of '. money_formatter($fetch['amount']) .' challenged by <a href="viewuser.php?u= '. urlencode($this->_fetchUser('userid')) .'">'. $this->_fetchUser('username') .'</a> was won by <a href="viewuser.php?u='.urlencode($winner) .'">'. $winnername .'</a>.', $t); event_add($loser, 'The game of '. money_formatter($fetch['amount']) .' challenged by <a href="viewuser.php?u='.urlencode($this->_fetchUser('userid')) .'">'. $this->_fetchUser('username') .'</a> was won by <a href="viewuser.php?u='.urlencode($winner) .'">'. $winnername .'</a>.', $t); $SQL_5 = sprintf("UPDATE `chance` SET `active` = 0 WHERE `logID` = %u", $_GET['ID']); mysql_query($SQL_5); echo $string; } else{ echo 'This game has either been cancelled or someone played before you got the 5050.'; } } public function _cancel() { $SQL = sprintf("SELECT `amount` from `chance` where `logID` = %u AND `active` = 1", $_GET['ID']); $exe = mysql_query($SQL); $fetch = mysql_fetch_array($exe); if(!empty($fetch['amount'])) { $SQL_2 = sprintf("UPDATE `users` SET `money` = `money` + %u WHERE `userid` = %u", $fetch['amount'], $this->_fetchUser('userid')); $SQL_3 = sprintf("UPDATE `chance` SET `active` = -1 WHERE `logID` = %u", $_GET['ID']); mysql_query($SQL_2); mysql_query($SQL_3); echo 'The game has been cancelled, and your money has been returned.'; } else { echo 'This game has already been canceled, does not exist, or someone already played.'; } } } $cha = new chance(); echo '<h1>50 / 50 money Game</h1>'; switch($_GET['act']) { case 'cancel': $cha->_cancel(); break; case 'challenge': $cha->_challenge(); break; case 'add': $cha->_add(); break; default: $cha->_view_games(); break; } ?>
  14. yeah i havent seen all the features just thought i would check it out before i went to bed looks like im gonna have to play with it a little more when i awaken from my slumber lol all in all though it looks great so far!
  15. no worries lol thanks DJK as always ya pull through :)
  16. but it looks like its updating the users donator bank to where if they have 'max interest' its setting there total bank amount to the max interest instead of giving it to them lol   $db->query(" UPDATE `users` SET `donatormoney` = IF(`vipdays` <= 0, LEAST(`donatormoney` + (`donatormoney` / 100) * 0.2, 500000000), LEAST(`donatormoney` + (`donatormoney` / 100) * 0.6, 500000000)) WHERE `donatormoney` AND `donatordays`");
  17. actually that worked haunted! lol thanks a bunch... +1 for u and +1 for sniko for trying :) thanks again guys now i just gotta add to my donatorbank to say how much interest they're getting :p
  18. @haunted i though we established my version dont have the 'least' function @sniko unfortunately no luck
  19. QUERY ERROR: FUNCTION ****_****.LEAST does not exist heres what im using for the code.... $db->query("UPDATE `users` SET `donatormoney` = LEAST (`donatormoney`+ (`donatormoney` / 100) * 0.2, 500000000) WHERE (`bankmoney` > 0) AND (`donatordays` > 0) AND (`vipdays` <= 0)"); $db->query("UPDATE `users` SET `donatormoney` = LEAST ( `donatormoney`+(`donatormoney` / 100) * 0.6, 1500000000) WHERE (`bankmoney` > 0) AND (`donatordays` > 0) AND (`vipdays` > 0)");
  20. cool sniko ill give it a try and see how it goes :)
  21. I want to set up my Donator Bank to interest users based upon ones donationdays and vipdays. Players who have just ddays and no vip will max at 2% along with only a 500m max interest and vip will be double if they have both vip and ddays then it should be maxed at 6% and maxed interest is 1.5b?? ie. users with 1 donator days get .05 percent interest/vip gain .1 interest per vip day
  22. wouldnt one just have an airport for the "main" areas and then add ability to drive to those places in that "main" place like states and cities... i think they have this somewhere...
  23. thanks seker... yeah what he said lol
  24. IPN dont work on it... i've been trying to contact you via mail here and on msn... But you don't seem to contact me back... I didn't want to make this post but it's been far too long since i've attempted to contact you... READ YOUR MAIL ARSON!!
×
×
  • Create New...