Welcome To Snipplr
Everyone's Recent PHP Snippets
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
Creating thumbnails of the images is required many a times, this code will be useful to know about the logic of thumbnail generation.
0
1019
posted 15 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
991
posted 15 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
789
posted 15 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
756
posted 15 years ago by paulgrenwood
This code will create a human readable string that will look more close to dictionary words, useful for captchas.
0
2208
posted 15 years ago by paulgrenwood
This function will fetch the real IP address of the user even if he is behind a proxy server.
0
890
posted 15 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
924
posted 15 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
837
posted 15 years ago by paulgrenwood
This function converts URLs and e-mail addresses within a string into clickable hyperlinks.
0
930
posted 15 years ago by paulgrenwood
One drawback: Removal of button leaves a small indent in first line of paragraph, probably an element:style DIV. Don't yet know how to get rid of that.
1
759
posted 15 years ago by thesislab
Helpful for remembering useful CURLOPT constants. Taken from an example in the php manual comments.
3
1074
posted 15 years ago by DrewDouglass
This a simple wrapper for cgi, write in php, use stdin for post, and query_string env, for get
=)
0
778
posted 15 years ago by renatoelias
I use this to activate basic forms for clients. Just make sure your form input names are named appropriately. Any inputs such as phone or fax that are separated into different inputs should have the same name.
1
1069
posted 15 years ago by dmautz1
agento, an open-source PHP ecommerce solution, has a very comprehensive feature list. However, its built-in CMS doesn’t support hierarchical pages. You can fake it, though.
Let’s say you have a page with an SEF (search engine friendly) URL Ide...
0
1006
posted 15 years ago by nico65
This snippet is just an upgrade to the "http://snipplr.com/view/7396/php-file-extension-case-changer/" code. This particular code works on image files... although you can just change this line [if (preg_match("/(jpg|gif|png|bmp)/",$ext)) ] to target...
0
1474
posted 15 years ago by el-artiste
i know these regex stuff is rather slow, but still i like having slim documents. (don't forget to use gzip compression on all text docs)
3
972
posted 15 years ago by iroybot
This code is not made by me : But it was used for one of my projects. This code scans for all png files in a directory and creates a 100x100 thumbnail and moves it into a specified directory.
:.INCLUDES A DATA TEXT CODE WHICH PUTS THE NAMES OF ALL...
2
916
posted 15 years ago by brandonio21
This code is not made by me : But it was used for one of my projects.
This code scans for all jpeg files in a directory and creates a 100x100 thumbnail and moves it into a specified directory.
:.INCLUDES A DATA TEXT CODE WHICH PUTS THE NAMES OF A...
3
823
posted 15 years ago by brandonio21
This code is not made by me : But it was used for one of my projects.
This code scans for all gif files in a directory and creates a 100x100 thumbnail and moves it into a specified directory.
:.INCLUDES A DATA TEXT CODE WHICH PUTS THE NAMES OF AL...
2
856
posted 15 years ago by brandonio21