Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,154,758 members, 7,824,181 topics. Date: Saturday, 11 May 2024 at 03:11 AM

great use of php sessions - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / great use of php sessions (382 Views)

Why SSL Certificates, The Reason Of The Use Of It. / What Is The Function Of PHP And Javascript? / Please! Has Anyone Here Made Use Of This Wordpress Theme (2) (3) (4)

(1) (Reply)

great use of php sessions by emilykel(m): 10:56am On May 11, 2015
hey guys,the following Php code uses sessions to restrict login access after a number of failed attempts more than 3 times...the code is just basic I.e no stripslashes and validation...

<?php
session_start();
if(isset($_SESSION["BAN"])){
echo "<font color='red'>you can no longer login for this session,<font color='blue'>please restart your browser</font></font>";
}else{
if(isset($_POST["submit"])){
$name=$_POST["name"];
$_SESSION["FAIL"];
if($name!="emmy"wink{
$_SESSION["FAIL"]++;
echo "<font color='red'>wrong password...try again </font><br>";
//echo "wrong by ".$_SESSION["FAIL"]." time(s)<br>";
}else{
echo "access granted....
<br> ";
}
if($_SESSION["FAIL"]>3){
$_SESSION["BAN"]="bad";
echo "you entered the wrong password too many times";
//header("location:pat.php"wink;
}
}
echo <<< DOC
<form action="form.php" method="post">
<input type="text"name="name"/>
<input type="submit"name="submit"/>
</form>
DOC;
}
?>

enjoy...just comment and add your contributions

(1) (Reply)

Creating First Eommerce Site / Help : Is There A Way I Could Do This?? / WEBHELPMAN: Get Your Hosting And Domain

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 12
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.