Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. Try Dj Kat's solution or try call_user_func_array
  2. It will if the OP queries SELECT .. FROM users WHERE username = $username AND password = $password AND logged_in = 0 Which will return no results as he is still logged in. AND logged_in = 0 Is not so uncommon if you want to disallow re-login. Anyway there are better and more efficient ways to do this: 1) session_set_cookie_params(3600);//remain logged in for one hour session_start(); 2) A sessions table sessions (id, user_id, date_last_modified, lifetime)
  3. list($comment) = mysql_fetch_row($result);
  4. $text = preg_replace('/[^a-z0-9"\s]/i', '', $text); Removes everything except A-Z 0-9, " and spaces. function filter_duplicate($text) { $explode = explode(' ', $text); return implode(' ', array_diff($explode, $explode)); } Like I already said use function explode_conditional($delimiter, $string, $conditional = array()) { return array_diff(explode($delimiter, $string), $conditional); } print_r(explode_conditional(' ', $text2, array('and', 'or', ..))); You will have to provide the list of words you want filtered out yourself.
  5. Fall back to explode(' ', str_word_count really looks for words and filters everything else. echo ucfirst($text1), ' ', implode(' ', array_map('ucfirst', array_diff(explode(' ', strtolower($text2)), explode(' ', strtolower($text1)))))); As for your second question, try: $map = array_map('ucfirst', array_diff(explode(' ', strtolower($text2)), explode(' ', strtolower($text1)))); foreach ($map as $element) { echo $text1, ' ', $element; } This is starting to feel like a challenge function explode_conditional($delimiter, $string, $conditional = array()) { return array_diff(explode($delimiter, $string), $conditional); } print_r(explode_conditional(' ', $text2, array('and', 'or', ..)));
  6. Just create an ordinary AUTO_INCREMENT field with ZeroFill show their userid as SELECT concat(id, username) AS UID .. CREATE TABLE .. ( id INT ZEROFILL NOT NULL AUTO_INCREMENT .. This way you'll get: 0001IGNACE 0002ROBERT Or create your table and set the start index at 1000 That way you'll get: 1000IGNACE 1001ROBERT 1002SERGEY CREATE TABLE .. ( .. ) AUTO_INCREMENT = 1000
  7. You can use str_word_count for that you know. print_r(str_word_count($text, 1)); For the script try: $text1 = 'Paintball mask'; $text2 = 'Paintball tipmann mask v1 series'; echo ucfirst($text1), ' ', implode(' ', array_map('ucfirst', array_diff(str_word_count(strtolower($text2), 1), str_word_count(strtolower($text1), 1)))); //Paintball Mask Tipmann V1 Series Why are you all making it so difficult? If you don't need the First letter uppercase then remove the "array_map('ucfirst'" part.
  8. Wut!? I NEVER use the logout button meaning that your website will show me as logged in ad infinitum if your code is screwed it may also mean I will not be able to login anymore ad infinitum. And why make it so difficult if it's so easy?? session_set_cookie_params(3600);//remain logged in for one hour session_start();
  9. if($_GET['fx'] == 'registreer') Never taught about using the MVC architecture instead of those many IF's?
  10. havenpets do you have any idea what database normalization is? Or database design for that matter? What do you exactly mean by message or item? Message as in PM? Or as in thread? And item as in product? If you mean message as in PM: messages (..) users (..) inbox (message_id, sender_id, is_reply_to, recipient_id, flag_status, ..) SELECT .. FROM inbox i1 JOIN messages m1 ON i1.message_id = m1.id LEFT JOIN messages m2 ON i1.is_reply_to = m2.id LEFT JOIN users u1 ON i1.sender_id = u1.id WHERE (flag_status = 'unread' OR flag_status = 'read') AND recipient_id = $uid Afterwards when the user clicks a message: UPDATE inbox SET flag_status = 'read' WHERE message_id = $mid The reason for flag_status is that you may want to introduce more then just read and unread (cf deleted, marked_as_spam, ..) If you mean message as in thread/topics topics (.., date_last_entry) topics_viewed (thread_id, user_id, date_last_viewed) When the user requests all unread topics SELECT .. FROM topics t1 JOIN topics_viewed t2 ON t1.id = t2.thread_id WHERE t2.date_last_viewed < t1.date_last_entry AND t2.user_id = $uid You apply the same logic for an item but instead of date_last_entry you set date_last_update.
  11. It looks good, although the cart is a little big. Maybe it would also be better to list the items they have added to their cart instead of just saying "10 items" giving them the option to easily re-consider and remove items instead of having to click away from the page they are on. What's the class about? Is it to teach other people stuff?
  12. They use sessions too only they extended the lifetime of the (session) cookie.
  13. We don't delete. Mark it as solved.
  14. Create your website as if you were to create it in ONE language. Afterwards translate it using a SINGLE database table. translations (key, message) <a href="#"><?php print _('Login'); ?></a> Shows Login for English (default language), Aanmelden for Dutch, ..
  15. [ php ] text here [ /php ]
  16. JavaScript is not the best solution as you most likely want this to work even when JS is disabled. More and more users like my Dad have NoScript installed which disables JS for any websites they don't trust.
  17. Create a print stylesheet in your main website you set: <link href="style.css" media="screen" .. <link href="style.print.css" media="print" .. When the user clicks the print preview button you direct them to a PHP page that loads the article and you set: <link href="style.print.css" media="screen" .. This method makes sure that the user always is able to view a print preview either through it's browser File > Print Preview or through your own mechanism.
  18. No I'm not in the development and yes I guess it will die on you in 45 days (although I'm not sure they release so many after one another that I'm using their EAP-software way over 45 days). They'll release it soon and should be free for students and open-source, $88 otherwise. And yes, it looks (and is) awesome Just take a look at that feature set
  19. <div id="menu"> <ul> <li class="selected"><a href="#">Home</a></li> <li><a href="about.html">About</a></li> <li><a href="#">Faqs</a></li> <li><a href="#">Terms</a></li> <li><a href="#">Register</a></li> <li><a href="#">Login</a></li> <li><a href="#">Contact</a></li> </ul> </div> <div id="search"> <form action="#"> <input type="text" name="username" value="" /> <input type="submit" name="search" value="" /> </form> </div> #menu, #search { display: block; float left; }
  20. If you have MS Access you can download the MySQL plugin for ODBC and you can connect to MySQL using MS Access afterwards you can integrate this into Excel (not sure about the Excel part)
  21. Source: http://framework.zend.com/wiki/display/ZFDEV/Choosing+Your+Application%27s+Directory+Layout;jsessionid=56DECAB88B29F9D8603F0EA209DEB31A
  22. Yes, it also supports MD5 and PASSWORD Source: http://dev.mysql.com/doc/refman/5.1/en/encryption-functions.html
  23. ignace

    Education

    For a better and healthier living
×
×
  • 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.