PX : algorithms : other

parent section: algorithms (0)

TitleAuthorRating Views Last Modified    
Persistent Multi-dim 0.01 Mark Henderson -- 10013 1998-02-12 07:54:22 [ show ]
These 2 functions write and read the contents of a specially designated multi-dimensional array to and from a text file.
PHP version as integ 0.1 Michael Grier -- 8833 1999-04-15 13:19:13 [ show ]
This example prints the version of php as an integer. This is useful for determining if features requiring a certain version are enabled, i.e. if $phpver >= 304 then day of the month without leading zero is enabled.
lat/long distance 1 David Sklar -- 18792 1998-10-19 17:18:44 [ show ]
Calculate the great circle distance between two latitude/longitudes
Simple counter 1.0 Istvan Korsos -- 11142 1999-04-17 13:19:42 [ show ]
This is a very simple, text-based counter. I wrote it, because I prefer text-based counters instead of any "shiny" graphic counter, which can never fit the design of my page. It is very simple, absolutely works for only only one page, but can be modified easily. I think the code explains itself. Best regards. Istvan from Hungary (korsos@freemail.c3.hu)
phpself 1.0 Lukas Loesche -- 12845 1999-04-19 10:45:04 [ show ]
This small pice of Code puts the name of the current Document into $docname. Very usefull for eg. <FORM ACTION="<?echo $docname;?>" METHOD=POST>
Dumper 1.1 Jan Fredrik Leversund -- 11303 1999-04-19 19:53:42 [ show ]
Dumper is a PHP3 implementation of Perl's Data::Dumper. It reverse engineers a data structure into a human readable and PHP3 parseable format, suitable for debugging or storing and retrieving. It still needs some work on class objects.
ShortUrl 1.0 Philip Hofstetter -- 9151 1999-10-19 13:33:47 [ show ]
This function takes a string containing a URL and returns a shorter form of it: The function removes all the directories from the URL: http://host.com/dir1/dir2/test.html?test=test becomes http://host.com/.../test.html?test=test This is usefull when writing a linklist for example when the URL must be short to fit into the Layout.
DebugVariables excellent Thomas Hansmann -- 10580 1999-10-14 11:36:32 [ show ]
one function to show any php-variable, even arrays and objects in an under- standable way.
Simple Counter Vamsi Nath -- 9658 1999-10-25 16:50:39 [ show ]
A simple counter which can be used on any page within your site.
MPCount 1.02 Sascha Blansjaar -- 7252 1999-11-17 14:17:27 [ link ]
MPCount is a multiple page counter which stores the number of hits and the date when started counting per page in a single file. Includes MPCount Admin to view your counter stats in a table.
OX Dejchai Srihakim -- 6168 1999-12-09 13:20:43 [ link ]
O and X
global config 0.2 rustang -- 8683 2000-01-18 04:40:01 [ show ]
This code allows you to use configuration files that are included for every php request in a directory. If a configuration file is not found in the current directory, the script crawls up the directory tree to the root of your domain looking for a configuration file, and includes the first one it finds. You must set the php3.ini directive: auto_prepend_file=thisfilename.php3
Topic Roundup 1.0 Brian -- 10873 2000-02-25 21:53:50 [ link ] [ show ]
I could not find a script to rotate through my topics so I made one myself.
phod - PHP Open Directory v1.0 Angus D Madden -- 10266 2000-03-02 05:57:43 [ show ]
A code which parser data from dmoz's Open Directory and enables you to customize it to your site's look and feel. (php 3.0.14 and above
TreeClimber First Stephan Beal -- 10058 2000-03-02 07:44:30 [ show ]
A simple PHP class which can recursively climb down directory trees and return all files (and, optionall, directories) under a given path.
Simple Hit Counter - without database Tobasco -- 8698 2000-03-16 03:59:43 [ show ]
The simplest of simple web counters, all this code does is count the number of times a specific page is visited.
Vegas Forum 1.0 John Raab -- 8755 2000-03-28 03:50:41 [ link ]
Vegas Forum is a multi threaded discussion board written completely in PHP and mySQL. Authored by: John Raab aka "Johnny_Vegas"
Bookie 1.1 Brian -- 24111 2000-04-15 18:05:57 [ link ] [ show ]
Just a little guestbook that I made that uses no database or SQL stuff. It is very easy to install.
SE TEST 1.0 Andrew Browne -- 13505 2000-04-20 21:59:29 [ link ] [ show ]
Simply a test!
Refer 1.0 Brian -- 8331 2000-04-21 20:20:14 [ link ] [ show ]
Show variables & values 1.0 Alex Rozhik -- 11517 2000-05-03 14:17:52 [ link ] [ show ]
This code show variables and values list. use dd("GLOBALS") to show program state in browser
test test greg -- 13424 2000-05-13 21:40:17 [ link ] [ show ]
test
Associative array to global variables 1 Ondra Zizka -- 9779 2000-05-27 05:35:35 [ show ]
Takes an ass. array and defines variables named by arr's field names, opt. suffixes and preffixes. arr["hi"]=="there"; <br> arr2vars($arr, "say_", "_1"); <br> //-> $say_hi_1=="there" <br>
Check ISBN 1.1 Keith Nunn -- 9808 2002-12-04 12:47:26 [ link ] [ show ]
Checks an entered isbn (with or without hyphens) to see if it is valid.
Posting to a unkown no. of variables Brian A. Knudsen -- 5202 2000-06-21 10:21:32 [ link ]
This code snippet helps you, when you are posting a unspecified no. of variables. It simply traverses the cgi variables to find the variables of a given prefix, and returns an array of values. This eliminates unecessary nested ifs, and is all in all quite cool ;) ... remember to visit http://www.sacred.dk, SDK - Sacred.DK, for a 800+ script library.
get mp3 id3 tag Michael Bayer -- 10107 2000-07-08 18:01:51 [ show ]
Function that returns the id3 tag from an mp3 file
PHP Arvind K Mathur -- 7773 2000-07-19 13:26:10 [ link ] [ show ]
PHP Weather 1.17 Martin Geisler -- 8149 2000-08-06 05:03:03 [ link ]
PHP Weather makes it easy to show the current weather on you webpages. Every hour a round the clock airports make a METAR-report, where they measure things like the temperature, the wind speed and direction etc. The data is converted to both empirical and metric units and is cached in a MySQL database for fast retrieval.
XML Tree Maker Class .001 hans -- 10749 2000-09-29 17:49:36 [ link ] [ show ]
Easy class takes XML data and makes it into objects named as the tags in the XML data, with the cdata for values. Can also be used for statistics on the XML file. See http://www.hansanderson.com/php/xml/ for more information and samples.
Motel Quote Christine Perry -- 7632 2000-11-05 01:28:19 [ link ] [ show ]
Figures motel room rates on 5 different type rooms dependent on #adults, #children, and #days spent
Calculate Distance Between Two ZIP Codes or Postal Codes 1.0 Hexa SDC -- 9873 2004-07-25 01:59:01 [ link ] [ show ]
This algorithm calculates distance between two given coordinates ie. latitude and longitude from ZIP code or postal code. It is suitable for store locator, route planner, shipment estimation etc.
Dynamic Link List v1.0 Stephan jau -- 12557 2001-02-22 11:16:22 [ show ]
Hello, this is one of my first scripts. It lets you create an link list for your webpage based on categories. This one works on with PHP / MySQL. Currently, the categories are sorted by the time of creation... first one created => first one shown. If you have any improvements, please mail me at webmaster@wsjb78.com Ok, the inc file configures the overall layout. index.php is the main file post.php is the form to add new entries link.php is the form submission and includes the index.php file. linklist.sql is the file containing the MySQL table parameters.
Dynamic Link List v1.0 Stephan jau -- 5053 2001-02-22 11:18:44 [ show ]
Hello, this is one of my first scripts. It lets you create an link list for your webpage based on categories. This one works on with PHP / MySQL. Currently, the categories are sorted by the time of creation... first one created => first one shown. If you have any improvements, please mail me at webmaster@wsjb78.com Ok, the inc file configures the overall layout. index.php is the main file post.php is the form to add new entries link.php is the form submission and includes the index.php file. linklist.sql is the file containing the MySQL table parameters.
odd and even - single liner 0 Marcel -- 4804 2001-06-08 08:29:46 [ show ]
odd and even - single liner (a replacement for the code by yoshikuni tamura)
Triangle Solver 1.0 Matt Vassilakos-Long -- 4959 2001-12-15 15:22:13 [ link ]
Solves Triangles From any three parts of that triangle, using Basic Trigonometry. Even Solves Ambiguous Case.
Remove from array Mårten Andersson -- 5206 2002-07-30 07:33:56 [ show ]
This simple function removes a specific index number from an array and returns a new array shortend by 1.
Diff function 1.0 Joris van Eil -- 6217 2002-09-05 08:32:31 [ link ] [ show ]
Finds difference between 2 docs/strings! Great for backup/undo system for your site's content management sys! Now i did, i can undo any little change i ever made and revert to old versions if i wanted to.
diff function 1.0 Joris van Eil -- 5143 2002-09-05 08:34:33 [ link ] [ show ]
Finds difference between 2 docs or strings. Great for backup/undo systems in your content management sys!
recursive add commas 1.0.0 reficul -- 4754 2002-09-08 21:04:50 [ show ]
add commas into a price(salary) string
aris mulia harahap aris mulia harahap -- 4295 2004-02-20 00:42:56 [ show ]
<?php //////////////////////////////////////////////////// // // // Credit card validation routine // // May 15, 1998 // // By Brett Error // // brett@interwebdesign.com // // // // validateCC($number[,$type]) // // Uses the MOD 10 algorythm to determine if a // // credit card number is valid. // // // // $number = credit card account number // // $type is optional. Setting type to // // visa, mastercard, discover, or amex will // // perform additional checking on the account // // number. // // // // The function returns 1 (true) if the CC is // // valid, 0 (false) if it is invalid, and -1 if // // the type entered does not match the supported // // types listed above. // // // //////////////////////////////////////////////////// function validateCC($ccnum, $type = 'unknown'){ //Clean up input $type = strtolower($type); $ccnum = ereg_replace('[-[:space:]]', '',$ccnum); //Do type specific checks if ($type == 'unknown') { //Skip type specific checks } elseif ($type == 'mastercard'){ if (strlen($ccnum) != 16 || !ereg('^5[1-5]', $ccnum)) return 0; } elseif ($type == 'visa'){ if ((strlen($ccnum) != 13 && strlen($ccnum) != 16) || substr($ccnum, 0, 1) != '4') return 0; } elseif ($type == 'amex'){ if (strlen($ccnum) != 15 || !ereg('^3[47]', $ccnum)) return a; } elseif ($type == 'discover'){ if (strlen($ccnum) != 16 || substr($ccnum, 0, 4) != '6011') return 0; } else { //invalid type entered return -1; } // Start MOD 10 checks $dig = toCharArray($ccnum); $numdig = sizeof ($dig); $j = 0; for ($i=($numdig-2); $i>=0; $i-=2){ $dbl[$j] = $dig[$i] * 2; $j++; } $dblsz = sizeof($dbl); $validate =0; for ($i=0;$i<$dblsz;$i++){ $add = toCharArray($dbl[$i]); for ($j=0;$j<sizeof($add);$j++){ $validate += $add[$j]; } $add = ''; } for ($i=($numdig-1); $i>=0; $i-=2){ $validate += $dig[$i]; } if (substr($validate, -1, 1) == '0') return 1; else return 0; } // takes a string and returns an array of characters function toCharArray($input){ $len = strlen($input); for ($j=0;$j<$len;$j++){ $char[$j] = substr($input, $j, 1); } return ($char); } ?>
Build Query String From Multidimisional Arrays 1.0 Michael -- 4773 2004-12-26 21:45:28 [ show ]
Pass this function an array (Multidimisional is fine) and This function will returned a 'flattened' key=value pair from any array. You can add code if pre/post fixes are needed for numeric keys. I tried to keep the recursive part as simple as possable for speed. Well commented and can be used for other purposes. NOTE: PHP5 users have a builtin already.
TinyUnit: The Simplest Unit Test Framework that Can Possibly Work 1.0 Don Quichote -- 2867 2005-07-13 12:14:48 [ link ]
A very basic and simple unit testing framework in PHP5
Floyd-Warshall Implementation 1.0 Janne Mikkonen -- 6061 2005-09-10 23:21:56 [ link ]
PHP Implementation of Floyd-Warshall algorithm to find out shortest path from point A to B.
Power Form Validation 1.0 Zeljko -- 5371 2008-02-20 13:37:39 [ link ] [ show ]
Power Form Validation is class which helps us to validate form inputs just in few lines of code. When form inputs successfully pass procedure of validation they can be printed, inserted in database etc. With helps of this class we can control if is field empty or if is component selected, controls with help of Regular Expressions if is e-mail address entered on right way, controls if values of two components have same value, if is entered value in text box in form of letters, if is entered value in text box in form of numbers, if entered value is longer that given value, if entered value is shorter that given value, if entered value is equal with given value, how many components are not selected or in how many of them value is not entered.. Author: Zeljko Radulovic Documentetion:http://pad.pmf.kg.ac.yu/am/index.php?action=preg_kursa&co_id=7
micheal us micheal -- 2820 2005-12-21 06:11:57 [ link ]
23401
Flash/XML Applet Collection 1.1 tufatmarketing -- 2812 2006-07-08 12:10:31 [ link ]
16 XML-based Flash applets for any website. 100% of the Flash 2004 Pro source code included, fully configurable via external XML and JPG files.
Flash/XML RSS 2.0 Viewers 1.2 tufatmarketing -- 2963 2006-07-08 12:13:41 [ link ]
A set of simple RSS readers with fresh designs and animation. These will read RSS 2.0-compliant XML feeds. 100% of the Flash source code is included.
Google Maps API Distance Table Calculator 1.0.0 tufatmarketing -- 3248 2006-07-08 12:17:13 [ link ]
Given two tables of addresses - sources and destinations - this software creates a pivot table-like display of all distances & driving times. Requires only a server with PHP - no database necessary.
Register Globals function 1.1 Hamish Milne -- 2588 2008-04-03 09:20:00 [ show ]
I know lots of scripts require register globals to be on, and lots of hosts don't support it. This function registers the entire $GLOBALS array as independent variables. Tested on PHP 5.2.3 but should work on PHP3+.
PHP Easy Installer 1.0.1 Chara Miteo -- 1777 2009-02-02 09:31:11 [ link ]
This is a very easy-to-setup PHP script for creating an user-friendly installation wizard. The script is suitable for existing and new web applications. If you planning to create application in PHP and search for small, customizable and powerful installation module - PHP Easy Installer is the best solution for you. Easy to setup, easy to customization and easy to work with. This script allows you to make an installation process a very simple as far as possible. The script may be easily customizable for any project.
PHP AdminPanel Chara Miteo -- 1767 2009-12-15 04:22:44 [ link ] [ show ]
PHP AdminPanel (PHP AP) provides you access to the control features of your site as creating static or dynamical pages and allows your easily manage database tables with embedded PHP DataGrid. It includes Creating, Reading, Updating and Deleting (CRUD) records in database tables on your existing site. You can edit menu options "on fly" and create new menu just in a few clicks. For a few minutes you get professional looking and fully functional Administration Panel for your new or existing site. PHP AdminPanel allows you to create DataGrid pages, even without programming knowledge! It dramatically reduce the development time of your web application.
PHP Thai support 1 xphp -- 1710 2009-11-13 10:37:01 [ link ] [ show ]
PHP Thai support help your coding
ApPHP Hotel Site 2.0.1 Chara Miteo -- 1690 2010-08-12 05:44:13 [ link ] [ show ]
ApPHP Hotel Site is a powerful hotel management and on-line reservation site script. This script is the fully functional PHP solution to manage small to medium size of hotels, holiday flats or guesthouse. Visitors of Hotel site will be able to search rooms availability with an online booking reservation system. They also could view rooms inventory, check availability, and book reservations in a real-time.
fforum 0.3 Bernd Roemer 4.0 11082 1999-10-22 13:11:56 [ link ]
a MySQL-based forum with a treestrucure to reach the entries... 100%html.. NO JScript, NO Cookies...
1 2 Stanley Morgan 5.0 37986 1999-08-15 13:34:32 [ link ] [ show ]
3
array_merge_assoc Markus Diersbock 5.0 5024 2004-01-11 20:37:01 [ show ]
Takes two related indexed arrays and combines them into one associative array.

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.