Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. insert: echo '<p>'; before the first echo in the while and insert: echo '</p>'; just before the closing }
  2. Cheers! No, tiredness (masquerading as stupidity!) - I concede that. Rw Just a joke rwwd
  3. This one has bugged me since it came on, but for the life of me I couldn't put my finger on what was wrong with it, if your right Ignace (which I don't doubt you are) Do I feel stoopid - or what, doh.. Rw stoopid, no - unexperienced, maybe PHP != Java You can't do this for example in PHP: public class SomeJavaClass { private SomeJavaClass parent = new SomeJavaClass(); }
  4. try { $gateway = new UserStoreGateway(); $user = $gateway->createRow($_POST); $user->save();} catch(DbServiceUnavailableException $e) {} catch(UserAlreadyExistsException $e) {} This might be more re-usable then a simple Database object that would act as a grand Façade for everything Database.
  5. You can't have a function in a class variable declaration.
  6. colspan="all" => <div/>
  7. @OP 1) Using globals inside functions/classes is bad practice. 2) Login::filter() is a violation of SRP (Single-Responsibility, and quite a few others: DRY for example) as I doubt you want to create an instance of Login class whenever you need to filter data.
  8. Typically I wouldn't because until the user successfully logs in we can't actually speak of a "User" as we know nothing about him only that he's a Guest/Visitor (a Special Case of "User" at best). In the login procedure we create a personification of the User on the system which leads me to believe that the login procedure should be handled by a Creational Pattern: like Factory (or Builder if the personification requires multiple steps as could be the case with an ACL). That's of course the modeler inside of me, from an SRP-perspective a login() method on a User-class is of course perfectly fine.
  9. Hi, What do you think about this design? I'm teaching myself Photoshop
  10. CREATE TABLE do ( your INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, own VARCHAR(32) CHARACTER SET utf8 NOT NULL, homework TEXT CHARACTER SET utf8 NOT NULL ) ENGINE = MyISAM;
  11. @Rakuhana 1) An image preloader may not be ideal, it's still better then having your images load slowly one-by-one on the web-page. 2) XHTML??? IE never even has supported XHTML (try to load index.xhtml in IE, it won't even work) as it renders it just like HTML. Almost every website that uses "XHTML" has it's content-type set to "text/html" while this should be set to "application/xhtml+xml" for XHTML documents.
  12. You are looking for an Access-Control List (ACL). If you want to assign permissions on a per-user basis you can use: user (id) resource (id) acl (user_id, resource_id, permission) If you want to make it for a group of users: user (id, role_id/group_id) role/group (id) resource (id) acl (role_id/group_id, resource_id, permission) Where permission is allow/deny and a resource can be something like 'add_comment'. In your application you can then add something like: if($acl->isAllowed('add_comment')) {
  13. The use of the Autoloader is encouraged.
  14. ignace

    zend tool

    Open the zf.bat with a text editor.
  15. No, they are not. Your design isn't normalized or optimized, mine is.
  16. It didn't strike me as one It would, every user has a locale setting (not saying this is entirely reliable but it will give you an idea of what languages the user can speak). It would look for Kings of Leon on YouTube, MusicSearch, and Lyrical.
  17. You have a unique concept but have gone it the wrong way. When a user consults a search engine that means they want what they are looking for fast, your website does not satisfy that need it merely provides a shortcut while it can be that much more IMO. A better approach would have been if you showed the top 10 results of the major search engines (Google, Bing, Yahoo) if they didn't select a search engine. I also noticed that when you select a search engine, YouTube for example you get a "prefix" I like this but I hate it that I still need to select it and can't just type "youtube<space>" to filter my results to a certain engine. Chaining up to 3 (or more) search engines would also be a nice feature, something like: "youtube<space>musicsearch<space>lyrical<space> kings of leon" would be transformed into "[musicsearch][lyrical] kings of leon" and show results out of those 3 search engines sorted on highest relevancy.
  18. Your table should look somewhat similar to: user (id, user_name, password)status (id, user_id, status, posted_at)like (status_id, user_id, liked) In mySQL this would be: CREATE TABLE user ( id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, user_name VARCHAR(32) NOT NULL CHARACTER SET utf8 COLLATE utf8_bin, password CHAR(40) NOT NULL CHARACTER SET ascii, INDEX idx_user_logon (user_name, password), UNIQUE idx_user_name (user_name)) ENGINE = MyISAM;CREATE TABLE status ( id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, user_id INT UNSIGNED NOT NULL, status VARCHAR(160) NOT NULL CHARACTER SET utf8 COLLATE utf8_bin, posted_at DATETIME NOT NULL, INDEX idx_status_user_id (user_id)) ENGINE = MyISAM;CREATE TABLE like ( status_id INT UNSIGNED NOT NULL, user_id INT UNSIGNED NOT NULL, liked TINYINT(1) NOT NULL DEFAULT TRUE, INDEX idx_like_status_id (status_id), PRIMARY KEY (status_id, user_id)) ENGINE = MyISAM; This design should cover most of your bases (user_name should only be registered once, user_name|password index for login, ..).
  19. ignace

    zend tool

    You can use the Zend tool with the Zend tool created file structure any other structure means you'll have to re-write pieces of the Zend tool.
  20. No. Would you complain if someone made you extra revenue?
  21. Using require() isn't safer then using include() as they are technically the same except require() will halt the script if it can't find the file.
  22. curl_setopt_array($curlConfig); should be curl_setopt_array($curl, $curlConfig); and reading "Object required: 'oXML.documentElement'" I think it's not possible to send from PHP to ASP
  23. If your websites text remains the same you don't have anything to fear. You do need however to put a 301 (or 302?) to the new page.
  24. Here's the translation. Please note that I didn't test it because I couldn't (192.168 is type C -> local) Making it work will be your end of the bargain. $companyKey = '212121'; $server = 'http://192.168.1.111/'; $xml = '<?xml version="1.0" encoding="utf-8"?>' . '<LeadImportDatagram>'. '<CompanyKey>' . $companyKey . '</CompanyKey>' . '<NotificationEmailTo>joeschmoe@aol.com</NotificationEmailTo>' . '<LeadInfo>'; foreach($_POST as $key => $value) { //This code assumes that the form fields match up exactly with the node names, including uppercase/lowercase. //You may need to write custom code here if that's not true for your form. $xml .= '<' . $key . '>' . htmlentities($value) . '</' . $key . '>'; } $xml .= '</LeadInfo>' . '</LeadImportDatagram>'; if(substr($server, 0, 4) != 'http') $server = 'http://' . $server; if(substr($server, -1) == '/') $server = rtrim($server, '/'); $curlConfig = array( CURLOPT_POST = > true, CURLOPT_RETURNTRANSFER => true ); $curl = curl_init($server . '/xml/importlead.php'); curl_setopt_array($curlConfig); $responseText = curl_exec(); $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); if($httpCode != 200) { echo 'Error sending XML: ' . $responseText; exit(0); } header('Location: thanks.php'); exit(0);
  25. Take a look at http://builditwith.me (no one ever said your degree can't be profitable )
×
×
  • 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.