Welcome To Snipplr


Everyone's Recent PHP Snippets



1 ... 107 108 109 110 111 ... 147
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 874 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 699 posted 15 years ago by paulgrenwood
0 748 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 648 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 1856 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 764 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 795 posted 15 years ago by paulgrenwood
Provide files to the user by forcing them to download.
0 921 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 742 posted 15 years ago by paulgrenwood
This function converts URLs and e-mail addresses within a string into clickable hyperlinks.
0 813 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 623 posted 15 years ago by thesislab
Helpful for remembering useful CURLOPT constants. Taken from an example in the php manual comments.
3 942 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 665 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 935 posted 15 years ago by dmautz1
I've made some changes
2 748 posted 15 years ago by fetolio
0 1028 posted 15 years ago by optimiseweb
2 881 posted 15 years ago by JREAM
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 885 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 1323 posted 15 years ago by el-artiste
0 563 posted 15 years ago by iloveitaly
0 648 posted 15 years ago by gfazioli
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 841 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 796 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 717 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 728 posted 15 years ago by brandonio21
This function will add soft hyphens after every 3rd character in words of over 10 characters. It will not leave fewer than three characters following a soft hyphen. Known bugs: Adds soft hyphens to URLs and within HTML tags.
0 702 posted 15 years ago by DaveChild
1 ... 107 108 109 110 111 ... 147