Zend - The PHP Company




Security

Add Code


.htpasswd file manipulation class  

Type: class
Added by: DeckZ
Entered: 19/09/2000
Last modified: 01/12/2000
Rating: **** (5 votes)
Views: 17542
The class can be used for manipulating unix password files, created with htpasswd. It is possible to add, remove and update users.


A Program to Create (Relatively) Secure Sessions  

Type: code fragment
Added by: mattr
Entered: 31/07/2000
Last modified: 02/12/2004
Rating: **** (21 votes)
Views: 27921
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.


Avoid SQL injection  

Type: code fragment
Added by: bto
Entered: 19/08/2004
Last modified: 08/12/2003
Rating: **** (4 votes)
Views: 11236
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  

Type: code fragment
Added by: sysvic
Entered: 26/11/2005
Last modified: 02/12/2005
Rating: - (fewer than 3 votes)
Views: 8348
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.


CGI Filter  

Type: code fragment
Added by: cameron0004
Entered: 14/01/2004
Last modified: 01/12/2003
Rating: - (fewer than 3 votes)
Views: 4460
This is a piece of code to help reduce security holes at the application level.


Check IP address matches or is in range  

Type: code fragment
Added by: studio24
Entered: 02/07/2003
Last modified: 07/12/2002
Rating: - (fewer than 3 votes)
Views: 9769
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


Email Protector  

Type: code fragment
Added by: xpc
Entered: 12/03/2003
Last modified: 03/12/2002
Rating: - (fewer than 3 votes)
Views: 9363
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 - Simple PHP Encoder  

Type: application
Added by: rgaluh
Entered: 22/10/2001
Last modified: 01/11/2000
Rating: **** (9 votes)
Views: 13520
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


Hashed & encrypted passwords and usernames login system/functions  

Type: code fragment
Added by: danzarrella
Entered: 30/01/2002
Last modified: 02/12/2001
Rating: **** (7 votes)
Views: 18109
Very simple functions to create a logins table in a mysql db, add hashed/encrypted usernames and passwords, and authenticate.


key.com  

Type: application
Added by: hulkeypoo
Entered: 04/10/2003
Last modified: 31/10/2002
Rating: - (fewer than 3 votes)
Views: 4566
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.


key_com  

Type: class
Added by: hulkeypoo
Entered: 15/09/2003
Last modified: 09/12/2002
Rating: - (fewer than 3 votes)
Views: 3911
// ********* 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


login.inc  

Type: application
Added by: russellhanby
Entered: 14/08/2005
Last modified: 02/11/2007
Rating: - (fewer than 3 votes)
Views: 4823
All you need is this include file and a control statement on any page you wish to authenticate users from.


Make .htpasswd  

Type: code fragment
Added by: jochems
Entered: 22/04/2001
Last modified: 04/12/2000
Rating: **** (6 votes)
Views: 12164
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.


Matt Slavin  

Type: application
Added by: dataphix
Entered: 04/12/2001
Last modified: 01/12/2008
Rating: *** (8 votes)
Views: 11561
Simple code for a secure login and low over head to boot. And dammit it just plan works lol.


MSD Authentication and page permission  

Type: application
Added by: mnirwan
Entered: 13/12/2001
Last modified: 01/12/2001
Rating: ***** (3 votes)
Views: 15214
Authentication and page permission using session variable.


PasswdAuth Class  

Type: application
Added by: daniel1
Entered: 16/11/2001
Last modified: 03/12/2010
Rating: *** (3 votes)
Views: 9851
Uses the .htpasswd to authenticate access to your PHP script


Password Protect Plus  

Type: code fragment
Added by: samdeath
Entered: 15/08/2006
Last modified: 09/12/2005
Rating: - (fewer than 3 votes)
Views: 2728
**************************************************************************** *** 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" .


password protection using PHP javaScript & HTML  

Type: code fragment
Added by: wcmunger
Entered: 18/08/2000
Last modified: 08/12/1999
Rating: ** (8 votes)
Views: 12903
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.


permissions.class.php  

Type: class
Added by: kganger
Entered: 04/03/2004
Last modified: 03/12/2003
Rating: - (fewer than 3 votes)
Views: 7441
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.


PHP Function ACL  

Type: application
Added by: mallek
Entered: 21/05/2002
Last modified: 05/12/2001
Rating: - (fewer than 3 votes)
Views: 7952
with php function acl (facl) you can restrict function-, variable- and include/required-file-access


PHP Input Filter  

Type: class
Added by: animachine
Entered: 22/03/2005
Last modified: 03/12/2004
Rating: - (fewer than 3 votes)
Views: 8241
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).


PHP login and Log to MySQL  

Type: application
Added by: abadon
Entered: 30/06/2002
Last modified: 07/12/2001
Rating: - (fewer than 3 votes)
Views: 14353
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...


PHP/JS PKI  

Type: code fragment
Added by: cameron0004
Entered: 14/01/2004
Last modified: 01/12/2003
Rating: - (fewer than 3 votes)
Views: 7666
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.


PHPSecurityFile (app and class)  

Type: application
Added by: charlichaplin
Entered: 09/08/2006
Last modified: 09/12/2005
Rating: - (fewer than 3 votes)
Views: 2618
Ce script permet de detecter la presence d'intrus dans le systeme grace au controle de l'integret� des fichiers.


