paulgrenwood


Member since 2009

18 snippets

20037 profile views

0 Comment(s) Posted

View their favorites

Profile

Achievement

first submission:submitting first snipplet

paulgrenwood's Recent SnippetsTagged php



« Prev 1 Next »
Set up and array of filenames, which correspond to the file names of the images you are trying to randomize.
0 1953 posted 17 years ago by paulgrenwood
Variables that are submitted via web forms always need to be cleaned/sanitized before use in any way, to prevent against all kinds of different malicious intent.
0 1764 posted 17 years ago by paulgrenwood
2 1981 posted 17 years ago by paulgrenwood
E-mail validation is perhaps the most used validation in web forms, this code will validate email address and also optionally check the MX records of the domain provided in email address to make email validation more robust.
2 2356 posted 17 years ago by paulgrenwood
This function will truncate strings only at word breaks which can be used to show a teaser for complete article without breaking words.
0 2099 posted 17 years ago by paulgrenwood
Creating thumbnails of the images is required many a times, this code will be useful to know about the logic of thumbnail generation.
0 2177 posted 17 years ago by paulgrenwood
Some times you need to accept some url as input but users seldom add http:// to it, this code will add http:// to the URL if it’s not there.
1 2385 posted 17 years ago by paulgrenwood
With most of the popular web services like Twitter providing their data through APIs, it is always helpful to know how to parse API data which is sent in various formats including JSON, XML etc.
1 1808 posted 17 years ago by paulgrenwood
0 1964 posted 17 years ago by paulgrenwood
This snippet uses isset() instead strlen() to verify a PHP variable (in this example $username) is set and is at least six characters long.
0 1674 posted 17 years ago by paulgrenwood
This code will create a human readable string that will look more close to dictionary words, useful for captchas.
0 6490 posted 17 years ago by paulgrenwood
This function will fetch the real IP address of the user even if he is behind a proxy server.
0 1975 posted 17 years ago by paulgrenwood
If you don’t need human readable string, then use this function instead, which will create a random string you can use for user id’s etc.
1 1991 posted 17 years ago by paulgrenwood
Provide files to the user by forcing them to download.
0 4111 posted 17 years ago by paulgrenwood
With this snippet, you can encode any email address into HTML entities so that spam bots do not find it.
0 1874 posted 17 years ago by paulgrenwood
This function converts URLs and e-mail addresses within a string into clickable hyperlinks.
0 2032 posted 17 years ago by paulgrenwood
0 1890 posted 17 years ago by paulgrenwood
« Prev 1 Next »