HomeSunday, June 24, 2018, 01:35:52
1

Password Protect With PHP

Tuesday, February 10, 15, 09:49:11, 3 Yaers Ago Via wain, Hits: 6316
Password protect tith PHP - tutorial
Example:

index.php

Code:
<?php session_start();
$mypass = 'pass';
if(isset($_POST['Submit'])){
$ccpass = $_POST['password'];
$ccpass = addslashes($ccpass);
if(preg_match('#[^A-Za-z0-9-]#', $ccpass)) { echo "Illegal Characters"; Die();}
if($ccpass == $mypass) {
session_regenerate_id();
$_SESSION['INC_PASS_WORD'] = $ccpass;
session_write_close();
header("location: mypage.php");
exit();
}else{
echo "Login failed";
exit();
}
}else{
?>
<form action="sign_in.php" name="ccform" method="post">
Please enter your password
<br />Password <br />
<input name="password" size="30" type="password" /><br />
<input type="submit" value="Sign In" name="Submit" type="button">
</form>
<?php } ?>


mypage.php

Code:
<?php session_start();
if(!isset($_SESSION['INC_PASS_WORD']) ||
(trim($_SESSION['INC_PASS_WORD'])=='')) {
header("location: sign_in.php");
exit();
}
echo "<h2>My Page</h2>";
?>

Sign In

Sponsor
Related

Contact Us 2.0. with HTML Page and Pop Up Frame

This is the same Contact Us 2.0. that is in this forum, But I have added more options to this script and a html page with a very nice pop Up frame that DONT get block by any pop Up software. Many websites use this type of script to bypass the blocking…

php Array

These functions allow you to interact with and manipulate arrays in various ways. Arrays are essential for storing, managing, and operating on sets of variables.

Link Base 2.0.

Manage your links using a MySQL database. It features easy install, user submission, and an admin panel to add, edit and remove categories and links.

PHP Write to File

PHP Write to File :: PHP Tutorial, requirement(s): PHP server

Creating a basic bad word filter in PHP

This tutorial will show you how to create a basic bad word filter in PHP

Contact Us Form With Captcha

A contact us form with email and form field validation. It allows your visitors to send you an email directly from your website. Features: Captcha Image, HTML output.

PHP Cookies and Sessions Tutorial

PHP Cookies and Sessions Tutorials

Contact Us PHP Form 1.1.

A contact us form with email and form field validation. It allows your visitors to send you an email directly from your website.

PHP $_SESSION

Session_start creates a session or resumes the current one based on a session identifier passed via a GET or POST request, or passed via a cookie.

Creating a Math CAPTCHA with PHP - PHP Tutorial

This tutorial will show you how to create a form with Math Captcha.
About Author

wain

Date Registered: Sun, Feb 8, 15
Last Time Online: Sun, Mar 18, 18
So far has created 115 entries.
wain
This author has not yet filled in any details.