Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,200,616 members, 7,975,388 topics. Date: Tuesday, 15 October 2024 at 02:33 AM |
Nairaland Forum / Science/Technology / Webmasters / great use of php sessions (397 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"{ $_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" } } 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)
Free Ebooks For Webdesigner In Nairaland / Vacancy – Mobile Web Developer / Anybody Here In Warri Who Is Good In Google Adsense & Fiverr Marketing
(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. 8 |