-
Posts
2,124 -
Joined
-
Last visited
-
Days Won
144
Content Type
Profiles
Forums
Events
Everything posted by Magictallguy
-
AJAX Tutorial System! [PAID WORK]
Magictallguy replied to Razor42's topic in Requests & In Production
Agreed! And no, not "coder", Developer :P -
MagicTallGuy - Mysqli conversion
Magictallguy replied to Zettieee's topic in Collaboration Experiences
Aww, I feel all fuzzy inside now! Thanks guys (and gals, if applicable :P) Well no, I was homeless - story is available on my site 7 years, in fact ;) -
I use gRP[MTG] - does that count?
-
For the record guys, you are more than welcome to ask me directly how to use my stuff ;)
-
Aye, they're available on my site :)
-
What's wrong with the chat I wrote for you?
-
Well.. As far as I'm aware, I haven't died recently - but thanks anyway haha Yes. That's it. I called them "Cronless Crons" because it gets people's attention
-
Based on the previous post (the non-updated one), here: <?php function mail_inbox() { global $ir, $c; ?>Only the last 25 messages sent to you are visible. <hr width='75%' /> <table width="75%" class="table" border="0" cellspacing="1"> <tr> <th width="20%">Sent/From</th> <th width="60%">Subject/Message</th> <th width="20%">Actions</th> </tr><?php $q = mysql_query("SELECT `m`.*, `u`.`userid`, `u`.`username`, `u`.`donatordays`, `u`.`user_level`, `u`.`mail_signature` " . "FROM `mail` AS `m` " . "LEFT JOIN `users` AS `u` ON (`m`.`mail_from` = `u`.`userid`) " . "WHERE `m`.`mail_to` = ".$ir['userid']." AND `m`.`mail_deleted` = 0 " . "ORDER BY `m`.`mail_time` DESC LIMIT 25", $c); if(!mysql_num_rows($q)) echo "<tr><td colspan='2' class='center'>You have no messages</td></tr>"; else while($r = mysql_fetch_assoc($q)) { $d = $r['donatordays'] ? "<img src='/images/donator.gif' alt='Donator: {$r['donatordays']} Days Left' title='Donator: {$r['donatordays']} Days Left' />" : ''; $staff = ($r['user_level'] > 1) ? "<img src='images/staff.gif 'width='10' height='10' alt='Staff' title='Staff' />" : ''; if($r['userid']) { $get = mysql_query("SELECT `imagepath` FROM `user_imageusername` WHERE `userid` = ".$r['userid'], $c); if(mysql_num_rows($get)) $r['username'] = '<img src="images/username/'.$r_image['imagepath'].'" title="'.$r['username'].'" width="110px" height="20px" />'; } if($r['user_level'] == 26) $user = "<span style='color:red;'>".$r['username']."</span>"; else if($r['user_level'] == 2) $user = "<span style='color:gold;'>".$r['username']."</span>"; else if($r['user_level'] == 3) $user = "<span style='color:green;'>".$r['username']."</span>"; else if($r['user_level'] == 4) $user = "<span style='color:pink;'>".$r['username']."</span>"; else if($r['user_level'] == 5) $user = "<span style='color:cyan;'>".$r['username']."</span>"; else if($r['donatordays']) $user = "<span style='color:red;'>".$r['username']."</span>"; else $user = $r['username']; ?><tr> <td><strong>From:</strong><br /><?php echo ($r['userid']) ? "<a href='viewuser.php?u=".$r['userid']."'>".$user."</a> ".$d." ".$staff." [".$r['userid']."]" : ''; ?><br /> <strong>Sent on:</strong> <?php echo date('F j, Y, g:i:s a', $r['mail_time']); ?></td> <td><table class='table' width='100%'> <tr> <td><?php echo stripslashes(htmlspecialchars($r['mail_subject'])); ?></td> </tr> <tr> <td><?php echo nl2br(stripslashes(htmlspecialchars($r['mail_text']))); ?></td> </tr> </table></td> <td><a href='mailbox.php?action=compose&ID=<?php echo $r['userid']; ?>'>Reply</a><br /> <a href='mailbox.php?action=delete&ID=<?php echo $r['mail_id']; ?>'>Delete</a><br /> <a href='preport.php?ID=<?php echo $r['userid']; ?>&report=Fradulent mail: <?php echo urlencode($r['mail_text']); ?>'>Report</a><br /> <a href='mailbox.php?action=addblock&ID=<?php echo $r['userid']; ?>'>Block</a></td> </tr><?php } if($ir['new_mail'] > 0) { mysql_query("UPDATE `mail` SET `mail_read` = 1 WHERE `mail_to` = ".$ir['userid'], $c); mysql_query("UPDATE `users` SET `new_mail` = 0 WHERE `userid` = ".$ir['userid'], $c); } ?></table> <hr width='75%' /> <hr width='90%' /> <table width='50%'> <tr> <td width='50%'><a href='explore.php'>Go Explore</a></td> <td width='50%'><a href='index.php'>Go Home</a></td> </tr> </table> <hr width='90%' /><?php }
-
Conversion to v2 <?php include(__DIR__ . '/globals.php'); if($ir['user_level'] != 2 && $ir['userid'] != 288) { echo "New Roulette being placed"; $h->endpage(); exit(); } $number = rand(1, 36); for($i = 0; $i <= 36; $i++) ${'n' . $i} = abs(@intval($_POST['n' . $i])); $e = abs(intval($_POST['e'])); $o = abs(intval($_POST['o'])); $teen = abs(intval($_POST['teen'])); $teen1 = abs(intval($_POST['teen1'])); $black = abs(intval($_POST['black'])); $red = abs(intval($_POST['red'])); $twelve = abs(intval($_POST['twelve'])); $dtv = abs(intval($_POST['dtv'])); $vtz = abs(intval($_POST['vtz'])); $ek = abs(intval($_POST['ek'])); $tk = abs(intval($_POST['tk'])); $dk = abs(intval($_POST['dk'])); if(!empty($_POST['go4'])) { $sum = array($n0, $n1, $n2, $n3, $n4, $n5, $n6, $n7, $n8, $n9, $n10, $n11, $n12, $n13, $n14, $n15, $n16, $n17, $n18, $n19, $n20, $n21, $n22, $n23, $n24, $n25, $n26, $n27, $n28, $n29, $n30, $n31, $n32, $n33, $n34, $n35, $n36, $e, $o, $teen, $teen1, $black, $red, $twelve, $dtv, $vtz, $ek, $dk, $tk); $bet = array_sum($sum); if($bet > $ir['money']) { echo "<hr width='50%'>Please read the error message.<hr width='50%'><h3>! ERROR</h3>You do not have that much money! <hr width='50%'><a href='index.php'>> Go Home</a><hr width='50%'>"; $h->endpage(); exit; } if($bet > 50000) { echo "<hr width='50%'>Please read the error message.<hr width='50%'><h3>! ERROR</h3>You cannot bet that much money! <hr width='50%'><a href='roulette.php'>> Go Back</a><hr width='50%'>"; $h->endpage(); exit; } if($bet < 1000) { echo "<hr width='50%'>Please read the error message.<hr width='50%'><h3>! ERROR</h3>You need to place more money to the bet! <hr width='50%'><a href='roulette.php'>> Go Back</a><hr width='50%'>"; $h->endpage(); exit; } $nmoney = 0; $nmoney += ${'n' . $number} * 35; $type = ($number % 2 == 0) ? 'even' : 'odd'; $nmoney += ($type == "odd") ? $o * 2 : $e * 2; $nmoney += ($nummer >= 19) ? $high * 2 : $low * 2; $red = $_POST['red']; $black = $_POST['black']; $red22 = array( 1 => 1, 2 => 3, 3 => 5, 4 => 7, 5 => 9, 6 => 12, 7 => 14, 8 => 16, 9 => 18, 10 => 19, 11 => 21, 12 => 23, 13 => 25, 14 => 27, 15 => 30, 16 => 32, 17 => 34, 18 => 36 ); $ii = 1; while($ii < 18) { if($red22[$ii] == $number) { $colour1 = 'red'; $nmoney += $red * 2; } $ii++; } if(!isset($colour1)) { $black1 = array( 1 => 2, 2 => 4, 3 => 6, 4 => 8, 5 => 10, 6 => 13, 7 => 15, 8 => 17, 9 => 20, 10 => 22, 11 => 24, 12 => 26, 13 => 28, 14 => 29, 15 => 31, 16 => 33, 17 => 35 ); $iii = 0; while($iii < 18) { if($black1[$iii] == $number) { $colour1 = 'black'; $nmoney += $black * 2; } $iii++; } } $one218 = array( 0 => 1, 1 => 2, 2 => 3, 3 => 4, 4 => 5, 5 => 6, 6 => 7, 7 => 8, 8 => 9, 9 => 10, 10 => 11, 11 => 12, 12 => 13, 13 => 14, 14 => 15, 15 => 16, 16 => 17, 17 => 18 ); $part = 0; while($part < 17) { if($one218[$part] == $number) $nmoney += $teen * 2; $part++; } $teen236 = array( 0 => 19, 1 => 20, 2 => 21, 3 => 22, 4 => 23, 5 => 24, 6 => 25, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 17 => 36 ); $part1 = 0; while($part1 < 17) { if($teen236[$part1] == $number) $nmoney += $teen1 * 2; $part1++; } $one212 = array( 0 => 1, 1 => 2, 2 => 3, 3 => 4, 4 => 5, 5 => 6, 6 => 7, 7 => 8, 8 => 9, 9 => 10, 10 => 11, 11 => 12 ); $part2 = 0; while($part2 < 11) { if($one212[$part2] == $number) $nmoney += $twelve * 3; $part2++; } $teen2244 = array( 0 => 13, 1 => 14, 2 => 15, 3 => 16, 4 => 17, 5 => 18, 6 => 19, 7 => 20, 8 => 21, 9 => 22, 10 => 23, 11 => 24 ); $part3 = 0; while($part3 < 11) { if($teen2244[$part3] == $number) $nmoney += $dtv * 3; $part3++; } $twen5 = array( 0 => 25, 1 => 26, 2 => 27, 3 => 28, 4 => 29, 5 => 30, 6 => 31, 7 => 32, 8 => 33, 9 => 34, 10 => 35, 11 => 36 ); $part4 = 0; while($part4 < 11) { if($twen5[$part4] == $number) $nmoney += $vtz * 3; $part4++; } $small = array( 0 => 1, 1 => 5, 2 => 9, 3 => 13, 4 => 17, 5 => 21, 6 => 25, 7 => 29, 8 => 33 ); $part5 = 0; while($part5 < 8) { if($small[$part5] == $number) $nmoney += $ek * 3; if($small[$part5] == $number) $nmoney += $tk * 3; if($small[$part5] == $number) $nmoney += $dk * 3; $part5++; } $yougot = $nmoney - $bet; } ?> <table width="75%" border="0" cellspacing="0" cellpadding="0" > <tr> <td>Roulette</td> </tr> </table> <form method="post"> <table width="75%" border="0" cellspacing="0" cellpadding="0" > <tr> <td width="0%" height="48"> </td> <td width="0%"> </td> <td width="0%"> </td> <td width="0%"> </td> <td width="31%"> </td> <td COLSPAN="3" align="center">0 <input name=n0 type=text class="text" ID="n0" size=8 maxlength="10"></td> </tr> <tr> <td height="37"> </td> <td> </td> <td> </td> <td> </td> <td> Max Bet: $50,000 Minimum Bet: $1,000</td> <td width="23%" align="center">1 <input name=n1 type=text class="text" ID="n1" size=8 maxlength="10"></td> <td width="23%" align="center">2 <input name=n2 type=text class="text" ID="n2" size=8 maxlength="10"></td> <td width="23%" align="center">3 <input name=n3 type=text class="text" ID="n3" size=8 maxlength="10"></td> </tr> <tr> <td height="30"> </td> <td> </td> <td> </td> <td> </td> <td align="center"><h2>Money $<?php echo number_format($ir['money']); ?></h2></td> <td align="center">4 <input name=n4 type=text class="text" ID="n4" size=8 maxlength="10"></td> <td align="center">5 <input name=n5 type=text class="text" ID="n5" size=8 maxlength="10"></td> <td align="center">6 <input name=n6 type=text class="text" ID="n6" size=8 maxlength="10"></td> </tr> <tr> <td height="31"> </td> <td> </td> <td> </td> <td> </td> <td align="center"><?php if(!empty($_POST['go4'])) { if($yougot <= 0) { $result = $db->query("UPDATE `users` SET `money` = `money` - " . $bet . " WHERE `userid` = " . $userid); echo "<h3>Wheel Number " . $number . "</h3><font color='#ff000'>You lost $" . number_format($bet) . "</font>"; } elseif($yougot > 0) { $result = $db->query("UPDATE `users` SET `money` = `money` + " . $nmoney . " WHERE `userid` = " . $userid); echo "<h3>Wheel Number " . $number . "</h3><font color='green'>Congratulations you won $" . number_format($nmoney) . "</font>"; } } ?> </td> <td align="center">7 <input name=n7 type=text class="text" ID="n7" size=8 maxlength="10"></td> <td align="center">8 <input name=n8 type=text class="text" ID="n8" size=8 maxlength="10"></td> <td align="center">9 <input name=n9 type=text class="text" ID="n9" size=8 maxlength="10"></td> </tr> <tr> <td height="35"> </td> <td> </td> <td> </td> <td> </td> <td rowspan="12"><img src="images/roulettetable.gif" width="250" height="329"></td> <td align="center">10 <input name=n10 type=text class="text" ID="n10" size=8 maxlength="10"></td> <td align="center">11 <input name=n11 type=text class="text" ID="n11" size=8 maxlength="10"></td> <td align="center">12 <input name=n12 type=text class="text" ID="n12" size=8 maxlength="10"></td> </tr> <tr> <td height="34"> </td> <td> </td> <td> </td> <td> </td> <td align="center">13 <input name=n13 type=text class="text" ID="n13" size=8 maxlength="10"></td> <td align="center">14 <input name=n14 type=text class="text" ID="n14" size=8 maxlength="10"></td> <td align="center">15 <input name=n15 type=text class="text" ID="n15" size=8 maxlength="10"></td> </tr> <tr> <td height="34"> </td> <td COLSPAN="3"> </td> <td align="center">16 <input name=n16 type=text class="text" ID="n16" size=8 maxlength="10"></td> <td align="center">17 <input name=n17 type=text class="text" ID="n17" size=8 maxlength="10"></td> <td align="center">18 <input name=n18 type=text class="text" ID="n18" size=8 maxlength="10"></td> </tr> <tr> <td height="35"> </td> <td COLSPAN="3"> </td> <td align="center">19 <input name=n19 type=text class="text" ID="n19" size=8 maxlength="10"></td> <td align="center">20 <input name=n20 type=text class="text" ID="n20" size=8 maxlength="10"></td> <td align="center">21 <input name=n21 type=text class="text" ID="n21" size=8 maxlength="10"></td> </tr> <tr> <td height="38"> </td> <td> </td> <td> </td> <td> </td> <td align="center">22 <input name=n22 type=text class="text" ID="n22" size=8 maxlength="10"></td> <td align="center">23 <input name=n23 type=text class="text" ID="n23" size=8 maxlength="10"></td> <td align="center">24 <input name=n24 type=text class="text" ID="n24" size=8 maxlength="10"></td> </tr> <tr> <td height="33"> </td> <td> </td> <td> </td> <td> </td> <td align="center">25 <input name=n25 type=text class="text" ID="n25" size=8 maxlength="10"></td> <td align="center">26 <input name=n26 type=text class="text" ID="n26" size=8 maxlength="10"></td> <td align="center">27 <input name=n27 type=text class="text" ID="n27" size=8 maxlength="10"></td> </tr> <tr> <td height="37"> </td> <td> </td> <td> </td> <td> </td> <td align="center">28 <input name=n28 type=text class="text" ID="n28" size=8 maxlength="10"></td> <td align="center">29 <input name=n29 type=text class="text" ID="n29" size=8 maxlength="10"></td> <td align="center">30 <input name=n30 type=text class="text" ID="n30" size=8 maxlength="10"></td> </tr> <tr> <td height="35"> </td> <td> </td> <td> </td> <td> </td> <td align="center">31 <input name=n31 type=text class="text" ID="n31" size=8 maxlength="10"></td> <td align="center">32 <input name=n32 type=text class="text" ID="n32" size=8 maxlength="10"></td> <td align="center">33 <input name=n33 type=text class="text" ID="n33" size=8 maxlength="10"></td> </tr> <tr> <td height="32"> </td> <td> </td> <td> </td> <td> </td> <td align="center">34 <input name=n34 type=text class="text" ID="n34" size=8 maxlength="10"></td> <td align="center">35 <input name=n35 type=text class="text" ID="n35" size=8 maxlength="10"></td> <td align="center">36 <input name=n36 type=text class="text" ID="n36" size=8 maxlength="10"></td> </tr> <tr> <td height="40"> </td> <td> </td> <td> </td> <td> </td> <td align="center">odd <input name=o type=text class="text" SIZE=8 maxlength="10"></td> <td align="center">19- 36 <input name=teen type=text class="text" ID="teen" size=8 maxlength="10"></td> <td align="center">Even <input name=e type=text class="text" SIZE=8 maxlength="10"></td> </tr> <tr> <td height="53"> </td> <td> </td> <td> </td> <td> </td> <td align="center">red <input name=red type=text class="text" SIZE=8 maxlength="10"></td> <td align="center">1 - 18 <input name=teen type=text class="text" ID="teen" SIZE=8 maxlength="10"></td> <td align="center">black <input name=black type=text class="text" SIZE=8 maxlength="10"></td> </tr> <tr> <td height="58"> </td> <td> </td> <td> </td> <td> </td> <td align="center">1 -12 <input name=twelve type=text class="text" ID="twelve" SIZE=8 maxlength="10"></td> <td align="center">13 -24 <input name=dtv type=text class="text" SIZE=8 maxlength="10"></td> <td align="center">25-36 <input name=vtz type=text class="text" SIZE=8 maxlength="10"></td> </tr> <tr> <td height="65"> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center">1st column <input name=ek type=text class="text" SIZE=8 maxlength="10"></td> <td align="center">2nd column <input name=tk type=text class="text" SIZE=8 align="10"></td> <td align="center">3rd column <input name=dk type=text class="text" SIZE=8 maxlength="10"></td> </tr> <tr> <td height="37"> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center"><input name='go4' type=submit class="buttong" value=Bet> <input type=reset class="buttong" value=Reset></td> <td> </td> </tr> </table></form><?php $h->endpage();
-
Of course, I could've done better. But he asked for formatting. I gave him that (and a little bit more) Edit: Revisited the code, managed to shave a further 146 lines off <?php session_start(); require "global_func.php"; if(!isset($_SESSION['loggedin'])) exit(header("Location: login.php")); $userid = $_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is = mysql_query("SELECT `u`.*, `us`.* " . "FROM `users` AS `u` " . "LEFT JOIN `userstats` AS `us` ON (`u`.`userid` = `us`.`userid`) " . "WHERE `u`.`userid` = " . $userid, $c) or die(mysql_error()); $ir = mysql_fetch_array($is); check_level(); $fm = money_formatter($ir['money']); $cm = money_formatter($ir['crystals'], ''); $lv = date('F j, Y, g:i a', $ir['laston']); $h->userdata($ir, $lv, $fm, $cm); $h->menuarea(); if($ir['user_level'] != 2 && $ir['userid'] != 288) { echo "New Roulette being placed"; $h->endpage(); exit(); } $number = rand(1, 36); for($i = 0; $i <= 36; $i++) ${'n' . $i} = abs(@intval($_POST['n' . $i])); $e = abs(intval($_POST['e'])); $o = abs(intval($_POST['o'])); $teen = abs(intval($_POST['teen'])); $teen1 = abs(intval($_POST['teen1'])); $black = abs(intval($_POST['black'])); $red = abs(intval($_POST['red'])); $twelve = abs(intval($_POST['twelve'])); $dtv = abs(intval($_POST['dtv'])); $vtz = abs(intval($_POST['vtz'])); $ek = abs(intval($_POST['ek'])); $tk = abs(intval($_POST['tk'])); $dk = abs(intval($_POST['dk'])); if(!empty($_POST['go4'])) { $sum = array($n0, $n1, $n2, $n3, $n4, $n5, $n6, $n7, $n8, $n9, $n10, $n11, $n12, $n13, $n14, $n15, $n16, $n17, $n18, $n19, $n20, $n21, $n22, $n23, $n24, $n25, $n26, $n27, $n28, $n29, $n30, $n31, $n32, $n33, $n34, $n35, $n36, $e, $o, $teen, $teen1, $black, $red, $twelve, $dtv, $vtz, $ek, $dk, $tk); $bet = array_sum($sum); if($bet > $ir['money']) { echo "<hr width='50%'>Please read the error message.<hr width='50%'><h3>! ERROR</h3>You do not have that much money! <hr width='50%'><a href='index.php'>> Go Home</a><hr width='50%'>"; $h->endpage(); exit; } if($bet > 50000) { echo "<hr width='50%'>Please read the error message.<hr width='50%'><h3>! ERROR</h3>You cannot bet that much money! <hr width='50%'><a href='roulette.php'>> Go Back</a><hr width='50%'>"; $h->endpage(); exit; } if($bet < 1000) { echo "<hr width='50%'>Please read the error message.<hr width='50%'><h3>! ERROR</h3>You need to place more money to the bet! <hr width='50%'><a href='roulette.php'>> Go Back</a><hr width='50%'>"; $h->endpage(); exit; } $nmoney = 0; $nmoney += ${'n' . $number} * 35; $type = ($number % 2 == 0) ? 'even' : 'odd'; $nmoney += ($type == "odd") ? $o * 2 : $e * 2; $nmoney += ($nummer >= 19) ? $high * 2 : $low * 2; $red = $_POST['red']; $black = $_POST['black']; $red22 = array( 1 => 1, 2 => 3, 3 => 5, 4 => 7, 5 => 9, 6 => 12, 7 => 14, 8 => 16, 9 => 18, 10 => 19, 11 => 21, 12 => 23, 13 => 25, 14 => 27, 15 => 30, 16 => 32, 17 => 34, 18 => 36 ); $ii = 1; while($ii < 18) { if($red22[$ii] == $number) { $colour1 = 'red'; $nmoney += $red * 2; } $ii++; } if(!isset($colour1)) { $black1 = array( 1 => 2, 2 => 4, 3 => 6, 4 => 8, 5 => 10, 6 => 13, 7 => 15, 8 => 17, 9 => 20, 10 => 22, 11 => 24, 12 => 26, 13 => 28, 14 => 29, 15 => 31, 16 => 33, 17 => 35 ); $iii = 0; while($iii < 18) { if($black1[$iii] == $number) { $colour1 = 'black'; $nmoney += $black * 2; } $iii++; } } $one218 = array( 0 => 1, 1 => 2, 2 => 3, 3 => 4, 4 => 5, 5 => 6, 6 => 7, 7 => 8, 8 => 9, 9 => 10, 10 => 11, 11 => 12, 12 => 13, 13 => 14, 14 => 15, 15 => 16, 16 => 17, 17 => 18 ); $part = 0; while($part < 17) { if($one218[$part] == $number) $nmoney += $teen * 2; $part++; } $teen236 = array( 0 => 19, 1 => 20, 2 => 21, 3 => 22, 4 => 23, 5 => 24, 6 => 25, 7 => 26, 8 => 27, 9 => 28, 10 => 29, 11 => 30, 12 => 31, 13 => 32, 14 => 33, 15 => 34, 16 => 35, 17 => 36 ); $part1 = 0; while($part1 < 17) { if($teen236[$part1] == $number) $nmoney += $teen1 * 2; $part1++; } $one212 = array( 0 => 1, 1 => 2, 2 => 3, 3 => 4, 4 => 5, 5 => 6, 6 => 7, 7 => 8, 8 => 9, 9 => 10, 10 => 11, 11 => 12 ); $part2 = 0; while($part2 < 11) { if($one212[$part2] == $number) $nmoney += $twelve * 3; $part2++; } $teen2244 = array( 0 => 13, 1 => 14, 2 => 15, 3 => 16, 4 => 17, 5 => 18, 6 => 19, 7 => 20, 8 => 21, 9 => 22, 10 => 23, 11 => 24 ); $part3 = 0; while($part3 < 11) { if($teen2244[$part3] == $number) $nmoney += $dtv * 3; $part3++; } $twen5 = array( 0 => 25, 1 => 26, 2 => 27, 3 => 28, 4 => 29, 5 => 30, 6 => 31, 7 => 32, 8 => 33, 9 => 34, 10 => 35, 11 => 36 ); $part4 = 0; while($part4 < 11) { if($twen5[$part4] == $number) $nmoney += $vtz * 3; $part4++; } $small = array( 0 => 1, 1 => 5, 2 => 9, 3 => 13, 4 => 17, 5 => 21, 6 => 25, 7 => 29, 8 => 33 ); $part5 = 0; while($part5 < 8) { if($small[$part5] == $number) $nmoney += $ek * 3; if($small[$part5] == $number) $nmoney += $tk * 3; if($small[$part5] == $number) $nmoney += $dk * 3; $part5++; } $yougot = $nmoney - $bet; } ?> <table width="75%" border="0" cellspacing="0" cellpadding="0" > <tr> <td>Roulette</td> </tr> </table> <form method="post"> <table width="75%" border="0" cellspacing="0" cellpadding="0" > <tr> <td width="0%" height="48"> </td> <td width="0%"> </td> <td width="0%"> </td> <td width="0%"> </td> <td width="31%"> </td> <td COLSPAN="3" align="center">0 <input name=n0 type=text class="text" ID="n0" size=8 maxlength="10"></td> </tr> <tr> <td height="37"> </td> <td> </td> <td> </td> <td> </td> <td> Max Bet: $50,000 Minimum Bet: $1,000</td> <td width="23%" align="center">1 <input name=n1 type=text class="text" ID="n1" size=8 maxlength="10"></td> <td width="23%" align="center">2 <input name=n2 type=text class="text" ID="n2" size=8 maxlength="10"></td> <td width="23%" align="center">3 <input name=n3 type=text class="text" ID="n3" size=8 maxlength="10"></td> </tr> <tr> <td height="30"> </td> <td> </td> <td> </td> <td> </td> <td align="center"><h2>Money $<?php echo number_format($ir['money']); ?></h2></td> <td align="center">4 <input name=n4 type=text class="text" ID="n4" size=8 maxlength="10"></td> <td align="center">5 <input name=n5 type=text class="text" ID="n5" size=8 maxlength="10"></td> <td align="center">6 <input name=n6 type=text class="text" ID="n6" size=8 maxlength="10"></td> </tr> <tr> <td height="31"> </td> <td> </td> <td> </td> <td> </td> <td align="center"><?php if(!empty($_POST['go4'])) { if($yougot <= 0) { $result = mysql_query("UPDATE `users` SET `money` = `money` - " . $bet . " WHERE `userid` = " . $userid); echo "<h3>Wheel Number " . $number . "</h3><font color='#ff000'>You lost $" . number_format($bet) . "</font>"; } elseif($yougot > 0) { $result = mysql_query("UPDATE `users` SET `money` = `money` + " . $nmoney . " WHERE `userid` = " . $userid); echo "<h3>Wheel Number " . $number . "</h3><font color='green'>Congratulations you won $" . number_format($nmoney) . "</font>"; } } ?> </td> <td align="center">7 <input name=n7 type=text class="text" ID="n7" size=8 maxlength="10"></td> <td align="center">8 <input name=n8 type=text class="text" ID="n8" size=8 maxlength="10"></td> <td align="center">9 <input name=n9 type=text class="text" ID="n9" size=8 maxlength="10"></td> </tr> <tr> <td height="35"> </td> <td> </td> <td> </td> <td> </td> <td rowspan="12"><img src="images/roulettetable.gif" width="250" height="329"></td> <td align="center">10 <input name=n10 type=text class="text" ID="n10" size=8 maxlength="10"></td> <td align="center">11 <input name=n11 type=text class="text" ID="n11" size=8 maxlength="10"></td> <td align="center">12 <input name=n12 type=text class="text" ID="n12" size=8 maxlength="10"></td> </tr> <tr> <td height="34"> </td> <td> </td> <td> </td> <td> </td> <td align="center">13 <input name=n13 type=text class="text" ID="n13" size=8 maxlength="10"></td> <td align="center">14 <input name=n14 type=text class="text" ID="n14" size=8 maxlength="10"></td> <td align="center">15 <input name=n15 type=text class="text" ID="n15" size=8 maxlength="10"></td> </tr> <tr> <td height="34"> </td> <td COLSPAN="3"> </td> <td align="center">16 <input name=n16 type=text class="text" ID="n16" size=8 maxlength="10"></td> <td align="center">17 <input name=n17 type=text class="text" ID="n17" size=8 maxlength="10"></td> <td align="center">18 <input name=n18 type=text class="text" ID="n18" size=8 maxlength="10"></td> </tr> <tr> <td height="35"> </td> <td COLSPAN="3"> </td> <td align="center">19 <input name=n19 type=text class="text" ID="n19" size=8 maxlength="10"></td> <td align="center">20 <input name=n20 type=text class="text" ID="n20" size=8 maxlength="10"></td> <td align="center">21 <input name=n21 type=text class="text" ID="n21" size=8 maxlength="10"></td> </tr> <tr> <td height="38"> </td> <td> </td> <td> </td> <td> </td> <td align="center">22 <input name=n22 type=text class="text" ID="n22" size=8 maxlength="10"></td> <td align="center">23 <input name=n23 type=text class="text" ID="n23" size=8 maxlength="10"></td> <td align="center">24 <input name=n24 type=text class="text" ID="n24" size=8 maxlength="10"></td> </tr> <tr> <td height="33"> </td> <td> </td> <td> </td> <td> </td> <td align="center">25 <input name=n25 type=text class="text" ID="n25" size=8 maxlength="10"></td> <td align="center">26 <input name=n26 type=text class="text" ID="n26" size=8 maxlength="10"></td> <td align="center">27 <input name=n27 type=text class="text" ID="n27" size=8 maxlength="10"></td> </tr> <tr> <td height="37"> </td> <td> </td> <td> </td> <td> </td> <td align="center">28 <input name=n28 type=text class="text" ID="n28" size=8 maxlength="10"></td> <td align="center">29 <input name=n29 type=text class="text" ID="n29" size=8 maxlength="10"></td> <td align="center">30 <input name=n30 type=text class="text" ID="n30" size=8 maxlength="10"></td> </tr> <tr> <td height="35"> </td> <td> </td> <td> </td> <td> </td> <td align="center">31 <input name=n31 type=text class="text" ID="n31" size=8 maxlength="10"></td> <td align="center">32 <input name=n32 type=text class="text" ID="n32" size=8 maxlength="10"></td> <td align="center">33 <input name=n33 type=text class="text" ID="n33" size=8 maxlength="10"></td> </tr> <tr> <td height="32"> </td> <td> </td> <td> </td> <td> </td> <td align="center">34 <input name=n34 type=text class="text" ID="n34" size=8 maxlength="10"></td> <td align="center">35 <input name=n35 type=text class="text" ID="n35" size=8 maxlength="10"></td> <td align="center">36 <input name=n36 type=text class="text" ID="n36" size=8 maxlength="10"></td> </tr> <tr> <td height="40"> </td> <td> </td> <td> </td> <td> </td> <td align="center">odd <input name=o type=text class="text" SIZE=8 maxlength="10"></td> <td align="center">19- 36 <input name=teen type=text class="text" ID="teen" size=8 maxlength="10"></td> <td align="center">Even <input name=e type=text class="text" SIZE=8 maxlength="10"></td> </tr> <tr> <td height="53"> </td> <td> </td> <td> </td> <td> </td> <td align="center">red <input name=red type=text class="text" SIZE=8 maxlength="10"></td> <td align="center">1 - 18 <input name=teen type=text class="text" ID="teen" SIZE=8 maxlength="10"></td> <td align="center">black <input name=black type=text class="text" SIZE=8 maxlength="10"></td> </tr> <tr> <td height="58"> </td> <td> </td> <td> </td> <td> </td> <td align="center">1 -12 <input name=twelve type=text class="text" ID="twelve" SIZE=8 maxlength="10"></td> <td align="center">13 -24 <input name=dtv type=text class="text" SIZE=8 maxlength="10"></td> <td align="center">25-36 <input name=vtz type=text class="text" SIZE=8 maxlength="10"></td> </tr> <tr> <td height="65"> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center">1st column <input name=ek type=text class="text" SIZE=8 maxlength="10"></td> <td align="center">2nd column <input name=tk type=text class="text" SIZE=8 align="10"></td> <td align="center">3rd column <input name=dk type=text class="text" SIZE=8 maxlength="10"></td> </tr> <tr> <td height="37"> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center"><input name='go4' type=submit class="buttong" value=Bet> <input type=reset class="buttong" value=Reset></td> <td> </td> </tr> </table></form><?php $h->endpage();
-
Second one I've done for you now.. Next time, do it yourself! <?php session_start(); require "global_func.php"; if(!isset($_SESSION['loggedin'])) exit(header("Location: login.php")); $userid = $_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is = mysql_query("SELECT `u`.*, `us`.* FROM `users` AS `u` LEFT JOIN `userstats` AS `us` ON `u`.`userid` = `us`.`userid` WHERE `u`.`userid` = ".$userid, $c) or die(mysql_error()); $ir = mysql_fetch_array($is); check_level(); $fm = money_formatter($ir['money']); $cm = money_formatter($ir['crystals'], ''); $lv = date('F j, Y, g:i a', $ir['laston']); $h->userdata($ir, $lv, $fm, $cm); $h->menuarea(); if($ir['user_level'] != 2 && $ir['userid'] != 288) { echo "New Roulette Being Placed"; $h->endpage(); exit(); } $number = rand(1, 36); for($i = 0; $i <= 36; $i++) ${'n'.$i} = abs(@intval($_POST['n'.$i])); $e = abs(intval($_POST['e'])); $o = abs(intval($_POST['o'])); $teen = abs(intval($_POST['teen'])); $teen1 = abs(intval($_POST['teen1'])); $black = abs(intval($_POST['black'])); $red = abs(intval($_POST['red'])); $twelve = abs(intval($_POST['twelve'])); $dtv = abs(intval($_POST['dtv'])); $vtz = abs(intval($_POST['vtz'])); $ek = abs(intval($_POST['ek'])); $tk = abs(intval($_POST['tk'])); $dk = abs(intval($_POST['dk'])); if(!empty($_POST['go4'])) { $bet = $n0 + $n1 + $n2 + $n3 + $n4 + $n5 + $n6 + $n7 + $n8 + $n9 + $n10 + $n11 + $n12 + $n13 + $n14 + $n15 + $n16 + $n17 + $n18 + $n19 + $n20 + $n21 + $n22 + $n23 + $n24 + $n25 + $n26 + $n27 + $n28 + $n29 + $n30 + $n31 + $n32 + $n33 + $n34 + $n35 + $n36 + $e + $o + $teen + $teen1 + $black + $red + $twelve + $dtv + $vtz + $ek + $dk + $tk; $maxbet = 50000; $minbet = 1000; if($bet > $ir['money']) { echo "<hr width='50%'>Please read the error message.<hr width='50%'><h3>! ERROR</h3>You do not have that much money! <hr width='50%'><a href='index.php'>> Go Home</a><hr width='50%'>"; $h->endpage(); exit; } if($bet > $maxbet) { echo "<hr width='50%'>Please read the error message.<hr width='50%'><h3>! ERROR</h3>You cannot bet that much money! <hr width='50%'><a href='roulette.php'>> Go Back</a><hr width='50%'>"; $h->endpage(); exit; } if($bet < $minbet) { echo "<hr width='50%'>Please read the error message.<hr width='50%'><h3>! ERROR</h3>You need to place more money to the bet! <hr width='50%'><a href='roulette.php'>> Go Back</a><hr width='50%'>"; $h->endpage(); exit; } $nmoney = 0; if($number == 1) { $nmoney = $nmoney + $n1 * 35; $on = 1; } elseif($number == 2) { $nmoney = $nmoney + $n2 * 35; $on = 2; } elseif($number == 3) { $nmoney = $nmoney + $n3 * 35; $on = 3; } elseif($number == 4) { $nmoney = $nmoney + $n4 * 35; $on = 4; } elseif($number == 5) { $nmoney = $nmoney + $n5 * 35; $on = 5; } elseif($number == 6) { $nmoney = $nmoney + $n6 * 35; $on = 6; } elseif($number == 7) { $nmoney = $nmoney + $n7 * 35; $on = 7; } elseif($number == 8) { $nmoney = $nmoney + $n8 * 35; $on = 8; } elseif($number == 9) { $nmoney = $nmoney + $n9 * 35; $on = 9; } elseif($number == 10) { $nmoney = $nmoney + $n10 * 35; $on = 10; } elseif($number == 11) { $nmoney = $nmoney + $n11 * 35; $on = 11; } elseif($number == 12) { $nmoney = $nmoney + $n12 * 35; $on = 12; } elseif($number == 13) { $nmoney = $nmoney + $n13 * 35; $on = 13; } elseif($number == 14) { $nmoney = $nmoney + $n14 * 35; $on = 14; } elseif($number == 15) { $nmoney = $nmoney + $n15 * 35; $on = 15; } elseif($number == 16) { $nmoney = $nmoney + $n16 * 35; $on = 16; } elseif($number == 17) { $nmoney = $nmoney + $n17 * 35; $on = 17; } elseif($number == 18) { $nmoney = $nmoney + $n18 * 35; $on = 18; } elseif($number == 19) { $nmoney = $nmoney + $n19 * 35; $on = 19; } elseif($number == 20) { $nmoney = $nmoney + $n20 * 35; $on = 20; } elseif($number == 21) { $nmoney = $nmoney + $n21 * 35; $on = 21; } elseif($number == 22) { $nmoney = $nmoney + $n22 * 35; $on = 22; } elseif($number == 23) { $nmoney = $nmoney + $n23 * 35; $on = 23; } elseif($number == 24) { $nmoney = $nmoney + $n24 * 35; $on = 24; } elseif($number == 25) { $nmoney = $nmoney + $n25 * 35; $on = 25; } elseif($number == 26) { $nmoney = $nmoney + $n26 * 35; $on = 26; } elseif($number == 27) { $nmoney = $nmoney + $n27 * 35; $on = 27; } elseif($number == 28) { $nmoney = $nmoney + $n28 * 35; $on = 28; } elseif($number == 29) { $nmoney = $nmoney + $n29 * 35; $on = 29; } elseif($number == 30) { $nmoney = $nmoney + $n30 * 35; $on = 30; } elseif($number == 31) { $nmoney = $nmoney + $n31 * 35; $on = 31; } elseif($number == 32) { $nmoney = $nmoney + $n32 * 35; $on = 32; } elseif($number == 33) { $nmoney = $nmoney + $n33 * 35; $on = 33; } elseif($number == 34) { $nmoney = $nmoney + $n34 * 35; $on = 34; } elseif($number == 35) { $nmoney = $nmoney + $n35 * 35; $on = 35; } elseif($number == 36) { $nmoney = $nmoney + $n36 * 35; $on = 36; } else { $nmoney = ""; } // odd or even $type = ($number % 2 == 0) ? 'even' : 'odd'; $nmoney = ($type == "odd") ? $nmoney + $o * 2 : $nmoney + $e * 2; $nmoney += ($nummer >= 19) ? $high * 2 : $low * 2; $red = $_POST['red']; $black = $_POST['black']; $red22 = array( "1" => "1", "2" => "3", "3" => "5", "4" => "7", "5" => "9", "6" => "12", "7" => "14", "8" => "16", "9" => "18", "10" => "19", "11" => "21", "12" => "23", "13" => "25", "14" => "27", "15" => "30", "16" => "32", "17" => "34", "18" => "36" ); $ii = 1; while($ii < 18) { if($red22[$ii] == $number) { $colour1 = 'red'; $nmoney = $nmoney + $red * 2; } /////////////////////////////////////////////need to fix columns! $ii++; } if($colour1 == "") { $black1 = array( "1" => "2", "2" => "4", "3" => "6", "4" => "8", "5" => "10", "6" => "13", "7" => "15", "8" => "17", "9" => "20", "10" => "22", "11" => "24", "12" => "26", "13" => "28", "14" => "29", "15" => "31", "16" => "33", "17" => "35" ); $iii = 0; while($iii < 18) { if($black1[$iii] == $number) { $colour1 = 'black'; $nmoney = $nmoney + $black * 2; } $iii++; } } $one218 = array( "0" => "1", "1" => "2", "2" => "3", "3" => "4", "4" => "5", "5" => "6", "6" => "7", "7" => "8", "8" => "9", "9" => "10", "10" => "11", "11" => "12", "12" => "13", "13" => "14", "14" => "15", "15" => "16", "16" => "17", "17" => "18" ); $part = 0; while($part < 17) { if($one218[$part] == $number) $nmoney += $teen * 2; $part++; } $teen236 = array( "0" => "19", "1" => "20", "2" => "21", "3" => "22", "4" => "23", "5" => "24", "6" => "25", "7" => "26", "8" => "27", "9" => "28", "10" => "29", "11" => "30", "12" => "31", "13" => "32", "14" => "33", "15" => "34", "16" => "35", "17" => "36" ); $part1 = 0; while($part1 < 17) { if($teen236[$part1] == $number) $nmoney += $teen1 * 2; $part1++; } $one212 = array( "0" => "1", "1" => "2", "2" => "3", "3" => "4", "4" => "5", "5" => "6", "6" => "7", "7" => "8", "8" => "9", "9" => "10", "10" => "11", "11" => "12" ); $part2 = 0; while($part2 < 11) { if($one212[$part2] == $number) $nmoney += $twelve * 3; $part2++; } $teen2244 = array( "0" => "13", "1" => "14", "2" => "15", "3" => "16", "4" => "17", "5" => "18", "6" => "19", "7" => "20", "8" => "21", "9" => "22", "10" => "23", "11" => "24" ); $part3 = 0; while($part3 < 11) { if($teen2244[$part3] == $number) $nmoney += $dtv * 3; $part3++; } $twen5 = array( "0" => "25", "1" => "26", "2" => "27", "3" => "28", "4" => "29", "5" => "30", "6" => "31", "7" => "32", "8" => "33", "9" => "34", "10" => "35", "11" => "36" ); $part4 = 0; while($part4 < 11) { if($twen5[$part4] == $number) $nmoney += $vtz * 3; $part4++; } $small = array( "0" => "1", "1" => "5", "2" => "9", "3" => "13", "4" => "17", "5" => "21", "6" => "25", "7" => "29", "8" => "33" ); $part5 = 0; while($part5 < 8) { if($small[$part5] == $number) $nmoney += $ek * 3; $part5++; } $small1 = array( "0" => "1", "1" => "5", "2" => "9", "3" => "13", "4" => "17", "5" => "21", "6" => "25", "7" => "29", "8" => "33" ); $part6 = 0; while($part6 < 8) { if($small1[$part6] == $number) $nmoney += $tk * 3; $part6++; } $small2 = array( "0" => "1", "1" => "5", "2" => "9", "3" => "13", "4" => "17", "5" => "21", "6" => "25", "7" => "29", "8" => "33" ); $part7 = 0; while($part7 < 8) { if($small2[$part7] == $number) $nmoney += $dk * 3; $part7++; } $yougot = $nmoney - $bet; } ?> <table width="75%" border="0" cellspacing="0" cellpadding="0" > <tr> <td>Roulette</td> </tr> </table> <form method="post"> <table width="75%" border="0" cellspacing="0" cellpadding="0" > <tr> <td width="0%" height="48"> </td> <td width="0%"> </td> <td width="0%"> </td> <td width="0%"> </td> <td width="31%"> </td> <td COLSPAN="3" align="center">0 <input name=n0 type=text class="text" ID="n0" size=8 maxlength="10"></td> </tr> <tr> <td height="37"> </td> <td> </td> <td> </td> <td> </td> <td> Max Bet: $50,000 Minimum Bet: $1,000</td> <td width="23%" align="center">1 <input name=n1 type=text class="text" ID="n1" size=8 maxlength="10"></td> <td width="23%" align="center">2 <input name=n2 type=text class="text" ID="n2" size=8 maxlength="10"></td> <td width="23%" align="center">3 <input name=n3 type=text class="text" ID="n3" size=8 maxlength="10"></td> </tr> <tr> <td height="30"> </td> <td> </td> <td> </td> <td> </td> <td align="center"><h2>Money $<?php echo number_format($ir['money']); ?></h2></td> <td align="center">4 <input name=n4 type=text class="text" ID="n4" size=8 maxlength="10"></td> <td align="center">5 <input name=n5 type=text class="text" ID="n5" size=8 maxlength="10"></td> <td align="center">6 <input name=n6 type=text class="text" ID="n6" size=8 maxlength="10"></td> </tr> <tr> <td height="31"> </td> <td> </td> <td> </td> <td> </td> <td align="center"><?php if(!empty($_POST['go4'])) { if($yougot <= 0) { echo "<h3>Wheel Number " . $number . "</h3><font color='#ff000'>You lost $" . number_format($bet) . "</font>"; $result = mysql_query("UPDATE `users` SET `money` = `money` - ".$bet." WHERE `userid` = " . $userid); } elseif($yougot > 0) { echo "<h3>Wheel Number " . $number . "</h3><font color='green'>Congratulations you won $" . number_format($nmoney) . "</font>"; $result = mysql_query("UPDATE `users` SET `money` = `money` + ".$nmoney." WHERE `userid` = " . $userid); } } ?> </td> <td align="center">7 <input name=n7 type=text class="text" ID="n7" size=8 maxlength="10"></td> <td align="center">8 <input name=n8 type=text class="text" ID="n8" size=8 maxlength="10"></td> <td align="center">9 <input name=n9 type=text class="text" ID="n9" size=8 maxlength="10"></td> </tr> <tr> <td height="35"> </td> <td> </td> <td> </td> <td> </td> <td rowspan="12"><img src="images/roulettetable.gif" width="250" height="329"></td> <td align="center">10 <input name=n10 type=text class="text" ID="n10" size=8 maxlength="10"></td> <td align="center">11 <input name=n11 type=text class="text" ID="n11" size=8 maxlength="10"></td> <td align="center">12 <input name=n12 type=text class="text" ID="n12" size=8 maxlength="10"></td> </tr> <tr> <td height="34"> </td> <td> </td> <td> </td> <td> </td> <td align="center">13 <input name=n13 type=text class="text" ID="n13" size=8 maxlength="10"></td> <td align="center">14 <input name=n14 type=text class="text" ID="n14" size=8 maxlength="10"></td> <td align="center">15 <input name=n15 type=text class="text" ID="n15" size=8 maxlength="10"></td> </tr> <tr> <td height="34"> </td> <td COLSPAN="3"> </td> <td align="center">16 <input name=n16 type=text class="text" ID="n16" size=8 maxlength="10"></td> <td align="center">17 <input name=n17 type=text class="text" ID="n17" size=8 maxlength="10"></td> <td align="center">18 <input name=n18 type=text class="text" ID="n18" size=8 maxlength="10"></td> </tr> <tr> <td height="35"> </td> <td COLSPAN="3"> </td> <td align="center">19 <input name=n19 type=text class="text" ID="n19" size=8 maxlength="10"></td> <td align="center">20 <input name=n20 type=text class="text" ID="n20" size=8 maxlength="10"></td> <td align="center">21 <input name=n21 type=text class="text" ID="n21" size=8 maxlength="10"></td> </tr> <tr> <td height="38"> </td> <td> </td> <td> </td> <td> </td> <td align="center">22 <input name=n22 type=text class="text" ID="n22" size=8 maxlength="10"></td> <td align="center">23 <input name=n23 type=text class="text" ID="n23" size=8 maxlength="10"></td> <td align="center">24 <input name=n24 type=text class="text" ID="n24" size=8 maxlength="10"></td> </tr> <tr> <td height="33"> </td> <td> </td> <td> </td> <td> </td> <td align="center">25 <input name=n25 type=text class="text" ID="n25" size=8 maxlength="10"></td> <td align="center">26 <input name=n26 type=text class="text" ID="n26" size=8 maxlength="10"></td> <td align="center">27 <input name=n27 type=text class="text" ID="n27" size=8 maxlength="10"></td> </tr> <tr> <td height="37"> </td> <td> </td> <td> </td> <td> </td> <td align="center">28 <input name=n28 type=text class="text" ID="n28" size=8 maxlength="10"></td> <td align="center">29 <input name=n29 type=text class="text" ID="n29" size=8 maxlength="10"></td> <td align="center">30 <input name=n30 type=text class="text" ID="n30" size=8 maxlength="10"></td> </tr> <tr> <td height="35"> </td> <td> </td> <td> </td> <td> </td> <td align="center">31 <input name=n31 type=text class="text" ID="n31" size=8 maxlength="10"></td> <td align="center">32 <input name=n32 type=text class="text" ID="n32" size=8 maxlength="10"></td> <td align="center">33 <input name=n33 type=text class="text" ID="n33" size=8 maxlength="10"></td> </tr> <tr> <td height="32"> </td> <td> </td> <td> </td> <td> </td> <td align="center">34 <input name=n34 type=text class="text" ID="n34" size=8 maxlength="10"></td> <td align="center">35 <input name=n35 type=text class="text" ID="n35" size=8 maxlength="10"></td> <td align="center">36 <input name=n36 type=text class="text" ID="n36" size=8 maxlength="10"></td> </tr> <tr> <td height="40"> </td> <td> </td> <td> </td> <td> </td> <td align="center">odd <input name=o type=text class="text" SIZE=8 maxlength="10"></td> <td align="center">19- 36 <input name=teen type=text class="text" ID="teen" size=8 maxlength="10"></td> <td align="center">Even <input name=e type=text class="text" SIZE=8 maxlength="10"></td> </tr> <tr> <td height="53"> </td> <td> </td> <td> </td> <td> </td> <td align="center">red <input name=red type=text class="text" SIZE=8 maxlength="10"></td> <td align="center">1 - 18 <input name=teen type=text class="text" ID="teen" SIZE=8 maxlength="10"></td> <td align="center">black <input name=black type=text class="text" SIZE=8 maxlength="10"></td> </tr> <tr> <td height="58"> </td> <td> </td> <td> </td> <td> </td> <td align="center">1 -12 <input name=twelve type=text class="text" ID="twelve" SIZE=8 maxlength="10"></td> <td align="center">13 -24 <input name=dtv type=text class="text" SIZE=8 maxlength="10"></td> <td align="center">25-36 <input name=vtz type=text class="text" SIZE=8 maxlength="10"></td> </tr> <tr> <td height="65"> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center">1st column <input name=ek type=text class="text" SIZE=8 maxlength="10"></td> <td align="center">2nd column <input name=tk type=text class="text" SIZE=8 align="10"></td> <td align="center">3rd column <input name=dk type=text class="text" SIZE=8 maxlength="10"></td> </tr> <tr> <td height="37"> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center"><input name='go4' type=submit class="buttong" value=Bet> <input type=reset class="buttong" value=Reset></td> <td> </td> </tr> </table></form> <table width="75%" border="0" cellspacing="0" cellpadding="0" > <tr> <td> </td> </tr> </table> <?php $h->endpage();
-
If memory serves me correctly, the gang forum functions are commented out and you're automatically redirected to the main forums.php with the gang board automagically created
-
Strange.. Have you set the $v2 and $mysqli (if v1) variables?
-
You have posted more than 1 ad, right?
-
Nope, that's just the newspaper itself. The while() loop is what you want to check
-
So be it.. Be sure to update the variables $mysqli and $v2 to fit your system COMPLETELY UNTESTED newspaper.php <?php //Please Keep This Notice //Made By:Iseeyou94056 //Type:Free //Please Do Not Sell This It Is Free //Please Dont Take Credit For This You Did Not Make It // Recoded by Magictallguy $mysqli = false; // Set to true if you're using MySQLi. If $v2 is set to true, $v2 overrides $v2 = false; // Set to true if you're using MC Craps v2. Ignores the $mysqli settings if(!$v2) $set['game_name'] = ucfirst(str_replace(array('http://', 'www.', '.co.uk', '.com', '.net'), '', $_SERVER['HTTP_HOST'])); if($v2) include(__DIR__ . '/globals.php'); else { session_start(); require "global_func.php"; if(!isset($_SESSION['loggedin'])) { header("Location: login.php"); exit; } $userid = $_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; if(!$mysqli) { $is = mysql_query("SELECT `u`.*, `us`.* " . "FROM `users` AS `u` " . "LEFT JOIN `userstats` AS `us` ON (`u`.`userid` = `us`.`userid`) " . "WHERE `u`.`userid` = ".$userid, $c) or die(mysql_error()); if(!mysql_num_rows($is)) { echo "There appears to be an issue with your account"; exit; } $ir = mysql_fetch_array($is); } else { $is = mysqli_query($c, "SELECT `u`.*, `us`.* " . "FROM `users` AS `u` " . "LEFT JOIN `userstats` AS `us` ON (`u`.`userid` = `us`.`userid`) " . "WHERE `u`.`userid` = ".$userid) or exit(mysqli_error($c)); if(!mysqli_num_rows($is)) { echo "There appears to be an issue with your account"; exit; } $ir = mysqli_fetch_array($is, MYSQLI_ASSOC); } check_level(); $h->userdata($ir, date('F j, Y, g:i a',$ir['laston']), money_formatter($ir['money']), number_format($ir['crystals'])); $h->menuarea(); } echo "<h3>Welcome to The ",$set['game_name']," Times</h3>"; if(!$v2) { if(!$mysqli) { $q = mysql_query("SELECT * FROM `newscontent` LIMIT 1", $c) or exit(mysql_error()); $ncontent = mysql_num_rows($q) ? mysql_result($q, 0, 0) : 'No news available'; $q = mysql_query("SELECT * FROM `papercontent` LIMIT 1", $c) or exit(mysql_error()); $content = mysql_num_rows($q) ? mysql_result($q, 0, 0) : 'No news available'; } else { $q = mysqli_query($c, "SELECT * FROM `newscontent` LIMIT 1") or exit(mysqli_error($c)); $ncontent = mysqli_num_rows($q) ? mysqli_result($q) : 'No news available'; $q = mysqli_query($c, "SELECT * FROM `papercontent` LIMIT 1") or exit(mysqli_error($c)); $content = mysqli_num_rows($q) ? mysqli_result($q) : 'No news available'; } } else { $q = $db->query("SELECT * FROM `newscontent` LIMIT 1"); $ncontent = $db->num_rows($q) ? $db->fetch_single($q) : 'No news available'; $q = $db->query("SELECT * FROM `papercontent` LIMIT 1"); $content = $db->num_rows($q) ? $db->fetch_single($q) : 'No news available'; } ?><table width='90%' border='0' cellspacing='0' cellpadding='0' bgcolor='#ffffff'> <tr align='center'> <td><a href='halloffame.php'>Hall Of Fame</a><hr/></td> <td><a href='hallofshame.php'>Hall OF Shame</a><hr/></td> <td><a href='games.php'>Arcade</a><hr/></td> </tr> <tr> <th height='1' align='center' valign='top'>Sponsors</th> <td width='60%' height='1%' align='center' valign='top'><?php echo $set['game_name']; ?> Game News</td> <td width='20%' height='1%' align='center' valign='top'><?php echo $set['game_name']; ?> Game Updates</td> </tr> <tr> <td align='left' valign='top'><center>Coming Soon</center></td> <td rowspan='2' align='left' valign='top'>$ncontent</td> <td rowspan='2' align='left' valign='top'>$content</td> </tr> <tr> <th colspan='3' height='1' align='center' valign='top'>Player Ads</th> </tr> <tr> <td height='100%' align='center' valign='top'><?php if(!$v2) { if(!$mysqli) { $q = mysql_query("SELECT * FROM npaper LIMIT 10"); while($na = mysql_fetch_array($q)) { ?><strong>Ad By - <a href='viewuser.php?u=<?php echo $na['npADDER']; ?>'><?php echo $username; ?></a></strong><br /> <strong>Topic</strong> - <?php echo stripslashes(htmlspecialchars($na['npTITLE'])); ?><br /> <strong>Message</strong> - <?php echo nl2br(stripslashes(htmlspecialchars($na['npBODY']))); ?><hr /><?php } } else { $q = mysqli_query("SELECT * FROM npaper LIMIT 10"); while($na = mysqli_fetch_array($q, MYSQLI_ASSOC)) { ?><strong>Ad By - <a href='viewuser.php?u=<?php echo $na['npADDER']; ?>'><?php echo $username; ?></a></strong><br /> <strong>Topic</strong> - <?php echo stripslashes(htmlspecialchars($na['npTITLE'])); ?><br /> <strong>Message</strong> - <?php echo nl2br(stripslashes(htmlspecialchars($na['npBODY']))); ?><hr /><?php } } } else { $q = $db->query("SELECT * FROM npaper LIMIT 10"); while($na = $db->fetch_row($q)) { ?><strong>Ad By - <a href='viewuser.php?u=<?php echo $na['npADDER']; ?>'><?php echo $username; ?></a></strong><br /> <strong>Topic</strong> - <?php echo stripslashes(htmlspecialchars($na['npTITLE'])); ?><br /> <strong>Message</strong> - <?php echo nl2br(stripslashes(htmlspecialchars($na['npBODY']))); ?><hr /><?php } } ?>> <a href='postad.php?action=add'>Add An Ad</a> <</td> </tr> </table><?php $h->endpage(); function mysqli_result($result) { mysqli_data_seek($result, 0); $temp = mysqli_fetch_array($result); return $temp[0]; } postad.php <?php //Please Keep This Notice //Made By:Iseeyou94056 //Type:Free //Please Do Not Sell This It Is Free //Please Dont Take Credit For This You Did Not Make It // Recoded by Magictallguy $mysqli = false; // Set to true if you're using MySQLi. If $v2 is set to true, $v2 overrides $v2 = false; // Set to true if you're using MC Craps v2. Ignores the $mysqli settings if($v2) include(__DIR__ . '/globals.php'); else { session_start(); require "global_func.php"; if(!isset($_SESSION['loggedin'])) { header("Location: login.php"); exit; } $userid = $_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; if(!$mysqli) { $is = mysql_query("SELECT `u`.*, `us`.* " . "FROM `users` AS `u` " . "LEFT JOIN `userstats` AS `us` ON (`u`.`userid` = `us`.`userid`) " . "WHERE `u`.`userid` = ".$userid, $c) or die(mysql_error()); if(!mysql_num_rows($is)) { echo "There appears to be an issue with your account"; exit; } $ir = mysql_fetch_array($is); } else { $is = mysqli_query($c, "SELECT `u`.*, `us`.* " . "FROM `users` AS `u` " . "LEFT JOIN `userstats` AS `us` ON (`u`.`userid` = `us`.`userid`) " . "WHERE `u`.`userid` = ".$userid) or exit(mysqli_error($c)); if(!mysqli_num_rows($is)) { echo "There appears to be an issue with your account"; exit; } $ir = mysqli_fetch_array($is, MYSQLI_ASSOC); } check_level(); $h->userdata($ir, date('F j, Y, g:i a',$ir['laston']), money_formatter($ir['money']), number_format($ir['crystals'])); $h->menuarea(); } if(!isset($_POST['submit'])) { ?><h3>Add Advertisement ($5,000)</h3> <form action='postad.php' method='post'> <table class='table' width='100%'> <tr> <th width='25%'>Title</th> <td width='75%'><input type='text' name='npTITLE' class='textbox' /></td> </tr> <tr> <th>Content</th> <td><textarea rows='5' cols='18' name='npBODY' class='textbox'></textarea></td> </tr> <tr> <td colspan='2' class='center'><input class='textbox' type='submit' value='Place Ad ($5,000)' /></td> </tr> </table> </form> <font color=red><b>WARNING:</b> Only plain text will work Do not advertise other games Follow the rules.<?php } else { if($ir['money'] < 5000) { echo "You don't have enough money"; exit($h->endpage()); } if(!$v2) { if(!$mysqli) { mysql_query("UPDATE `users` SET `money` = `money` - 5000 WHERE `userid` = ".$userid, $c) or exit(mysql_error()); mysql_query("INSERT INTO `npaper` VALUES (NULL, ".$userid.", '".mysql_real_escape_string($_POST['npTITLE'], $c)."', '".mysql_real_escape_string($_POST['npBODY'], $c)."', ".time().")", $c) or die(mysql_error()); } else { mysqli_query($c, "UPDATE `users` SET `money` = `money` - 5000 WHERE `userid` = ".$userid) or exit(mysqli_error($c)); mysqli_query($c, "INSERT INTO `npaper` VALUES (NULL, '$userid', '".mysqli_real_escape_string($c, $_POST['npTITLE'])."', '".mysqli_real_escape_string($c, $_POST['npBODY'])."', ".time().")") or exit(mysqli_error($c)); } } else { $db->query("UPDATE `users` SET `money` = `money` - 5000 WHERE `userid` = ".$userid); $db->query("INSERT INTO `npaper` VALUES (NULL, ".$userid.", '".$db->escape($_POST['npTITLE'])."', '".$db->escape($_POST['npBODY'])."', ".time().")"); } ?>Your ad has been posted<?php } $h->endpage();
-
Staff-side updated
-
And I'll update the staff panel to match :P
-
Just a quick note, not everyone's using the same file system as you. To everyone using this: make sure to change the globals.php include file path to match your own setting Also, one fully-tested, brand-spankin'-new Staff Panel for it :) <?php include(__DIR__ . '/sglobals.php'); ?><link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.3.0/pure-min.css"> <style scoped> .pure-button-reset { color: white; border-radius: 4px; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); background: rgb(223, 117, 20); } </style> <h3>Staff: Education</h3><?php if($ir['user_level'] != 2) error("You don't have access"); $_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? strtolower(trim($_GET['action'])) : null; switch($_GET['action']) { case 'add': addCourse(); break; case 'edit': editCourse(); break; case 'del': deleteCourse(); break; case 'courses': viewCoursesInProgress(); break; case 'end': endCourseInProgress(); break; default: error("What?"); break; } function addCourse() { global $db; if(isset($_POST['submit'])) { $text = array('name', 'desc'); foreach($text as $what) { $_POST[$what] = isset($_POST[$what]) && is_string($_POST[$what]) ? trim($_POST[$what]) : null; if(empty($_POST[$what])) error("You missed something: ".$what); } $nums = array('total', 'hourly', 'daily', 'cost', 'strength', 'agility', 'guard', 'labour', 'IQ', 'previous_course_required_ID'); foreach($nums as $what) $_POST[$what] = isset($_POST[$what]) && ctype_digit($_POST[$what]) ? abs(@intval($_POST[$what])) : 0; $select = $db->query("SELECT `ID` FROM `education_courses` WHERE `name` = '".$db->escape($_POST['name'])."'"); if($db->num_rows($select)) error("You've already added a course with that name"); $db->query("INSERT INTO `education_courses` VALUES (NULL, '".$db->escape($_POST['name'])."', '".$db->escape($_POST['desc'])."', ".$_POST['previous_course_required_ID'].", ".$_POST['total_clicks'].", ".$_POST['hourly_clicks'].", ".$_POST['daily_clicks'].", ".$_POST['cost'].", ".$_POST['strength'].", ".$_POST['guard'].", ".$_POST['labour'].", ".$_POST['agility'].", ".$_POST['IQ'].")"); stafflog_add("Added a new course: ".$_POST['name']); success("Your new course has been added"); } ?><form action='staff_education.php?action=add' method='post' class='pure-form pure-form-stacked'> <table class='pure-table pure-table-horizontal' width='100%'> <tr> <th width='25%'>Name</th> <td width='75%'><input type='text' name='name' size='82%' /></td> </tr> <tr> <th>Description</th> <td><textarea name='desc' rows='10' cols='60'></textarea></td> </tr><?php $array = array('total_clicks', 'daily_clicks', 'hourly_clicks', 'previous_course_required_ID', 'cost', 'strength', 'agility', 'guard', 'labour', 'IQ'); foreach($array as $what) { ?><tr> <th><?php echo ucfirst(str_replace('_', ' ', $what)); ?></th> <td><input type='number'<?php echo in_array($name, array('strength', 'agility', 'guard', 'labour')) ? " step='0.0001'" : ''; echo $name == 'IQ' ? " step='0.000001'" : ''; ?> name='<?php echo $what; ?>' min='0' /></td> </tr><?php } ?><tr> <td colspan='2' class='center'><input type='submit' name='submit' value='Submit' class='pure-button pure-button-primary' /> <input type='reset' value='Reset' class='pure-button pure-button-reset' /></td> </tr> </table> </form><?php } function editCourse() { global $db; $_GET['s'] = isset($_GET['s']) && ctype_digit($_GET['s']) ? abs(@intval($_GET['s'])) : null; switch($_GET['s']) { default: ?><form action='staff_education.php?action=edit&s=1' method='post' class='pure-form pure-form-stacked'> <table class='pure-table pure-table-horizontal' width='100%'> <tr> <th width='25%'>Course</th> <td width='75%'><select name='course' type='dropdown'><?php $select = $db->query("SELECT `ID`, `name` FROM `education_courses` ORDER BY `name` ASC"); while($row = $db->fetch_row($select)) printf("<option value='%u'>%s</option>", $row['ID'], format($row['name'])); ?></select></td> </tr> <tr> <td colspan='2' class='center'><input type='submit' value='Submit' class='pure-button pure-button-primary' /></td> </tr> </table> </form><?php break; case 1: $_POST['course'] = isset($_POST['course']) && ctype_digit($_POST['course']) ? abs(@intval($_POST['course'])) : null; if(empty($_POST['course'])) error("You didn't select a valid course"); $select = $db->query("SELECT * FROM `education_courses` WHERE `ID` = ".$_POST['course']); if(!$db->num_rows($select)) error("That course doesn't exist"); $row = $db->fetch_row($select); $values = array( 'previous_course_required_ID' => 'mustBeTakenBefore', 'total_clicks' => 'clicks_needed_total', 'daily_clicks' => 'clicks_max_daily', 'hourly_clicks' => 'clicks_max_hourly', 'cost' => 'cost_money', 'strength' => 'award_STR', 'agility' => 'award_AGIL', 'guard' => 'award_GUARD', 'labour' => 'award_LABOUR', 'IQ' => 'award_IQ' ); ?><form action='staff_education.php?action=edit&s=2' method='post' class='pure-form pure-form-stacked'> <input type='hidden' name='course' value='<?php echo $_POST['course']; ?>' /> <table class='pure-table pure-table-horizontal' width='100%'> <tr> <th width='25%'>Name</th> <td width='75%'><input type='text' name='name' value='<?php echo format($row['name']); ?>' /> </tr> <tr> <th>Description</th> <td><textarea name='desc' rows='10' cols='60'><?php echo format($row['description']); ?></textarea></td> </tr><?php foreach($values as $name => $value) { ?><tr> <th><?php echo ucfirst(str_replace('_', ' ', $name)); ?></th> <td><input type='number'<?php echo in_array($name, array('strength', 'agility', 'guard', 'labour')) ? " step='0.0001'" : ''; echo $name == 'IQ' ? " step='0.000001'" : ''; ?> name='<?php echo $name; ?>' value='<?php echo $row[$value]; ?>' min='0' /></td> </tr><?php } ?><tr> <td colspan='2' class='center'><input type='submit' name='submit' value='Submit' class='pure-button pure-button-primary' /> <input type='reset' value='Reset' class='pure-button pure-button-reset' /></td> </tr> </table> </form><?php break; case 2: $_POST['course'] = isset($_POST['course']) && ctype_digit($_POST['course']) ? abs(@intval($_POST['course'])) : null; if(empty($_POST['course'])) error("You didn't select a valid course"); $select = $db->query("SELECT `ID` FROM `education_courses` WHERE `ID` = ".$_POST['course']); if(!$db->num_rows($select)) error("That course doesn't exist"); $text = array('name', 'desc'); foreach($text as $what) { $_POST[$what] = isset($_POST[$what]) && is_string($_POST[$what]) ? trim($_POST[$what]) : null; if(empty($_POST[$what])) error("You missed something: ".$what); } $nums = array('total', 'hourly', 'daily', 'cost', 'strength', 'agility', 'guard', 'labour', 'IQ', 'previous_course_required_ID'); foreach($nums as $what) $_POST[$what] = isset($_POST[$what]) && ctype_digit($_POST[$what]) ? abs(@intval($_POST[$what])) : 0; $select = $db->query("SELECT `ID` FROM `education_courses` WHERE `name` = '".$db->escape($_POST['name'])."' AND `ID` <> ".$_POST['course']); if($db->num_rows($select)) error("You've already added a course with that name"); $db->query("REPLACE INTO `education_courses` VALUES (".$_POST['course'].", '".$db->escape($_POST['name'])."', '".$db->escape($_POST['desc'])."', ".$_POST['previous_course_required_ID'].", ".$_POST['total_clicks'].", ".$_POST['hourly_clicks'].", ".$_POST['daily_clicks'].", ".$_POST['cost'].", ".$_POST['strength'].", ".$_POST['guard'].", ".$_POST['labour'].", ".$_POST['agility'].", ".$_POST['IQ'].")"); stafflog_add("Edited a course: ".$_POST['name']); success("Your course has been edited"); break; } } function deleteCourse() { global $db; if(isset($_POST['submit'])) { $_POST['course'] = isset($_POST['course']) && ctype_digit($_POST['course']) ? abs(@intval($_POST['course'])) : null; if(empty($_POST['course'])) error("You didn't select a valid course"); $select = $db->query("SELECT `name` FROM `education_courses` WHERE `ID` = ".$_POST['course']); if(!$db->num_rows($select)) error("That course doesn't exist"); $name = $db->fetch_single($select); $db->query("DELETE FROM `education_courses` WHERE `ID` = ".$_POST['course']); stafflog_add("Deleted the course: ".$name); success("You've deleted the course: ".format($name)); } ?><form action='staff_education.php?action=del' method='post' class='pure-form pure-form-stacked'> <table class='pure-table pure-table-horizontal' width='100%'> <tr> <th width='25%'>Course</th> <td width='75%'><select name='course' type='dropdown'><?php $select = $db->query("SELECT `ID`, `name` FROM `education_courses` ORDER BY `name` ASC"); while($row = $db->fetch_row($select)) printf("<option value='%u'>%s</option>", $row['ID'], format($row['name'])); ?></select></td> </tr> <tr> <td colspan='2' class='center'><input type='submit' value='Submit' class='pure-button pure-button-primary' /></td> </tr> </table> </form><?php } function viewCoursesInProgress() { global $db; ?><table class='pure-table pure-table-striped'> <tr> <th width='45%'>Player</th> <th width='45%'>Course</th> <th width='10%'>Action</th> </tr><?php $select = $db->query("SELECT `userid`, `username`, `ID`, `name` " . "FROM `users` " . "INNER JOIN `education_courses` ON (`course` = `ID`) " . "WHERE `course` > 0 " . "ORDER BY `course` ASC"); if(!$db->num_rows($select)) echo "<tr><td colspan='3' class='center'>No-one's currently taking a course</td></tr>"; else while($row = $db->fetch_row($select)) { ?><tr> <td><a href='viewuser.php?u=<?php echo $row['userid']; ?>'><?php echo format($row['username']); ?></a></td> <td><?php echo format($row['name']); ?></td> <td><a href='staff_education.php?action=end&user=<?php echo $row['userid']; ?>&course=<?php echo $row['ID']; ?>'><img src='http://magictallguy.tk/images/silk/delete.png' title='End Course' alt='End' /></a></td> </tr><?php } ?></table><?php stafflog_add("Viewed the current courses in progress"); } function endCourseInProgress() { global $db, $ir; $_GET['course'] = isset($_GET['course']) && ctype_digit($_GET['course']) ? abs(@intval($_GET['course'])) : null; if(empty($_GET['course'])) error("You didn't specify a valid course"); $_GET['user'] = isset($_GET['user']) && ctype_digit($_GET['user']) ? abs(@intval($_GET['user'])) : null; if(empty($_GET['user'])) error("You didn't specify a valid user"); $select = $db->query("SELECT `username` FROM `users` WHERE `userid` = ".$_GET['user']." AND `course` = ".$_GET['course']); if(!$db->num_rows($select)) error("Either that player doesn't exist or they aren't taking that course"); $name = $db->fetch_single($select); $db->query("UPDATE `users` SET `course` = 0, `course_clicks_left` = 0 WHERE `userid` = ".$_GET['user']); event_add($_GET['user'], "Your course has been prematurely ended by <a href='viewuser.php?u=".$ir['userid']."'>".$ir['username']."</a>"); stafflog_add("Ended ".$name."'s course"); success("You've ended ".$name."'s course"); } function success($msg, $end = false) { global $h; echo "<div class='success'><strong>SUCCESS</strong><br />",$msg,"</div>"; if($end) exit($h->endpage()); } function error($msg) { global $h; echo "<div class='error'><strong>ERROR</strong><br />",$msg,"</div>"; exit($h->endpage()); } function format($str, $dec = 0) { return is_numeric($str) ? number_format($str, $dec) : stripslashes(htmlspecialchars($str)); } $h->endpage(); A copy of this is available on my site http://magictallguy.tk/dl/mods/schooling.php
-
deviant wars script aka KOS clone aka lords script NOW OPEN SOURCE
Magictallguy replied to advocaite's topic in Game Projects
There is so much about that .. code .. that I want to rip apart and rebuild. The prospect and ideology is nice, but the code is .. wow .. terrible.. Can I please join this team, recode that, get paid? xD -
Get a better host ;)
-
<?php include(__DIR__ . '/globals.php'); ?><link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.3.0/pure-min.css"> <style scoped> .pure-button-reset { color: white; border-radius: 4px; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); background: rgb(223, 117, 20); </style> <style type='text/css'> .info,.success,.warning,.error { border: 1px solid; margin: 10px 0; padding: 15px 10px 15px 50px; background-repeat: no-repeat; background-position: 10px center; -moz-border-radius: .5em; -webkit-border-radius: .5em; border-radius: .5em; } .success { color: #4F8A10; background-color: #DFF2BF; background-image: url(http://magictallguy.tk/images/success.png); } .error { color: #D8000C; background-color: #FFBABA; background-image: url(http://magictallguy.tk/images/error.png); } </style> <?php class mtg_func { protected static $instance; public static function getInstance() { if(!isset(self::$instance)) self::$instance = new static(); return self::$instance; } public function format($str, $dec = 0) { if(is_numeric($str)) return number_format($str, $dec); else return $dec ? nl2br(stripslashes(htmlspecialchars($str))) : stripslashes(htmlspecialchars($str)); } public function username($id, $show = false, $escape = false) { global $db; $ret = ''; if(!$id) return 'SYSTEM'; $select = $db->query("SELECT `username` FROM `users` WHERE `userid` = ".$id); if(!$db->num_rows($select)) return 'UNKNOWN'; $ret .= $escape == false ? "<a href='viewuser.php?u=".$id."'>".$this->format($db->fetch_single($select))."</a>" : $db->escape("<a href='viewuser.php?u=".$id."'>".$this->format($db->fetch_single($select))."</a>"); $ret .= $show == true ? " [".$id."]" : ''; return $ret; } public function error($msg, $end = true) { global $h; echo "<div class='error'><strong>ERROR!</strong><br />".$msg."</div>"; if($end == true) exit($h->endpage()); } public function success($msg, $end = false) { global $h; echo "<div class='success'><strong>SUCCESS!</strong><br />".$msg."</div>"; if($end == true) exit($h->endpage()); } } $mtg = mtg_func::getInstance(); if($ir['mailban']) $mtg->error("You have been mail banned for ".$ir['mailban']." day".(($ir['mailban'] == 1) ? '' : 's')."Reason: ".$mtg->format($ir['mb_reason'])); $_GET['ID'] = isset($_GET['ID']) && ctype_digit($_GET['ID']) ? abs(@intval($_GET['ID'])) : null; ?><table class='pure-table pure-table-horizontal' width='95%' cellspacing='1'> <tr> <td><a href='mailbox.php?action=inbox'>Inbox</a></td> <td><a href='mailbox.php?action=outbox'>Sent Messages</a></td> <td><a href='mailbox.php?action=compose'>Compose Message</a></td> <td><a href='mailbox.php?action=delall'>Delete All Messages</a></td> <td><a href='mailbox.php?action=archive'>Archive Messages</a></td> <td><a href='contactlist.php'>My Contacts</a></td> </tr> </table><?php switch($_GET['action']) { case 'inbox': mail_inbox(); break; case 'outbox': mail_outbox(); break; case 'compose': mail_compose(); break; case 'delete': mail_delete(); break; case 'delall': mail_delall(); break; case 'archive': mail_archive(); break; default: mail_inbox(); break; } function mail_inbox() { global $db, $ir, $mtg; ?>Only the last 25 messages sent to you are visible. <table class='pure-table pure-table-horizontal' width='95%' border='0' cellspacing='1'> <tr> <th width='20%'>From</th> <th width='70%'>Subject/Message</th> </tr><?php $q = $db->query("SELECT * FROM `mail` WHERE `mail_to` = ".$ir['userid']." ORDER BY mail_time DESC LIMIT 25"); if(!$db->num_rows($q)) echo "<tr><td colspan='2' class='center'>You have no messages</td></tr>"; else while($row = $db->fetch_row($q)) { ?><tr> <td><?php echo $mtg->username($row['mail_from'], true); ?><br /> Sent at: <?php echo date('F j, Y, g:i:s a', $row['mail_time']); ?><br /> <a href='mailbox.php?action=compose&ID=<?php echo $row['mail_from']; ?>'>Reply</a><br /> <a href='mailbox.php?action=delete&ID=<?php echo $row['mail_id']; ?>'>Delete</a><br /> <a href='preport.php?ID=<?php echo $row['mail_from']; ?>&report=Fraudulent mail: <?php echo urlencode($row['mail_text']); ?>'>Report</a></td> <td><strong>Subject: <?php echo $row['mail_subject'] ? $mtg->format($row['mail_subject'], false) : 'None'; ?></strong><br /> <?php echo $mtg->format($row['mail_text']); ?></td> </tr><?php } ?></table><?php if($ir['new_mail'] > 0) { $db->query("UPDATE `mail` SET `mail_read` = 1 WHERE `mail_to` = ".$ir['userid']); $db->query("UPDATE `users` SET `new_mail` = 0 WHERE `userid` = ".$ir['userid']); } } function mail_outbox() { global $db, $ir, $mtg; ?>Only the last 25 messages you have sent are visible. <table class='pure-table pure-table-horizontal' width='75%' cellspacing='1'> <tr> <th width='30%'>To</th> <th width='70%'>Subject/Message</th> </tr><?php $q = $db->query("SELECT * FROM `mail` WHERE `mail_from` = ".$ir['userid']." ORDER BY `mail_time` DESC LIMIT 25"); if(!$db->num_rows($q)) echo "<tr><td colspan='2' class='center'>You haven't sent any messages</td></tr>"; else while($row = $db->fetch_row($q)) { ?><tr> <td><?php echo $mtg->username($row['mail_to']); ?></td> <td><?php echo $mtg->format($row['mail_subject'], false); ?></td> </tr> <tr> <td>Sent at: <?php echo date('F j, Y, g:i:s a', $row['mail_time']); ?></td> <td><?php echo $mtg->format($row['mail_text']); ?></td> </tr><?php } ?></table><?php } function mail_compose() { global $db, $ir, $mtg; if(!isset($_POST['submit']) || empty($_POST['message'])) { ?><form action='mailbox.php?action=compose' method='post' class='pure-form pure-form-stacked'> <table class='pure-table pure-table-horizontal' width='75%' cellspacing='1'> <tr> <td>Contact to send to:</td> <td><?php $q = $db->query("SELECT `cl_ADDED` FROM `contactlist` WHERE `cl_ADDER` = ".$ir['userid']." ORDER BY `cl_ADDED` ASC"); if(!$db->num_rows($q)) echo "You have no contacts!"; else { ?><select name='user1' type='dropdown'> <option value=''><Select a contact...></option><?php while($row = $db->fetch_row($q)) printf("<option value='%u'>%s</option>", $row['cl_ADDED'], $mtg->format($row['cl_ADDED'], false)); ?></select><?php } ?></td> </tr> <tr> <td><strong>OR</strong> Enter a player's ID:</td> <td><input type='text' name='user2' value='<?php echo $_GET['ID']; ?>' /></td> </tr> <tr> <td>Subject:</td> <td><input type='text' name='subject' /></td> </tr> <tr> <td>Message:</td> <td><textarea rows='10' cols='60' name='message' placeholder='Write your message here. Please keep it clean' required></textarea></td> </tr> <tr> <td colspan='2' class='center'><input type='submit' name='submit' value='Send' class='pure-button pure-button-primary' /> <input type='reset' value='Reset' class='pure-button pure-button-reset' /></td> </tr> </table> </form><?php if(!empty($_GET['ID'])) { ?><table class='pure-table pure-table-horizontal' width='75%'> <tr> <td colspan='2'><strong>Your last 5 mails to/from this person:</strong></td> </tr><?php $q = $db->query(sprintf("SELECT `mail_time`, `mail_from`, `mail_to`, `mail_text` FROM `mail` " . "WHERE (`mail_from` = %1\$u AND `mail_to` = %2\$u) OR " . "(`mail_to` = $1\$u AND `mail_from` = %2\$u) " . "ORDER BY `mail_time` DESC LIMIT 5", $ir['userid'], $_GET['ID'])); if(!$db->num_rows($q)) echo "<tr><td colspan='2' class='center'>No messages between yourself and ".$mtg->username($_GET['ID'])." could be found</td></tr>"; else while($row = $db->fetch_row($q)) { ?><tr> <td><?php echo date('F j, Y, g:i:s a', $row['mail_time']); ?></td> <td><strong><?php echo $mtg->username($row['mail_from']); ?> wrote:</strong> <?php echo $mtg->format($row['mail_text']); ?></td> </tr><?php } ?></table><?php } } else { $_POST['user1'] = isset($_POST['user1']) && ctype_digit($_POST['user1']) ? abs(@intval($_POST['user1'])) : null; $_POST['user2'] = isset($_POST['user2']) && ctype_digit($_POST['user2']) ? abs(@intval($_POST['user2'])) : null; if(empty($_POST['user1']) && empty($_POST['user2'])) $mtg->error("You must either select a contact or enter a player's ID"); if(!empty($_POST['user1']) && !empty($_POST['user2'])) $mtg->error("You must either select a contact or enter a player's ID, not both"); $sendto = !empty($_POST['user1']) ? $_POST['user1'] : $_POST['user2']; if(in_array($mtg->username($sendto), array('SYSTEM', 'UNKNOWN'))) $mtg->error("That player doesn't exist"); $db->query("INSERT INTO `mail` VALUES ('', 0, ".$ir['userid'].", ".$sendto.", ".time().", '".$db->escape($_POST['subject'])."', '".$db->escape($_POST['message'])."')"); $db->query("UPDATE `users` SET `new_mail` = `new_mail` + 1 WHERE `userid` = ".$sendto); $mtg->success("Your message to ".$mtg->username($sendto)." has been sent"); mail_inbox(); } } function mail_delete() { global $db, $ir, $mtg; if(empty($_GET['ID'])) $mtg->error("You didn't select a valid message to delete"); $select = $db->query("SELECT `mail_to`, `mail_read` FROM `mail` WHERE `mail_id` = ".$_GET['ID']); if(!$db->num_rows($select)) $mtg->error("That message doesn't exist"); $row = $db->fetch_row($select); if($row['mail_to'] != $ir['userid']) $mtg->error("That message is not yours to delete"); if(!$row['mail_read']) $db->query("UPDATE `users` SET `new_mail` = `new_mail` - 1 WHERE `userid` = ".$ir['userid']); $db->query("DELETE FROM `mail` WHERE `mail_id` = ".$_GET['ID']); $mtg->success("Message deleted"); mail_inbox(); } function mail_delall() { global $db, $ir, $mtg; $select = $db->query("SELECT COUNT(`mail_id`) FROM `mail` WHERE `mail_to` = ".$ir['userid']); if(!$db->fetch_single($select)) $mtg->error("You have no messages to delete"); if(!isset($_GET['ans'])) { ?>This will delete all the messages in your inbox. There is <strong>NO</strong> undo, so be sure. <a href='mailbox.php?action=delall&ans=yes'>> Yes, delete all messages</a> <a href='mailbox.php'>> No, go back</a><?php } else { $db->query("DELETE FROM `mail` WHERE `mail_to` = ".$ir['userid']); $mtg->success($db->affected_rows()." message". ($db->affected_rows() == 1 ? " has " : "s have ")." been deleted"); } } function mail_archive() { ?>This tool will download an archive of all your messages. <a href='dlarchive.php?a=inbox'>> Download Inbox</a> <a href='dlarchive.php?a=outbox'>> Download Outbox</a><?php } $h->endpage(); Tested and working. Enjoy
-
I have? When did that happen? O.o I'll re-enable them! Edit: They were set to contacts/moderators only. Set to all :)
-
My front-end skills are quite limited. I prefer to "work in the shadows" as it were. That way, if anything's a little messy, the user doesn't see it :P Examples of my work can be found on my (currently unfinished) site: http://mtg-code.net/gallery I prefer to write a database wrapper class, a small class for my personal functions and go from there. I can provide code snippets upon request Thank you :)
-
Completely forgot about this topic.. Figured I'd answer now.. What if your game is using the class_db_mysqli.php, but you're still using the standard mysql_* functions? Errors galore! Filepaths available for general reading, most filepaths include usernames. If you're a decent hacker/exploiter, that's more than what you need to start gaining unauthorized access to something that isn't yours