Jump to content
MakeWebGames

Vali

Members
  • Posts

    150
  • Joined

  • Last visited

    Never

Everything posted by Vali

  1. Re: Template Request!   :| no...
  2. Vali

    Yahoo! YUI Board?

    Re: Yahoo! YUI Board? check out jQuery, it's easier to use.
  3. Re: Template Request!   Who are you and what you did with Miniman?
  4. Re: [Review]Rise Of Lycans noce, what do the people donate for? what do they get for the donations?
  5. Re: Stop people from using IE on website   That's just stupid... IE6 and other browsers act pretty much the same, and you only need browser "hacks" 0.001% of the time (alpha transparent PNG being one of those times). If you can't make your site look similar on all browsers the first time you write your code, then your not doing it right and need to learn basic html/css. Also, even if it was 25% of the users you will throw away, that's 25% of the money you advertise thrown away and all the users those users would have brought in.
  6. Re: Stop people from using IE on website Why would you throw away 25% to 60% of your possible clients? just fix the site so it looks good in IE.
  7. Re: will this secure my website? you MUST validate ALL user input. So, if it comes from the browser, you validate it, and escape it.
  8. Re: will this secure my website? Use this: <?php /** * Function will return the requested value, or NULL * * @param string $val * @return string */ function validateInput($val) { $response = NULL; if (isset ( $_POST [$val] )) { if (is_array ( $_POST [$val] )) { $response = $_POST [$val]; } else if (trim ( $_POST [$val] ) != "") { $response = trim ( $_POST [$val] ); } } else if (isset ( $_GET [$val] )) { if (is_array ( $_GET [$val] )) { $response = $_GET [$val]; } else if (trim ( $_GET [$val] ) != "") { $response = trim ( $_GET [$val] ); } } if (get_magic_quotes_gpc () == 1) { return ($response); } else { return (addslashes ( $response )); } } ?>
  9. Re: [uPDATED!] Basic ajax is easy The 3rd example gives a 404
  10. Vali

    RSS Reader

    Re: RSS Reader   I just love that site lol
  11. Re: Question for all game owners Read the good FAQ file mate, all you have to do is copy paste that code in your site. Usually, the footer, and on EVERY page, so you can track all user actions.
  12. Re: Apache help... Just redirect the user at register.php, index.php?action=register looks really ugly... Then you can use htaccess to show the index.php script with action=register from there.
  13. Re: Secure Names? Please help. Just use some regular expression on the names: /[a-zA-Z0-9\-_]+/ (Basically a to z, 0 to 9, - and _ are allowed) If they fail that, then ask the to add a new user name.
  14. Re: Anything wrong with my database class?   You should only have 3 or 4 places with SQL in your code in my example, all in the same abstract class (extended by your game classes). #1 constructor: SELECT * FROM $table WHERE $PK = '$id' #2 & #3 save - On insert: "INSERT INTO $table SET [changed fields joined by ',', in the KEY=escaped(VALUE)] - On UPDATE: "UPDATE $table SET [changed fields joined by ',', in the KEY=escaped(VALUE)] WHERE $pk = '$id' Notice that the "[changed fields joined by ',', in the KEY=escaped(VALUE)]" is always the same, so you don't have much SQL around. #4 some "find" function. Once you have that abstract class, your user class should look like this: <?php class User extends myAbstractClass { } ?>   If you want to do some "magic" when you change some field in the user, say score when you build a soldier, you do this: <?php class User extends myAbstractClass { # Overload the setter public function __set($var, $val) { # We get 10 points for every soldier if ($var == 'soldier') { $this->score = $this->score + ($var - $this->soldier) * 10; } # Call the parent's setter parent::__set($var,$val); } } ?>   If you want to set some variables to the user that are not in the database, say the "age" of a profile. <?php class User extends myAbstractClass { # Overload constructor public function __construct($id = null) { # Load the object parent::__construct($id); # Make sure we have a register date (in case it's a new object) if ($this->register_date == null) { $this->register_date = now(); } # Calculate the age in days, there are 86400 seconds in a day $this->age = $this->register_date / 86400; } } ?>   Notice the lack of SQL queries. Ps: this code was posted as an example, so you should probably find a better way to implement it.
  15. Re: Rings of Orbis I would take a step back, and look at the site from a user's point of view. A user that never seen the site before, and has no clue what to expect. (A lazy user that doesn't want to read a ton of text :p) Then, go through the site and see if things make sense. That, or get someone that never played the game to go and try to play it. Just watch them and don't tell them what to do. If they can figure it out, it's good, if they take their sweet time, you have some work to do. :-P
  16. Re: Anything wrong with my database class? That's php4, php 5 doesn't use 'var' in classes and so on. You class is a good start, but look into "magical functions", namely the __get and __set With it, you can do something like this: <?php # Load user ID 5 $user = new User(5); # Print some user data echo $user->name; echo $user->email; # Set some data $user->name = 'my new name'; $user->email = '[email protected]'; # Save the user $user->save(); # # Create a new user (not loaded) # $newUser = new User(); # Set some data $newUser->name = 'my new name'; $newUser->email = '[email protected]'; # Save the user $newUser->save(); ?>   Now, tell me that's not much leaner to work with? I'll let you figure out how to create the class for this, it shouldn't be that complicated for you, and I think you'll learn a few things.
  17. Re: Anything wrong with my database class? Hey You should use php 5 for this class, it will be allot cleaner. Also, can you post some usage examples?
  18. Re: Rings of Orbis ya, the graphics are nice. But tried to play the game... and got to say, I don't really get it. There's way to much stuff on screen at once, so it gets confusing for new players.
  19. Re: A little help with $_POST To see what was posted: <?php print_r($_POST); ?>   Say you post the field "num": <?php // Validate post for ($i = 0; $i < $_POST['num']; $i++) { echo 'bla '; } ?>   Read up on for loops: http://us3.php.net/manual/en/control-structures.for.php
  20. Re: army template:battle field Home/Rules/Login/Register buttons need some work. That white bar under those buttons looks a bit strange. Let menu needs some work (links) Rest looks pretty good.
  21. Re: Usless comments in threads need to go bye bye   That is not 100% correct: Check out: http://www.metacafe.com/watch/51123/pepsi_vs_coke/
  22. Re: Usless comments in threads need to go bye bye Tried to stop people bashing some 60$ script... but didn't go so well. :|
  23. Re: What would be better to use? Test it out: >> http://dev.mysql.com/doc/refman/5.0/en/explain.html
×
×
  • Create New...