Algorithms Arrays Passwords Uncategorized
Commerce Uncategorized
Databases Abstraction Layers Informix LDAP MS SQL MySQL ODBC PostgreSQL Uncategorized
Date & Time Calculators Conversion Translation Uncategorized
Discussion Chat Forums Guestbooks Polls Uncategorized
Email Validation Uncategorized
External Uncategorized
Files and Directories Uncategorized
Games Uncategorized
Graphics 3-D Graphs Resizing Thumbnails Uncategorized
HTML Forms Menus & Navigation Source Viewers Tables Templates Uncategorized
HTTP Authentication Cookies File Uploading Uncategorized
I18N Uncategorized
Math Uncategorized
Miscellaneous Uncategorized
Searching and Trees Uncategorized
Security Uncategorized
Text Uncategorized
Utilities Calendars Counters Link Checkers Weather Uncategorized
XML Uncategorized
| php sample source codes |
|---|
|
The class can be used for manipulating unix password files, created with htpasswd. It is possible to add, remove and update users.
|
|
Creates cookies to keep track of a logged in user. A lot of md5 + server-side secret keeps normal "crackers" from forging tickets. Good for times when you don't have SSL.
UPDATE:
For added security, place secret.php outside of your web tree so that if PHP breaks they can't easily reach the hash value.
Also, forgot to add the PASSWORD into the hash! Silly me!
TODO:
Make the cookies update as the user continually checks in so that the cookies expire after X seconds of INACTIVITY vs. a flat 36000 seconds.
|
|
This is a function which will format the passed string depending of it's specified to be a number or a string, in order to avoid problems with SQL injections in scripts.
|
|
Avoid URL injection. Easy to improve the security (phising, etc..) of your site if you are calling one .php to centralize all your DB connections.
|
|
This is a piece of code to help reduce security holes at the application level.
|
|
If you need to check if the current user's IP address is either within a set range or matches a given IP use this function. Possible uses include additional security for an authentication script.
IP range needs to be in form 12.34.56.78-12.34.67.89
|
|
If you want to use PHP to display emails without fear of spambots taking them for ill-use,
when you don't have an encryption algorithm, here is a simple and usefull tool to both hide and present emails with sessions and random encoding.
This is how you can easily encode your emails on a webpage.
This works by generating a unique password to attach to each email being encoded per page in a random place.
To see a error, copy and paste a email link into a new window.
|
|
gencoder is a simple php encoder that use base64 algorithm to encode and decode the script, unlike zend encoder, this script won't solve your problem from hiding the source code from advance programmer but at least you're one step closer to making your code tougher for people to steal
|
|
Very simple functions to create a logins table in a mysql db, add hashed/encrypted usernames and passwords, and authenticate.
|
|
Keycom Version2 (production tested)- This is a class to store values in a conacated string. This string can then be passed as a post variable to a child program. As the internals of the variable are not exposed this provides the most security. A companion script securepage.php checks for the existance of this post variable. The combination of the class and script allows for completely secure (cookie-less) www programing with spider friendly clean urs's.
|
|
// ********* License COMPLETELY FREE NO GUARENTEE ********************
// keycom_class - where security is essential. Cookieless passing of post variables.
// This class will enable the user to pass all necessary variables in a
// secure fasion to the child php page.
// it accomplishes this by creating objects that search and or replace the
// variables one desires to pass in a conacated string
// This is shot # 2 on creating classes so beware
// Thanks for your interest. Ian A. Stewart
|
|
All you need is this include file and a control statement on any page you wish to authenticate users from.
|
|
If you are making a admin tool for your site you can add all the users into a table called e.g. "users" and automaticaly generate a .htpasswd file from it. This function uses MD5 encryption.
|
|
Simple code for a secure login and low over head to boot. And dammit it just plan works lol.
|
|
A Membership section for your website. It still needs the signup section. If you have any problems... shane@mics.co.za
|
|
Authentication and page permission using session variable.
|
|
Uses the .htpasswd to authenticate access to your PHP script
|
|
****************************************************************************
*** PHP Protect Plus ***
*** v 1.0 ***
*** www.phpclub.site.ir ***
****************************************************************************
To protect your html pages, first copy this file to the page's directory then rename html page to .php and add the line bellow to the first line of your html page:
[ Replace "protect.php" with the name of this file ]
Also for php files, just add the above line to the first line of code.
The first time, use "admin" for username and "phpclub" for password.
"admin" user is just for managing users. It can not be used for browsing protected pages.
If you want to make a logout link, link to : "protect.php?logout=1" or any protected .php file with "?logout=1" .
|
|
I used a html form that has a password field named password and a submit button named submit. When the submit button is clicked the page reloads with the $password variable sent back to the server. Then when php resends the html to the client it includes the appropriate javascript to redirect them to the correct protected page.
|
|
This class uses integer bitmasks to represent permissions.
This allows for easy and acurate storage of complex permissions.
To aid in ease of use the class will convert bitmasks to an associative array of boolean permissions and then convert the array back to a bitmask for easy storage.
|
|
with php function acl (facl) you can restrict function-, variable- and include/required-file-access
|
|
Filter out unwanted PHP / Javascript / HTML tags.
This class can filter input of stray or malicious PHP, Javascript or HTML tags and to prevent cross-site scripting (XSS) attacks. It should be used to filter input supplied by the user, such as an HTML code entered in form fields.
I have tried to make this class as easy as possible to use. You have control over the filter process unlike other alternatives, and can input a string or an entire array to be cleaned (such as $_POST).
|
|
Simple and relativity safe login scripts for web sites with secret contains and multiple users. All traffic is loged to MySQL database for possible latter analysis... This scrips work correctly only with PHP 4.2 and higher...
|
|
This is a bit of code that includes several tools that can be used to implement a PKI at the application level of your PHP-Javascript applications.
|
|
Ce script permet de detecter la presence
d'intrus dans le systeme grace au controle
de l'integret des fichiers.
|
|
Phrozen, The idea, you want to encode your scripts, however you don't want to have to make the end user install something to "un-encode" your script. Well, here is a poor-mans solution to that. This does real-time encoding-decoding of the files and the file is only left on disk for exactly enough time for it to be read and parsed.
This is one solution, feel free to email me if you use this in a project, I would like to see how others have used it.
|
|
Simple and raw php port scanner
|
|
A very simple yet usefull portscanner.
|
|
This simple security check ensures that a php script does not receive any unexpected rogue GET or POST vars. Just call this simple function at the top of each script to help protect it from malicious attacks.
|
|
This is describe how we can protect php include file unser directory that not protected, this is simply done using php function
|
|
If you are sure that GET/POST/COOKIE values are not modified by user, you may be able to reduce lots of overhead for checking values. This function provide means to make sure GET/POST/COOKIE values that are set by PHP programmer are not modified by users.
|
|
Simple function to remove slashes from an entire array.
|
| CAPTCHA an acronym for completely automated public |