
ignace
Moderators-
Posts
6,457 -
Joined
-
Last visited
-
Days Won
26
Everything posted by ignace
-
$function = 'add'; if (function_exists($function . 'slashes')) { $value = call_user_func($function . 'slashes', $value); }
-
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.
-
<div id="wrapper"> <div id="content"> <form action="#" method="post"> .. </form> </div> </div> #wrapper { width: 400px; margin: 0 auto; }
-
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
-
need some help with a primary school score board
ignace replied to mightymouse's topic in PHP Coding Help
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 } -
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']}";
-
if ($spot == "Lee") { $SESSION['dir'] = '3'; } elseif ($spot == "Adam") { $SESSION['dir'] = '2'; } Note ==
-
need some help with a primary school score board
ignace replied to mightymouse's topic in PHP Coding Help
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) -
Or go for something more eccentric, like: inserT InTO uPLOADS (uSeRnAmE) VaLuEs (teST) So you are sure it becomes really hard to read
-
I need help about blocking someones ip IF they ...
ignace replied to apoelara13's topic in PHP Coding Help
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. -
I need help about blocking someones ip IF they ...
ignace replied to apoelara13's topic in PHP Coding Help
I successfully registered 3 accounts (and I could add more), names: azertyuiop qsdfghjklm ip-change wxcvbnqsd e-mail used: [email protected] <-- very poor programming -
I need help about blocking someones ip IF they ...
ignace replied to apoelara13's topic in PHP Coding Help
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 -
I need help about blocking someones ip IF they ...
ignace replied to apoelara13's topic in PHP Coding Help
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 -
I need help about blocking someones ip IF they ...
ignace replied to apoelara13's topic in PHP Coding Help
Which I'll show you I'll be able to register more then x accounts (I have a dynamic IP). -
Special chars get converted when inserted into MYSQL database via PHP
ignace replied to MikEst's topic in PHP Coding Help
This is a good thing. Not an error. The manual doesn't mention it, a custom plugin? -
I need help about blocking someones ip IF they ...
ignace replied to apoelara13's topic in PHP Coding Help
No, there just isn't a method to stop people from registering more then 2-3 accounts -
whats the difference between these two loops ??
ignace replied to lostnucleus's topic in PHP Coding Help
<?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. -
whats the difference between these two loops ??
ignace replied to lostnucleus's topic in PHP Coding Help
Nothing, except the number of open- and close-tags -
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())
-
remove the comma after (username)
-
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
-
OP = Original Poster = You
-
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); } }
-
No, ever since you quit PHP it's development halted. Wishing for your return.