phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


PHP Login: Protecting Page Use phpSecureSite

Tag: login, security, phpsecuresite   Category: PHP Security, PHP Classes
post: 09 Jan 2008 read: 1,695


PHP Login System Tutorial: In this post, we try to protect our pages when client go direct at that pages. Before valid login, they shouldn't go at that pages. For this job, we will create a file that will be loaded in every secret pages.

Create a file named "global.php", Enter following codes:

 <?
 require ("./phpsecuresite/phpss/phpss.php");

 function authwrapper(){
 	$status = phpss_validate();
 	
 	switch($status){
		case "phpss_validate_allow":
		break;
		
		case "phpss_validate_acl_deny":
		exit("You don't have access right");
		break;
		
		case "phpss_validate_nosession":
		exit("Login, Please");
		break;
		
		case "phpss_validate_hijack_fail":
		exit("Whats going on your IP?");
		break;
		
		case "phpss_validate_ipaccess_deny":
		exit("Your IP blocked");
		break;
		
		case "phpss_validate_timeout_fail":
		exit("You session is time out. Relogin, please.");
		break;
		
		default:
		exit("Sorry!");
		
	
	}
}
 ?>
Open secretpages.php file. Enter following code at first line:
<?
require "./global.php";
authwrapper();
?>

when user go secretpages.php directly, he will get like this:

message where no session at phpsecuresite


Series this article:
PHP Login: Creating Login System Use PhpSecureSite (Introduction)
PHP Login: Installation of phpSecureSite
PHP Login: Configuration of phpSecureSite
PHP Login: Create Example Administrator at phpSecureSite
PHP Login:Creating Login Form Use phpSecureSite
PHP Login: Protecting Page Use phpSecureSite
PHP Login: Creating Logout from phpSecureSite

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Joomla: Fast Road to Understand Component Programming
Chart: How to Build Cool Animation Real Time Chart
Email: Send Attachement Mail
SMS : Sending SMS with PHP and ActiveXperts (Part 1)

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


624
posting