Browse | Submit A New Snippet

Snippets by category: HTTP

Snippet ID Title Creator
Snippets
134Online User Counterandreash
This script counts the number of users currently viewing that page, or site.
Uses PHP4 Sessions and MySQL.
15Browser Detectorepsilon7
/******************************************
** 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
18getting an urltahmer
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
26STEP SPYkrychek
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.
34Headlines Grabberneilm
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.
45Anti - Leech 2.0pcordero
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.
47404 handlershaun
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!
49Sets META tag for REFRESH to when page will be updatedconanford
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.
59URL 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.
62Access Countersimmad
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
64Simple IP Deny, v.1robbo_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.
76PHP Client Sniffer Classepsilon7
/******************************************
** 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

========================================================================

'****************************************/
77PHP Redirectorrmacii
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
89Spider/Robot Re-Directspxdcz
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.
136Test Cookies Enablesebicas
Test is the user have Cookies Enable
150User Friendly Grabberfyndalf
Grabs the URL of today's User Friendly comic.
155ICQ Message Senderwhizz
A function that sends an ICQ message to specified UIN thru www.icq.com web interface.
206HTTP 1.1 and 1.0 Cache Validatorgallir
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
221Simple Hit Loggerskreem
This script simply reads/increments a hit counter from a text file.
230PHP handler for Apache mod_spelrvasquez
This piece of code will interact with Apache's mod_spel module and return results that lets you customize the output.
239PHP Radius Authenticationmavetju
Use a radius server to authenticate your users.
264Active HTTP Sessions using SNMPsheran
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.
328SimpleSession - a powerful URL-based session handler classostor
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
339Email Validitysanjeev_vaidya
Check if the entered email address is valid or not.
336Check Email Validitysanjeev_vaidya
It will check weather the entered email address is in correct manner or not.
349mime_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.
352POST METHODozoon
Simple script to use post method for sending data to webserver.
424PHP4: Session Management from within your own functionswhyzzi
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.
1248Replace value of a parameter in a query stringagent
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.
496Quick Webmaillentin64
With this, you can check your mail.
1209Simply 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 )
558class2xmlsmckone
Convert a php class to an xml string.
559Yahoo movie time rippersmckone
Get the showtime of movies at any theater listed on movies.yahoo.com. Information stored in a 3d array.
562Simple Login Scriptdataphix
This will work on all https and http securely without knocken overhead down. And its just plain simple
582Login 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
583EZEmaillentin64
Gets email from user and server
592phpaccessmahype
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.
601Magic Cookielentin64
This is a secret script; but I'll explain anyway. This stores the code in your harddrive. It is like Sessions.
608WebSearchlentin64
Searches AllTheWeb, Google, Yahoo, Excite and more search engines and turns it into an array. Manual included in script.
685Weather.com Scriptlentin64
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
636Using Session - Basic Examplejrdiller
Start a session, register a variable i nthe session, use the session variable, unregister the session variable, destroy the session.
641Sending Multipart Mime Encoded Emaildmcinnis
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.
654iTemplatemligor
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...
665Raw POST Datadannys
Gets the raw post data from any post operation regardless of enctype.
808MailMe (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...
1014ReCountreedme
A simple PHP counter.
1189Breadcrumb Navigation classstevevs
Breadcrumb navigation. Very easy to implement.
1281GetStringpingveno
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
704A parser class for mime.typesboesswetter
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.
733Cookie Based Entrance Pagemikeh
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.
742Proxy bypassnhorvath
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.
759Block an ISP from your sitelavawarp
This code blocks an entire ISP (by domain) from your website. This example shows you how to block AOL users from your site.
820Listmepittendrigh
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.
882URLsdmitry
Class that abstracts URL.
890WebProxyanunakin
Open Any page with image support and a joke form support.
898PHP multilanguagekakchan
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
929Hit Counterharmonius
Basic hit counter we made as a little project to learn about PHP. 2 Files
1169HTTP Authentication using mysqlscoyle74
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.
1164PHP Web Statistikphpstatistik
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
1163PhpProxytopot
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.
1212Simply Web monitoringjoele29
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.
997Marquee Functionlymfnode
Just a little bit o' code that displays a marquee with the text and design that you specify.
1086Detik.Usabledodysw
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.
1088fopen() via proxy servernightowl
Fopen() normally does not support a proxy server. This function replaces the fopen() of an url via a proxy server. All comments welcome!
1117Htaccess User Management and Authentication Systemamitpadhye

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.
1145Redirect and Block surfers by Country or Anonymous Proxyvotive
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.
1150urlStrEncode / urlStrDecodefredscalliet
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 ;-)
1409Search Engine Spider BOT Logger Tool SETcustomizedscrip
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