Jump to content
MakeWebGames

CJ - Twitch

Members
  • Posts

    391
  • Joined

  • Last visited

Everything posted by CJ - Twitch

  1. OP Updated. Thanks to Crim. :)
  2. Thanks Crim I shall be using this. :D You may remove the bottom 'Made By CJ' bit lol.
  3. So I have never seen a usersonline.php that is better than the default McCodes posted on any of the forums I use. I had some spare time when I got back from the club and I decided to make one. It is mostly a visual update but here we go. :D <?php // Keep this here please. It wont hurt anyone so why remove it? // Made by CJ Holder or CJ - Twitch // Made for [url]http://dev-forum.net/[/url] & [url]http://makewebgames.io/[/url] & [url]http://cronwerks.com/forum/index.php[/url]. // File name: usersonline.php include("globals.php"); $_GET['amt'] = ( isset($_GET['amt']) AND in_array($_GET['amt'], array(9,16,24,48,96)) ) ? $_GET['amt'] : 9 ; print '<font size="4" face="Arial, Helvetica, sans-serif">Users Online</font> <hr color="black" width="75%">'; $query = mysql_query("SELECT `userid`,`username`,`laston`,`gender` FROM `users` WHERE `laston` > unix_timestamp()-30*60 ORDER BY `laston` DESC LIMIT {$_GET['amt']}"); print'[url="usersonline.php?amt=9"]Show 9[/url] | [url="usersonline.php?amt=16"]Show 16[/url] | [url="usersonline.php?amt=24"]Show 24[/url] | [url="usersonline.php?amt=48"]Show 48[/url] | [url="usersonline.php?amt=96"]Show 96[/url] '; print "<table width=75% cellpadding='3' class='table'><tr>"; while($user=mysql_fetch_array($query)) { $lo=time()-$user['laston']; $unit="seconds"; if($lo >= 60) { $lo=(int) ($lo/60); $unit="minutes"; } if($lo >= 60) { $lo=(int) ($lo/60); $unit="hours"; if($lo >= 24) { $lo=(int) ($lo/24); $unit="days"; } } $count++; if ($count == 3) { $CJ="</tr><tr>"; $count=0; } else { $CJ=""; } print "<td align='center' width='33%'> [b]{$user['username']}[/b] [size="1"][[url='viewuser.php?u={$user[']View Profile[/url]][/size] [b]Last Action:[/b] $lo $unit ago. [b]Gender:[/b] {$user['gender']}"; print " </td>"; print "$CJ"; } print '</tr></table><hr color="black" width="75%">'; exit(); ?> Thanks. CJ - Twitch Screenies: Thanks to MagicTallGuy. ;) Showing 3 users online. __________________________________________________________________ Edited to show you what it would do with more than 3 users online. There is a limit to 9 which can be changed easily. Will be using CrimGame.com's snimppit of code to show more than 9. :P ;)
  4. Lmfao. Nice work. Very simple.
  5. Lmfao. Thanks? Whats wrong with it? It was a 2 second thing that was requested by streetsyndicate.
  6. Sounds interesting. May I help? What modifications will you be making?
  7. This was a request so I made it. It just lets users buy themselves out of jail for 1*there level crystals. Can be changed easily. This has been tested and works.   <?php include_once("globals.php"); $cost = 1*$ir['level']; // Change this to whatever. if($_POST['bail'] == 1) { if($ir['jail'] < 1) { print 'You are not in jail.'; exit(); } elseif($ir['crystals'] < $cost) { print "you don't have enough crystals. You need $cost crystals."; } else { print "You've paid $cost crystals as a bail fee. You are now free to go."; mysql_query("UPDATE users SET jail = 0, crystals = crystals-$cost WHERE userid = ".$ir['userid'].""); } } if(!$_POST['bail']) { if($ir['jail'] < 1) { print 'You are not in jail.'; exit(); } else { print "<h3>Self Bail</h3> Welcome {$ir['username']}, Here you may pay $cost crystals to get out of jail!"; print '<form action="selfbail.php" method="post"> <input type="hidden" name="bail" value="1"> <input type="submit" size="150" value="Pay The Fee"> </form>'; } } ?>   Add This To jail.php if($ir['jail']) { print "You are in jail. Buy yourself out [url='selfbail.php']here[/url]."; }   Enjoy.
  8. Great Choice! :)
  9. Next time lean to spell. ;)
  10. To be honest its not hard to guess them...
  11. Thanks MTG. :)
  12. I don't know. Where did you get that from?
  13. Can I have some help on this snippit of code please?   function gang_staff_pic() { global $ir,$c,$userid,$gangdata; if($gangdata['gangPRESIDENT'] == $userid) { if($_POST['subm'] == "") { print "You did not enter a new pic. [url='yourgang.php?action=staff']> Back[/url]"; } else { if(!preg_match('~(.?).(jpg|jpeg|gif|png)~i', $_POST['newpic'])) { echo "Invalid Extension!"; } if(@getimagesize($_POST['newpic']) == FALSE) { echo "Invalid Extension!"; } $_POST['subm'] = str_replace(array(".php"), array(""), $_POST['subm']); $_POST['subm']=str_replace('\\\'',''', $_POST['subm']); mysql_query("UPDATE gangs SET gangPIC='{$_POST['vp']}' WHERE gangID={$gangdata['gangID']}",$c); print "Gang pic changed! [url='yourgang.php?action=staff']> Back[/url]"; } { print "Current Pic: "; if($gangdata['gangPIC']) { print "[img={$gangdata[]"; } else { print "[b]No Gang Picture[/b]"; } print"<hr /> <form action='yourgang.php?action=staff&act2=pic' method='post'> Please note that the pic must be externally hosted, [url='http://tinypic.com']Tinypic[/url] is our recommendation. Any pics that are not 400x100 will be automatically resized. <input type='hidden' name='subm' value='submit' /> tag: <input type='text' name='vp' value='' /> <input type='submit' value='Change' /></form>"; } } }   It works but shows th errors when i dont want them to be shown. For example. "You did not enter a new pic" when I havent clicked submit yet and "Invalid Extension!Gang pic changed". Its hard to explain but im sure you'll figure it out. :thumbsup: Thanks in advance -CJ - Twitch PS: How secure is this?
  14. Awesome! :thumbsup:
  15. This is grat. Love the use of CSS. :thumbsup:
  16. It is a great mod. :) Just create a new topic lol. And I know what Renkia means. But nice anyway!
  17. I will post it later. Im on my EEE PC. :P
  18. And it works. xD
  19. Nice! Thank you. :)
  20. And Im definitely using it. :P
  21. VERY GOOD! :thumbsup:
  22. Thank you. I will reupload soon... Im to lazy right now.
  23. One thing... You forgot a else statement... :P It use to say you don't have enough money and still took you there... for example.. You don't have enough money. You need $100,000 to travel to TEST1Congratulations, you paid $100,000 and travelled to TEST1 on the monorail! Fixed. <?php include_once (DIRNAME(__FILE__) . '/globals.php'); # $_GET['to'] = isset($_GET['to']) && is_numeric($_GET['to']) ? abs((int) $_GET['to']) : false; # Always wondered why people added abs((int) $var) ctype_digit will basically do a check on variables and won't output if it's actually numeric... $_GET['to'] = ( isset($_GET['to']) AND ctype_digit($_GET['to']) ) ? $_GET['to'] : 0 ; if ( empty($_GET['to']) ) { echo ' Welcome to the Monorail Station. Where would you like to travel today? '; $q = $db->query('SELECT `cityname`, `citydesc`, `cityminlevel`, `citycost`, `cityid` FROM `cities` WHERE `cityid` != '.$ir['location'].' AND `cityminlevel` <= '.$ir['level']); echo ' <table width="75%" cellspacing="1" class="table"> <tr style="background:gray"> <th>Name</th> <th>Description</th> <th>Min Level</th> <th>Cost</th> <th></th> </tr> '; while( $r = $db->fetch_row($q) ) { echo ' <tr> <td>'.$r['cityname'].'</td> <td>'.$r['citydesc'].'</td> <td>'.$r['cityminlevel'].'</td> <td>'.money_formatter($r['citycost']).'</td> <td>[url="monorail.php?to='.$r['cityid'].'"]Go[/url]</td> </tr> '; } echo '</table>'; } else { /* if ( $ir['money'] < $r['citycost'] ) { echo 'You don\'t have enough money. You need '.$r['citycost'].' to travel to '.$r['cityname']; } else # The above is pointless unless you have predefined $r if( ((int) $_GET['to']) != $_GET['to']) { // <= lmao echo 'Invalid city ID'; } else {*/ $qq = $db->query('SELECT `citycost`, `cityname` FROM `cities` WHERE `cityid` = '.$_GET['to'].' AND `cityminlevel` <= '.$ir['level']); if(!$db->num_rows($qq)) { print "Error, this city either does not exist or you cannot go there."; } else { $r = $db->fetch_row($qq); if ( $ir['money'] < $r['citycost'] ) { echo 'You don\'t have enough money. You need '.money_formatter($r['citycost']).' to travel to '.$r['cityname']; } else { $db->query('UPDATE `users` SET `money` = `money` - '.$r['citycost'].', `location` = '.$_GET['to'].' WHERE `userid` = '.$ir['userid']); echo 'Congratulations, you paid '.money_formatter($r['citycost']).' and travelled to '.$r['cityname'].' on the monorail!'; } } } $h->endpage(); ?>   Thanks again. :)
  24. echo 'You don\'t have enough money. You need '.$r['citycost'].' to travel to '.$r['cityname'];   should be...   echo 'You don\'t have enough money. You need '.money_formatter($r['citycost']).' to travel to '.$r['cityname']; Thank you CrimGame and skalman :thmbsup:
  25. Still learning SQL. :P
×
×
  • Create New...