POG1
Members-
Posts
1,419 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Everything posted by POG1
-
Re: Simple Question ok, so if i have a website with a header and footer included on every page and i have some dynamic content what would be the point of having it in 1 big echo tag? <?php include('header.php'); ?> blah blah blah</p> <?= $anyVariable ?></p> <?php include('footer.php'); ?>
-
Re: Basic Ajax is easy Some new mobile phones will not work correctly with AJAX and JS but i dont have a phone with a browser so i couldnt tell :P
-
Re: Crons stoped working. If you have a dedi i would think you would have more knowledge about servers and you will still have a "web host" as such. As for the crons why not have a table in the datbase with timestamps as to when the last cron was done and if its higher than the current 1 run the cron...
-
Re: Main Menu the game is in a table? why not give the column a class..
-
Re: New Register [V1] You dont need so much of that CSS which will slow the page down
-
Re: MENU CSS HTML {NOT MINE} how can someone manage to post something taken from a site and get it wrong lol
-
Re: Have mails dont show "on one of my v2 games" cowboy!
-
Fix to a forum bug: Apostrophe in thread title.
POG1 replied to Ragnar's topic in General Discussion
Re: Fix to a forum bug: Apostrophe in thread title. htmlentles ? oh however its spelt -
Re: How to.... Yours dosent, it only select a feild from the table where the id = your session id. $result = mysql_query("SELECT ". $field ." FROM members WHERE ID = ". $_SESSION['member_ID'] .";"); You could add an additional perameterfor it work with everyone function user_info($field='', $user) { if(empty($field)) return false; $accepted = array('username', 'money', 'points', 'nickname', 'memberlevel', 'signature'); if(!in_array($field, $accepted)) return false; $result = mysql_query("SELECT ". $field ." FROM members WHERE ID = ". $user .";"); if(1 != mysql_num_rows($result)) : return false; else : $row = mysql_fetch_assoc($result); return $row[$field]; endif; }
-
Re: How to.... <?php //You posted. when you print a variable you dont need to put it into double quotes. $username = user_info('username'); print "$username"; // a faster way would be.. echo $username = user_info('username'); ?> The code seems kinda the long way around and it would only work for the user and not for others. Whereas with the 1 i posted you could have it all run with 1 function and it would be easier to edit the whole thing :)
-
Re: Simple Question There is another way.. ?> End the php. I find it easier doing this with editors with the syntax highlighting and you could put a variable like this <?= $varName ?> <?php then start it again
-
Re: How to.... You could use it anywhere 8-) Just set the variable in the perameters and the function does the rest for you.. $varName = new User($_GET['id']);
-
Re: How to.... This is how i would do it <?php class User { function User($id) { $result = mysql_query("SELECT * FROM `users` WHERE `id`='".$id."'"); $worked = mysql_fetch_array($result); $this->username = $worked['username']; // you could also format the username. if($this->admin == 2) { $this->formattedname = "<font color=brown>".$this->username."</font>"; } else { $this->fotmattedname = $this->username; } } } ?> an example of usage... <?php $user = new User($idUsed); echo $user->formattedname ?>
-
Re: Basic Ajax is easy i have been adding AJAX onto my new site and it's very tricky. In the mailbox i'm creating in the to field i added a onBlur event which checks the user then displays the name in a span :)
-
Re: [V2]Game Stats For Admin[V2] good idea. why not have a table to show any IP conflicts? that would help. Not tested but summin along the lines of this... Just a thought though <?php $result = mysql_query("SELECT * FROM `users` ORDER BY `ip` ASC"); while($line = mysql_fetch_array($result, MYSQL_ASSOC)) { $result1 = mysql_query("SELECT * FROM `users` WHERE `ip`='".$line['ip']."'"); if (mysql_num_rows($result1) > 1){ ?> <tr><td><?= $line['username'] ?></td></tr> <?php } } ?>
-
Re: Preferences edit <?php if($_POST['newname'] == "" || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " || $_POST['newname'] == " " && $_POST['newname'] == " ") ?> why not use isset()? <?php $_POST['newname']=str_replace(array("<", ">", "\\\'"), array("<", ">", "'"), $_POST['newname']); $_POST['newname']=str_replace(array("{", "}", "\\\'"), array("<", ">", "'"), $_POST['newname']); ?> striptags? and mysql_real_escape_string?
-
[mccode v2] Different User Profile & View User Page
POG1 replied to ishmell's topic in Free Modifications
Re: Different User Profile & View User Page showing just about everything is stupid, you mite as well show their password while your at it. I like to see that you have your pirated mods rar folder open in the screen shot ;) -
Re: Crimes give random money looks good :) its boring getting the same amount of money every time
-
[SHOWCASE] Criminal Force - Free online MMORPG: Police Force vs. Crime Force
POG1 replied to ST-Mike's topic in Browsergames
Re: [sHOWCASE] Criminal Force - Free online MMORPG: Police Force vs. Crime Force nice game the police part looks good :) -
Re: Game Ranks add the field "rank" in the users table as integer looks like it will work, could make it more complex. function GameRank() { global $ir,$userid,$c; $rank=0; $lvl=$ir[level]; while($lvl >=5) { $rank++; $lvl=$lvl-5; } $net=1000; while($ir[networth] > 1200) { $rank++; $net=$net*$ir[networth]/2; $ir[networth]=$ir[networth]-$net; } if($ir[jailbusts] >= 500) {$rank++;} if($ir[jailbusts] >= 1000) {$rank++;} if($rank != $ir[rank]) { $query = "UPDATE users SET rank = ".$rank." WHERE userid = ".$userid; mysql_query($query) or die(mysql_error()); } } Then to output the value you could just use the next function function GetGameRank($rank) { $r=($rank); if($r<1) {return"#1 Absolute beginner";}if($r<2){return"#2 Beginner";}if($r<3){return"#3 Inexperienced";}if($r<4){return"#4 Rookie"; }if($r<5){return"#5 Novice";}if( $r < 6 ) { return "#6 Below Average"; }if($r<7){return"#7 Average";}if($r<8){return"#8 Reasonable";}if($r<9){return"#9 AboveAverage";}if($r<10){return"#10 competant";}if($r<11){return"#11 HighlyCompenant";}if($r<12){return"#12 Veteran";}if($r<13){return"#13 Distinguished";}if($r<14){return"#14 Highly Distinguished";}if($r<15){return"#15 Professional";} } An example of the usage <?= GetGameRank($ir['rank']) ?>
-
Re: Login [Free] im feelin it. Its cool that you provided the PSD so that people can put their game name on or change some stuff.
-
Re: Simple Funtions yeah good point. I havent used mccodes in a while but for my game in the admin pannel i have done a switch include, just makes the coding cleaner. functions.php <?php // The switch functions could be put into a single "switchFunction.php" for all pages // ...all the functions function mailbox() { globals $blah; print 'works!'; } // more functions ?> and if you wanted to code a page all the coding needed would be so much less. <html> <head><title>Example</title> <body bgcolor="#cccccc"> <h3>Example Page</h3> <div style="width:60%; border:1px solid #666666"> <?php switch($_GET['action']) { case '1': index(); break; case '2': mailbox(); break; default: index(); break; } } ?> </div> </body> </html>
-
Re: Simple Funtions <html> <head><title>Example</title> <body bgcolor="#cccccc"> <h3>Example Page</h3> <?php if(isset($_GET['action']) { switch($_GET['action']) { case 'a': include('inc/a.inc.php'); break; case 'b': include(inc/b.inc.php'); break; } } else { index? } ?> </body> </html> instead of having loads of lines of code you could have them included... just a different way of doing it :P
-
Re: [V2] Personal Notepad [V2] looks good
-
Re: login page v1 all u have done is made a huge ass pic and then put text over it and i highly doubt you have got the images copyrighted!