Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. No. It's not. For some reason it's a function that takes some input and performs two validation functions and one other function and concatenates the results together. Fixing the other error that the arguments to strip_tags are the wrong way round and with the test input " Foobar " we get the result " Foobar Foobar Foobar Foobar". Does that look right to you? <?php function clean($text){ $text=strip_tags($text); $text.=trim($text); $text.=filter_var($text,FILTER_SANITIZE_STRING); // works in php 5 only return $text; } $example=clean(" Foobar "); echo htmlentities($example,ENT_NOQUOTES); ?> Now, ignoring the fact that this function clearly does not work there is no one single function you can use for every single example. Validation is not that simple. Nothing really is. Now please, stop posting it everywhere. It doesn't impress anyone.
  2. For the love of god, why do you keep posting that function all over this forum? It doesn't work. It's very pointless
  3. LaTeX is also used extensively in scientific papers, journals and the like. I guess i'm really going to have to get to grips with it at some point.
  4. Large != infinite. Unlimited == overselling. Unlimited == hiding behind a vague fair usage policy in order to avoid stating actual limits.
  5. So what happens? What doesn't happen? What's supposed to happen? Are there any errors? We need a bit more info than "it's not working" and your code
  6. I don't know. Is it more childish than all the typo names? Flickr, Digg, Reddit, Google etc. All of those seem to be doing pretty well. The name is short, easy to remember, type and pronounce. I'm not particularly disputing the name (though i don't particularly like it), it's more the pronunciation...
  7. What the hell? That was one of the most weird adverts i've seen in a while. So the economic crisis is because people can't find the information they want? Riiiight. Also 'bing!' sounded very...childish? That sound bite alone would put me off :s
  8. Assuming you have an apache webserver, you could use mod_rewrite to do something like this. But on a different note, why would you want to? A few people have asked this sort of thing before because they felt it would add some sort of security -- it wont.
  9. Off topic, irrelevant, and unhelpful replies would damage the reputation of the forum. So, you have got to be kidding well no one has even tried to help me Did you stop to consider that it might be because of the way you're asking questions? Or, perhaps, that your attitude sucks? You don't have some god-given right to receive help from this board. No-one gets paid here. People give up their free time to help people. Sure, they probably get something out of it too but that's really not the point.
  10. If you've encrypted something then you can decrypt it. An encryption function is by definition injective. I'm pretty sure Gareth was talking about MD5.
  11. md5 != encryption. It's a hashing algorithm. As such, it cannot be decrypted and is one-way. You may be able to use reverse-lookup tables(aka rainbow tables)/and or brute force in order to find another string generating the same hash -- but you cannot guarantee to get the original back. There was a discussion here about this too. The thread's a few pages long though, so you might get bored. In short, use MD5 + a salt to secure your passwords. Then, as Garethp says, you hash the inputted password (along with the same salt) and compare it against the original.
  12. You can do what you're after with a few of the string functions. E.g: strlen and substr_replace. In future, please try to wrap your code in tags. And welcome to the forums.
  13. Less work for you maybe. But more work for the PHP engine. Admittedly it's not going to make a huge difference in the grand scheme of things, but yeah.
  14. Session IDs are, by default, stored in a cookie anyway. Unless you start passing the session ID around in the URL, you're still relying on the user having cookie support enabled. And if you do pass it around in the URL, you increase the risk of session hijacking. Use cookies only to store things you want to store between visits to your site. I.e. if you want a remember me function then you'll be needing cookies. Otherwise, use sessions.
  15. You're just missing an equals sign on this line: <input type="text" name"user"/> It should be: <input type="text" name="user"/>
  16. PHP is a server side language -- once the data has been sent from the server to the user, it can do no more. If you want to have a button to delete a file, you need to make another request to the server. If you want to do this without the entire page reloading, you can do so with AJAX. I suggest you look for some beginner tutorials on that.
  17. Line 3 is trying to set a session variable to something in the $_POST array. That something doesn't exist. Either you've a.) Not submitted the form before viewing this page, b.) set your method to GET and not POST, c.) set the name of the form input to something other than 'user' -- don't forget it's case sensitive; user is different from User or d.) done something else i cant think of right now. Maybe if you post up your form code we can help you further.
  18. It boggles my mind why so many people always skip the most obvious choice when they want to learn PHP. To be fair, the PHP manual is exceptionally good as documentation goes -- i bet it's quite a lot easier to learn from than most. I think there's a temptation to assume that official documentation is very difficult to understand and it's much easier to learn from someone else's 'translation' of it. On the other hand, being able to learn from documentation is definitely a good skill to develop.
  19. Why would you escape it twice? You'd only need to escape it after running it through the hash function that produces special chars as it's output. If you're using MD5, it's unnecessary to escape the string at all. I.e. this: $password = md5($salt . $password ); Is no more safe than this: $password = md5( mysql_real_escape_string( $salt . $password ) );
  20. I disagree. If all you're looking to do is alter the number of elements you can see at one time, the size attribute is what you need.
  21. I guess that's what you get for trying to write code after having far too much beer in the afternoon :s Ah well, im still glad my exams are (almost) over.
  22. Use hours an minutes: $hours = range(1,11); $hours = array_unshift($times,12); $timeOfDay = array('am','pm'): $minutes = array(15,30,45); foreach($timeOfDay =>$amOrPm){ foreach($hours as $hour){ echo '<option value="' . $hour . $amOrPm .'"> ' . $hour . ':00' . $amOrPm .' </option>' foreach($minutes as $minute){ echo '<option value="' . $hour . ':'. $minute . $amOrPm .'"> ' . $hour . ':'. $minute . $amOrPm .' </option>' } } }
  23. By offering all those perks, Google no doubt get the best out of their employees though. Treat your employees shit, they produce shit.
×
×
  • 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.