Browse | Submit A New Snippet
Snippets by category: HTTP
| Snippet ID | Title | Creator |
| Snippets | ||
| 134 | Online User Counter | andreash |
| This script counts the number of users currently viewing that page, or site. Uses PHP4 Sessions and MySQL. | ||
| 15 | Browser Detector | epsilon7 |
| /****************************************** ** Description : BrowserDetector ** File Name : browserDetector.php3 ** Author : epsilon7 for PHyX8 studios ** Author Email : epsilon7@asphyxia.com /> ** Created : Thursday, May 11, 2000 ** Last Modified : Wednesday, July 12, 2000 ** Modified By : epsilon7 *' INFO: Returns Browser information based on HTTP_USER_AGENT Ported from The Webmonkey JavaScript Source ##BrowserDetector() ##Parses User-Agent string into useful info. ##Source: Webmonkey Code Library ##(http://www.hotwired.com/webmonkey/javascript/code_library/) ##Author: Rich Blaylock ##Author Email: blaylock@wired.com /> Usage: include("browserDetector.php3"); $bd = new BrowserDetector; Variables: $bd->BROWSER // Netscape, MSIE, Opera $bd->PLATFORM // Win95, Unix, Windows 98, Mac, PPC, etc. $bd->VERSION // MajorVersion.MinorVersion $bd->MAJORVER // Major Version (before . in version string) $bd->MINORVER // Minor Version (after . in version string) '****************************************/ Testing : Mozilla/4.73 [en] (Win98; U) Browser : Netscape Platform : Win98 Version : 4.73 Major Version : 4 Minor Version : 73 | ||
| 18 | getting an url | tahmer |
| function that read an url with http header from a web site. usefull for : - detecting or sending cookie - manually launch php3 script without browser interaction | ||
| 26 | STEP SPY | krychek |
| STEP SPY is a simple yet useful PHP script for tracking the footsteps of visitors on your site. By including this script in all your pages, you can log such information as the IP of the visitor, what pages and when he/she visited, and in what order into a MySQL database. If you find this script useful, please let the author know. | ||
| 34 | Headlines Grabber | neilm |
| This script allows you to add daily headlines, weather, or stock charts to your website. It retrieves source code from a file or URL. This script relies on a unique start and end string to mark the beginning and end of the html you wish to retrieve. | ||
| 45 | Anti - Leech 2.0 | pcordero |
| Allows visitors to only access pages on your site through a link and only from your domain. Don't need to know the reffering page. Change the domain to yours and paste into all pages needed. Visitor can not access a page directly through the URL. | ||
| 47 | 404 handler | shaun |
| Specify this script as your ErrorDocument 404 in .htaccess. The script will print out the 404 page, *plus* email the details of the error to you. Don't wait for your visitors to tell you about broken links - let your server tell you! | ||
| 49 | Sets META tag for REFRESH to when page will be updated | conanford |
| If you have a page that is automatically updated on a pre-set interval, this code snippet is for setting the user's browser to update it on the next interval. Typically people just set the update interval to, say, 500 seconds, but you'd really like it to update when it's ready. This way, they reload probably right around when it's done. If you're concerned about load balancing issues with lots of users loading a page at once, you could add a random factor as well. | ||
| 59 | URL Validation | codexx |
| This is a dirty page I threw together to validate an URL by actually checking the DNS rexcord fro the site supplied and then checking wether I get an 404 for the supplied path or file. The page does not look pretty, alter it to your likings. | ||
| 62 | Access Counter | simmad |
| This counter can do: -count how many visits you got :-) -ignoring reloads(if the new ip is the same or older than "Wait") as the last one accessed ! -show the date on which the counter started (in a unix timestamp See at the end for formating) -show the last visited date/time(in a unix timestamp See at the end for formating) -show the ip of the last visitor -show pictures (named 1.jpg, 2.jpg ...0.jpg) If ya like this or got better ideas drop me a line: Simmad@gmx.at /> www.simma-online.at | ||
| 64 | Simple IP Deny, v.1 | robbo_tutausend |
| If you put this script at the top of your pages, you can deny the configured IP from viewing your pages. It has an option to notify you by email if there is a request from the configured IP. | ||
| 76 | PHP Client Sniffer Class | epsilon7 |
| /****************************************** ** Description : PHPClientSniffer ** Version : 1.0.0 ** File Name : PHPClientSniffer.php3 ** Author : Roger Raymond for PHyX8 studios ** Author Email : roger.raymond@asphyxia.com /> ** Created : Wednesday, August 23, 2000 ** Last Modified : ** Modified By : *' INFO: Returns client information based on HTTP_USER_AGENT BASED ON WORKS AND IDEAS BY: Tim Perdue of PHPBuilder.com http://www.phpbuilder.com/columns/tim20000821.php3 The Ultimate JavaScript Client Sniffer by Netscape. http://developer.netscape.com/docs/examples/javascript/NAME_type.html ======================================================================== USAGE: ======================================================================== include("PHPClientSniffer.php3"); $is = new sniffer; ======================================================================== VARIABLE NAMES VALUES ======================================================================== $is->UA The HTTP USER AGENT String $is->NAME Browser Name (Netscape, IE, Opera, iCab, Unknown) $is->VERSION Browser Full Version $is->MAJORVER Browser Major Version $is->MINORVER Browser Minor Version $is->AOL True/False $is->WEBTV True/False $is->JS Assumed JavaScript Version Supported by Browser $is->PLATFORM System Platform (Win16,Win32,Mac,OS2,Unix) $is->OS System OS (Win98,OS2,Mac68k,linux,bsd,etc...) see code $is->IP REMOTE_ADDR ======================================================================== '****************************************/ | ||
| 77 | PHP Redirector | rmacii |
| This script redirects you to either a defined query or just a http site. It has support for custom queries and it logs all redirections to a txt file. No MySQL needed | ||
| 89 | Spider/Robot Re-Direct | spxdcz |
| Quick script to 'redirect' spiders/robots to 'search engine friendly' page (full of keywords, etc.). Does NOT use javascript redirect, etc., so robot does not know that it has been detected. Normal (non-robot) users will be directed to the normal looking page. | ||
| 136 | Test Cookies Enable | sebicas |
| Test is the user have Cookies Enable | ||
| 150 | User Friendly Grabber | fyndalf |
| Grabs the URL of today's User Friendly comic. | ||
| 155 | ICQ Message Sender | whizz |
| A function that sends an ICQ message to specified UIN thru www.icq.com web interface. | ||
| 206 | HTTP 1.1 and 1.0 Cache Validator | gallir |
| Dynamic pages normally doesn't hand cache expires and modification very nicely. Also web caches and browsers have problems with dynamic contents. I provide a function that is called with the last modification date of the data base/dynamic content. It complies with HTTP/1.1 (RFC2616) and HTTP/1.0 strong and wek validators. It also takes in account, and differentiates that the same page might beaccesed anonymously or user authenticated. The original version was implemented in bulma.lug.net, which uses PHP4 and Postgres7 | ||
| 221 | Simple Hit Logger | skreem |
| This script simply reads/increments a hit counter from a text file. | ||
| 230 | PHP handler for Apache mod_spel | rvasquez |
| This piece of code will interact with Apache's mod_spel module and return results that lets you customize the output. | ||
| 239 | PHP Radius Authentication | mavetju |
| Use a radius server to authenticate your users. | ||
| 264 | Active HTTP Sessions using SNMP | sheran |
| This script will output the current active HTTP sessions on any web server by querying the respective SNMP OID. You need to have the php_snmp.dll extension enabled in your php.ini file and also have the 'extensions' directory set. Your server should also be running SNMP as a service. | ||
| 328 | SimpleSession - a powerful URL-based session handler class | ostor |
| 4 Files: ses.php - main file, contains server-side PHP code. ses.js - contains some client-side JavaScript routines. ses1.php - sample file, demonstrates features, loads ses2.php ses2.php - sample file, demonstrates features, loads ses1.php Installation: - split the text into 4 files - copy all the files into a test dir, and diplay ses1.php or ses2.php in your browser. Description: - Feature-rich session managing class for PHP 4.0.x. - Never uses cookies, so always working on the same way for every browser. Transmits the session ID through URLs, keeps track name-value pairs in files. Supports expiration, various URL handling features, etc. Version information: 1.0 (2001-may-12) - Initial release. - Independent of PHP's own session handling code - Transmits session id through URL - Stores variable names and values in plain text files. - Supplies URL managing functions for seamless web-page integration - Contains session handling examples for links, GET forms, POST forms, self-calling JavaScript drop-down lists - Tunable automatic expiration settings on a per-session basis. - Performs regular, tunable garbage collection of expired server-side session files. - as does not use cookies, it is nothing to with headers, and the session handling code may be placed anywhere on the PHP page - MD5-based session ID generation - Session config parameters used from php.conf: -- session.name -- session.save_path -- session.gc_maxlifetime -- session.gc_probability | ||
| 339 | Email Validity | sanjeev_vaidya |
| Check if the entered email address is valid or not. | ||
| 336 | Check Email Validity | sanjeev_vaidya |
| It will check weather the entered email address is in correct manner or not. | ||
| 349 | mime_lookup() | pauls |
| See http://inebria.com/mime_lookup/ - this function parses the mime.types file, builds an array keyed by file extension, and the function mime_lookup() returns the mime type (if any) found for a given file extension. Newer versions might only be found on my web site. | ||
| 352 | POST METHOD | ozoon |
| Simple script to use post method for sending data to webserver. | ||
| 424 | PHP4: Session Management from within your own functions | whyzzi |
| I've been wanting to create session information from within a function, trying to keep code clean. This example depicts one? method of passing the current session onto the page, utilizing a seperate file to hold all session functions. | ||
| 1248 | Replace value of a parameter in a query string | agent |
| A function to add or replace the value of a particular query parameter. It assumes typical &-separated parameters. -- Parameters -- $query The query string, still url-encoded. $param The query parameter to change the value of. Not url-encoded. $value The new value for the parameter. Not url-encoded. Returns the new query string, with parameter names and values url-encoded. | ||
| 496 | Quick Webmail | lentin64 |
| With this, you can check your mail. | ||
| 1209 | Simply FAQ Script | joele29 |
| Simply FAQ - is a fully functional easy to use FAQ program with seach capability, unlimited categories, NO NEED for mysql database only text base and with NO compicated setup just upload it and its done, it uses only one(1) PHP file. How simple to add the content of your FAQ, just open your favorite text editor and start typing in the first line the Question and in the next line the answer and so on, save it with .faq extension and the script will automatically read this, the filename of this file will be the Category name in the FAQ section. To sort which categories to be first, just add a number on the first character of your filename ( ex. 1how_to.faq, 2Others.faq ) | ||
| 558 | class2xml | smckone |
| Convert a php class to an xml string. | ||
| 559 | Yahoo movie time ripper | smckone |
| Get the showtime of movies at any theater listed on movies.yahoo.com. Information stored in a 3d array. | ||
| 562 | Simple Login Script | dataphix |
| This will work on all https and http securely without knocken overhead down. And its just plain simple | ||
| 582 | Login script (no database needed) | copycat |
| This little snippet is a login script wich works like the .htaccess file. But you wont need any database setup. Very userfriendly, just cut n paste... =P | ||
| 583 | EZEmail | lentin64 |
| Gets email from user and server | ||
| 592 | phpaccess | mahype |
| The htaccess class manages the htaccess functions of Apache Webservers. Without knowing much knowledge of Apache, users can be added or deleted, groups can be created anddeleted, .htaccess files can be created with this class etc. | ||
| 601 | Magic Cookie | lentin64 |
| This is a secret script; but I'll explain anyway. This stores the code in your harddrive. It is like Sessions. | ||
| 608 | WebSearch | lentin64 |
| Searches AllTheWeb, Google, Yahoo, Excite and more search engines and turns it into an array. Manual included in script. | ||
| 685 | Weather.com Script | lentin64 |
| this little script in a class will show you everything on the weather including Barometer and text forecasts splitting \n so you can replace \n with <BR>. borrowed some of the code from a site and really changed to make it so it was from scratch | ||
| 636 | Using Session - Basic Example | jrdiller |
| Start a session, register a variable i nthe session, use the session variable, unregister the session variable, destroy the session. | ||
| 641 | Sending Multipart Mime Encoded Email | dmcinnis |
| This function allows you to send a multi part mime encoded email (HTML and Plain Text). You pass the HTML and TEXT messages in as strings. | ||
| 654 | iTemplate | mligor |
| iTemplate is PHP class for dynamic creating web pages. You can simple and very fast crate parts of template whose have to be in loop, replace values from template, and include another template file... | ||
| 665 | Raw POST Data | dannys |
| Gets the raw post data from any post operation regardless of enctype. | ||
| 808 | MailMe (on Errors) | afwebteam |
| This script notifies webmaster on 401,403,404 and 500 errors through e-mail, sms and icq. Very usefull for dynamic site webmasters... | ||
| 1014 | ReCount | reedme |
| A simple PHP counter. | ||
| 1189 | Breadcrumb Navigation class | stevevs |
| Breadcrumb navigation. Very easy to implement. | ||
| 1281 | GetString | pingveno |
| Assembles a URL or URI based on a target script and variables to be sent to via the "get" method Licensed under Creative Commons Attribution-ShareAlike 2.5 | ||
| 704 | A parser class for mime.types | boesswetter |
| A small PHP-class that gives you access to the mime.types file that comes e.g. with apache. It is useful if you want to set the "Content-type" header before you output a file whose type is only known by its extension. | ||
| 733 | Cookie Based Entrance Page | mikeh |
| If your site has an entrance page and you would like that entrance page to ONLY be displyed if they haven't seen it, this is what you need. When someone views your site, a page is called and if that someone has not visited the Entrance page,it will create a cookie on the client's computer upon entry. If that someone has already visited your site and a cookie has been made, it will show the main page of your site. All of which can be configured. Easy to do. Only have to change 4 lines. | ||
| 742 | Proxy bypass | nhorvath |
| For all you students out there with over-restrictive internet access this will get around it! Just open this page from school and enter the desired url. The internet blocking software thinks its viewning a harmless page and not the blocked one! There is a MySQL based login built in that can be uncommented and used if you have access to a MySQL database as well. | ||
| 759 | Block an ISP from your site | lavawarp |
| This code blocks an entire ISP (by domain) from your website. This example shows you how to block AOL users from your site. | ||
| 820 | Listme | pittendrigh |
| This is a formatted directory lister, where tables_listme and frames_listme inherit from abstract class listme. Any files found in the current directory (that are not $PHP_SELF) are turned into leftside links. Images and optional captions are displayed on the right, as are the contents of text files. Html files a openned in a separate window, as are external links. | ||
| 882 | URL | sdmitry |
| Class that abstracts URL. | ||
| 890 | WebProxy | anunakin |
| Open Any page with image support and a joke form support. | ||
| 898 | PHP multilanguage | kakchan |
| php multilanguage is an effective way to manage multilingual sites also is good the possibility to add an high number of language IS NOT NECESSARY NOTHING LIKE: SQL,ORACLE eccc..... ONLY A WEBSERVER WITH PHP SUPPORT Introduction: PHP multilanguage set is composed with 3 standard files: the first is index.php3, the pseudo-first page of the site.. a languageset folder that contains the dictionary for languages Language.php files located in languageset/it or /us or /languageyouwant | ||
| 929 | Hit Counter | harmonius |
| Basic hit counter we made as a little project to learn about PHP. 2 Files | ||
| 1169 | HTTP Authentication using mysql | scoyle74 |
| This is the basic code that I have used that allows users to authenticate using HTTP, PHP and simple mysql. This allows you to utilize your database without having to hard code your user/pass in the script or use the .htaccess or another flat/text file. | ||
| 1164 | PHP Web Statistik | phpstatistik |
| no MySQL required,module based,random order, ,own CSV logfile (very small!),different sort modes,make the stats in your language,custom design (css),web based admin console(password protected), following stat modules are available: browser,operating system, provider, country, referer,year,month,day,weekday,hour,page impressions (PI),last X hits,visits,page order,visitors of the last X days,referer hits of the last X days,search engine keywords,search engines,screen resolution, java,javascript,flash,color depth,expected visitors | ||
| 1163 | PhpProxy | topot |
| PhpProxy is a web-based HTTP proxy software written in PHP, which allows users to browse the net without restrictions and anonymously,without having to modify their browser's SOCKS proxy options.Its aims are to be easy to use and lightweight. PhpProxy supports the automatic modification of href, src, and action attributes of HTML tags to route all those requests back through the script as well as URL and page scrambling features.it also support GET,POST data to server,pass cookies to host! it support download zip,tar.gz and so on.Currently,phpproxy supports http and https which require install OpenSSl moudule at server. | ||
| 1212 | Simply Web monitoring | joele29 |
| You can monitor your website downtime status including SMTP, POP, FTP and SSH. and automatically send alert to the assigned email in the config.php. | ||
| 997 | Marquee Function | lymfnode |
| Just a little bit o' code that displays a marquee with the text and design that you specify. | ||
| 1086 | Detik.Usable | dodysw |
| Grab news and reformat to usable design, from Indonesia's foremost online news Detikcom at www.detik.com. It can also operate as proxy for other detik.usable, caching, and easily extended for other function. | ||
| 1088 | fopen() via proxy server | nightowl |
| Fopen() normally does not support a proxy server. This function replaces the fopen() of an url via a proxy server. All comments welcome! | ||
| 1117 | Htaccess User Management and Authentication System | amitpadhye |
You must have always wondered to provide Authenticated access to your webpages or a web directory and provide the User management to the admin of the website. But then if the webpages are static pages then you have to use the .htaccess authentication system and then comes the problem of providing administration to the admin for adding, modifying and deleting users. But I have developed a web based administartion module for .htaccess authentication system which provides the admin with an interface to add, modify and delete the users from the .htpasswd file which is used to store the Usernames and Passwords. The System requires PHP, Perl and MySQL. | ||
| 1145 | Redirect and Block surfers by Country or Anonymous Proxy | votive |
| This code allows webmasters to take control of surfers to their sites. By redirecting clients according to what country they come from or whether or not the surfer is using an anonymous proxy, webmasters are able to provide customised content directly to their audience. | ||
| 1150 | urlStrEncode / urlStrDecode | fredscalliet |
| Encodes/decodes a string to/from an url-argument compatible one. ("my page" => "my%20page"). I suspect that such functions already exist in the basic package, but I couldn't find them in the doc so I coded some anyway ;-) | ||
| 1409 | Search Engine Spider BOT Logger Tool SET | customizedscrip |
| PHP script to log search engine / spider visits to your homepage. SUMMARY: Find out out when and where search engine bots / spiders are crawling your site. Features: email reports and/or log file reports for 32 spiders / bots, monitor php and html files REQUIREMENTS: PHP4 or later http://www.customizedscripts.biz/search_engine_bot_watcher.html | ||

