Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. $function = 'add'; if (function_exists($function . 'slashes')) { $value = call_user_func($function . 'slashes', $value); }
  2. The $moduleComposite is an "array" which $menu iterates over and builds the menu. Saying that you may want to take a look at the Builder Pattern. This has ofcourse the disadvantage of building the entire composite tree (instantiating every section and it's containing modules) on the other hand it could aswell write the info to a XML file and read later on by a class that builds the Menu from the XML source. I have no idea of how your application is architect of course, but in order to build your Menu you will have to know all available links for the Sections and their containing Modules or you'll end up with a half menu. You could of course also just add it to a database when the module is installed. Afterwards you read out the database table and build (and Cache, the menu is not that important to query the database on every request) the Menu.
  3. <div id="wrapper"> <div id="content"> <form action="#" method="post"> .. </form> </div> </div> #wrapper { width: 400px; margin: 0 auto; }
  4. 1) You could use the Singleton pattern to create a Menu object, which you would be able to call inside your module to add a navigation element. Although due to it's global nature it is not encouraged. class Menu { private static $instance = null; private function __construct() {} private function __clone() {} public static function getInstance() { if (null === self::$instance) { self::$instance = new self(); } return self::$instance; } } $menu = Menu::getInstance(); Sources: http://en.wikipedia.org/wiki/Singleton_pattern 2) Pass the $module structure to a $menu object. This uses the Composite pattern and is presumably the most encouraged method. $menu = new Menu($moduleComposite); interface MenuInterface {} class Menu { public function __construct(MenuInterface $a) {/*allows other objects to be passed besides the composite*/} } Sources: http://en.wikipedia.org/wiki/Composite_pattern
  5. The best would be to limit this at database level as other applications may in the future write to this database. However MySQL totally ignore's check()'s so your need to verify it at your application-level, like: if ($score > x) { error }
  6. Try: //Store the filename, path other criteria in the database $query = "UPDATE admin(avatar_name, avatar_path) VALUES('$filename', '$filepath') WHERE admin_id = {$_SESSION['admin_id']}";
  7. if ($spot == "Lee") { $SESSION['dir'] = '3'; } elseif ($spot == "Adam") { $SESSION['dir'] = '2'; } Note ==
  8. I really advise you some other mechanism then just enter-it-yourself-and-hope-you-are-honest as you can clearly see in the current table That 2xxxxx.. is the maximum integer value. The person who did that probably entered something like 999999999999999999999 which turned it into a float in PHP and in to an INT in MySQL. Add some logic to prevent to add anything higher then X as I don't imagine your score going anywhere near 100,000 (or 10,000 for that matter)
  9. Or go for something more eccentric, like: inserT InTO uPLOADS (uSeRnAmE) VaLuEs (teST) So you are sure it becomes really hard to read
  10. They don't need to know. Rebooting or restarting is sufficient (as in logging in the next day). However when they see the Register button and click it they'll see they will not be refused to create a third account.
  11. I successfully registered 3 accounts (and I could add more), names: azertyuiop qsdfghjklm ip-change wxcvbnqsd e-mail used: [email protected] <-- very poor programming
  12. Do you have a static IP or dynamic IP? And where do you register? I can't find it. Nevermind, I had NoScript on. They generate their menu using JS, smart for all those people blocking JS
  13. See, manual intervention is required to prevent people from registering 2-3 accounts. LOL, read these rules: http://lastco.net/index.php?categoryid=77 Why call it vote if you may only vote for yourself? -- indicates competence
  14. Which I'll show you I'll be able to register more then x accounts (I have a dynamic IP).
  15. This is a good thing. Not an error. The manual doesn't mention it, a custom plugin?
  16. No, there just isn't a method to stop people from registering more then 2-3 accounts
  17. <?php foreach($data as $moo)?> Is the same as <?php foreach($data as $moo); ?> Therefor $moo contains the last element (as the loops assigns the last element to $moo) and you echo out the last element. This is not a bug I just didn't see it right.
  18. Nothing, except the number of open- and close-tags
  19. CSS Help?
  20. views (thread_id, user_id, date_last_viewed) To select all unread threads SELECT field, field FROM views RIGHT JOIN threads ON views.thread_id = threads.id WHERE threads.date_last_comment > views.date_last_viewed AND (views.user_id IS NULL OR views.user_id = $user_id) When a user views a thread INSERT INTO views (thread_id, user_id, date_last_viewed) VALUES ($thread_id, $user_id, now())
  21. remove the comma after (username)
  22. How do you know how they look or taste? Ever ate one? 1) Store the current page a user is viewing 2) Query the database for rows that match the current page
  23. OP = Original Poster = You
  24. I'm pretty sure it worked (with register_globals = On) That's why you can't rely on it, if it's off your @#!$ed Here I rewrote your script: if (isset($_POST['submit'])) { $db = mysql_connect('localhost', 'example', 'example'); mysql_select_db('concierge', $db); $login = mysql_real_escape_string($_POST['login'], $db); $password = mysql_real_escape_string($_POST['password'], $db); $query = "SELECT privilage FROM auth WHERE login = '$login' AND password = '$password'"; $result = mysql_query($query, $db); if (0 === mysql_num_rows($result)) { header('Location: ../../index.php'); exit(0); } $row = mysql_fetch_assoc($result); $privilage = $row['privilage']; session_start(); $_SESSION['username'] = $login; $_SESSION['privilage'] = $privilage; if ('receptionist' === $privilage) { header('Location: ../../employees/receptionist/index2.htm'); exit(0); } if ('manager' === $privilage) { header('Location: ../../employees/managers/index1.htm'); exit(0); } if ('administrator' === $privilage) { header('Location: ../../admin/index.php'); exit(0); } }
  25. No, ever since you quit PHP it's development halted. Wishing for your return.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.