Phrozen - PHP real-time encoder/decoder, protect your code.  

Type: code fragment
Added by: joeldg
Entered: 17/10/2002
Last modified: 31/10/2001
Rating: - (fewer than 3 votes)
Views: 10987
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.


port scanner  

Type: application
Added by: stonerguy
Entered: 26/05/2002
Last modified: 06/12/2001
Rating: - (fewer than 3 votes)
Views: 7571
Simple and raw php port scanner


PortScan  

Type: application
Added by: sloge
Entered: 16/12/2002
Last modified: 02/11/2001
Rating: - (fewer than 3 votes)
Views: 5764
A very simple yet usefull portscanner.


Pre-validating GET/POST vars  

Type: code fragment
Added by: bu22
Entered: 27/06/2003
Last modified: 09/12/2002
Rating: - (fewer than 3 votes)
Views: 7646
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.


protect php include file  

Type: application
Added by: imamferianto
Entered: 31/05/2003
Last modified: 09/12/2002
Rating: - (fewer than 3 votes)
Views: 7693
This is describe how we can protect php include file unser directory that not protected, this is simply done using php function


Protect values (GET/POST/COOKIE) set by PHP  

Type: code fragment
Added by: yohgaki
Entered: 25/07/2001
Last modified: 07/12/2001
Rating: ***** (5 votes)
Views: 22679
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.


Reverse the effects of magic_quotes  

Type: code fragment
Added by: secondv
Entered: 20/08/2006
Last modified: 09/12/2005
Rating: - (fewer than 3 votes)
Views: 2541
Simple function to remove slashes from an entire array.


SHA-1  

Type: code fragment
Added by: borfast
Entered: 12/07/2002
Last modified: 07/12/2001
Rating: - (fewer than 3 votes)
Views: 13808
A PHP implementation of the Secure Hash Algorithm, SHA-1, based on the JavaScript implementation by Paul Johnston. This is basically a "translation from JavaScript to PHP, so most of the credits should go to Paul Johnston. I only re-wrote it in PHP. See http://pajhome.org.uk/site/legal.html for details.


Simple Auth Code  

Type: code fragment
Added by: Dataphix
Entered: 19/06/2003
Last modified: 06/12/2002
Rating: - (fewer than 3 votes)
Views: 5367
Simple Auth Code For PHP4


Simple Yet Effective PHP Log-in Script  

Type: application
Added by: hazephp
Entered: 24/11/2002
Last modified: 01/11/2001
Rating: - (fewer than 3 votes)
Views: 8220
This simple log in script will password protect one or more of your pages. You can allow different users to go to different sites.


static ip page  

Type: code fragment
Added by: hansolo
Entered: 26/09/2001
Last modified: 31/10/2000
Rating: - (fewer than 3 votes)
Views: 5626
Submit to this page from a form with a hidden field. Checks that field and your ip address. Good if its static.


Stop robot spamming without loading server  

Type: code fragment
Added by: soapy
Entered: 24/02/2005
Last modified: 03/12/2004
Rating: - (fewer than 3 votes)
Views: 4948
If you want to use this code, please link back to www.officedevils.com - you don't have to, just a comment on your blog will do!

These two code fragments are pretty simple. It randomly generates two numbers, and adds them as hidden variables on your site's submission or sign-up form. The user then has to do the simple sum before the submission is accepted.

Yes, you could write a grep to find the numbers and add them, and submit that, but I am sure that won't happen until a LOT of people start using this, and then you can simply move the variables, or add to it, so that the numbers are turned into words, or change the variable names, or change the sign.

You might also want to make the maths that little bit harder than adding a ten to a digit, to improve the quality of members you get!! ;-)

The big advantage is that this doesn't limit access to those without sight or graphics, such as disabled or WAP users, allowing you to still comply with the regs. on usage.


TransCrypt Encrytion functions  

Type: code fragment
Added by: Rival7
Entered: 30/11/2001
Last modified: 02/11/2000
Rating: **** (6 votes)
Views: 6238
TransCrypt is an encrytion library. It simply uses look up tables to translate bytes. The look up tables are generated by the LFSR algorithm.


UA Blocker ( PHP Version )  

Type: code fragment
Added by: icehousedesigns
Entered: 26/10/2001
Last modified: 01/11/2000
Rating: - (fewer than 3 votes)
Views: 6735
UA Blocker allows you to selectively deny specific user-agents from visiting your site. This helps to eliminate email harvesting, and various other bandwidth-sucking visitors. Some examples are included.


WIGGEM  

Type: application
Added by: roloc
Entered: 28/05/2001
Last modified: 03/12/2001
Rating: ***** (10 votes)
Views: 17111
A complete modual for you to wrap around anything that you want secure. Wiggem uses php's new session functions and is much more secure then the average cookie login script. Md5 encryption is also used.


Zend encoder detect files  

Type: code fragment
Added by: sysvic
Entered: 26/11/2005
Last modified: 02/12/2005
Rating: - (fewer than 3 votes)
Views: 2963
A very simple fuction to detect files encoded with Zend encoder.



Search



This Category All Categories