Jump to content

dave420

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Everything posted by dave420

  1. I would suggest reading about this particular GD function: http://uk.php.net/imagettftext That should get you going in the right direction, though it's not exactly a sIFR replacement.
  2. <?php $str = '12032008'; echo substr($str, 4, 4).substr($str, 2, 2).substr($str, 0, 2); ?> Is significantly faster than using regular expressions.
  3. That's because the bit of HTML is 59 characters long, not 51. Maybe it has something to do with the HTML entities in there (as if they replaced the quotes, that would account for the extra 8 characters)?
  4. Curl is perfect for this. It can keep its cookies across multiple requests, so it will stay logged in.
  5. I'd suggest using one of the existing colour-distance functions, such as this one: http://www.compuphase.com/cmetric.htm If you want to find the intermediary, that page should send you in the right direction.
  6. I would suggest doing some benchmarking of the two different methods, and see which one is fastest. They're both going to be as accurate as each other, so it comes down to speed. Calculate a bunch of different distances in both methods and see which one returns fastest, then use that.
  7. It's not ideal, but looking at the documentation, if you could run a PHP script on your server using system(), the duration of that script is not included in the time-out, so even if the script takes an hour to complete, as long as you spend less than 30 seconds outside of that system() call, you'll be fine. Put your image processing in that external script, pass it the parameters it needs to know what to do, and you're set.
  8. Or you could just code it to work with IE and make your point without blocking most internet users out there. Most IE users aren't IE lovers, they are just using IE because that's all they have.
  9. The session data is simply data stored on the web server that is returned to PHP depending on the session ID stored in a cookie on the client's computer. If you give that session ID to another user/browser/computer, it will have the same session data as the first one.
  10. No problem! As it says in the documentation - "Despite the tons of examples and docs, mod_rewrite is voodoo. Damned cool voodoo, but still voodoo".
  11. Personally, I'd suggest creating a tiny user object (either in a session or reading its data from the session), and then query that with the level of the current page. If the user is not logged in, it could redirect you to a login page, and if they are, it can determine whether to allow the user to view the current page or be given a polite message indicating they can't. Using a user object means you can keep all your authentication code in one place, which is a generally a good idea. <?php $level=3; $_USER=new User(); $_USER->canViewPageLevel($level); /* only executed if the $_USER->canViewPageLevel method didn't interrupt normal play */ ?> That would also make it far easier to automate the authentication process, using an auto_prepend_file or a mod_rewrite to a "base" php script, which could then include other files as needed.
  12. It's a great way of doing it - I was simply pointing out a slight consideration one might want to be aware of I wasn't trying to be rude, and I apologise if I seemed that way.
  13. You should also remember the script will time out if it can't send the entire mp3 in 30 seconds (or whatever timeout you have set). Use set_time_limit() to override this. If you want to get fruity, look into accepting byte ranges in your headers, and how to interpret them and send their response-counterparts, which will allow MP3 players to seek/rewind/fast-forward in your streaming mp3s. It's not as tricky as it sounds, and is very useful.
  14. Have you tried putting [L] after the first rewrite rule to stop it being further re-written by the next rule?
  15. pathinfo is more expensive than both substr and strrpos combined, btw, as it looks up more than just the filename without the extension.
  16. It would be cheaper to use: $name=substr($filename, 0, strrpos($filename, "."));
  17. Personally, I'd use a session to store the user's page history as they move through your site. It's useful not just for things like this, but for building up a picture of how people move through your site. If on each page the page appends the current page's URL to, say, $_SESSION['history'], then the login.php page just has to check the last entry, and it knows that's where the user came from. It's invisible to the client, but lets you know exactly how the user got to where they are. If you use an auto_prepend_file, you can put the session history stuff in there, though remember that the login.php file will also count in that history, so it'll have to check for the penultimate entry in the history array, not the last one.
×
×
  • 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.