developershed / basicsecurelogin Goto Github PK
View Code? Open in Web Editor NEWHow to program a basic secure login system using PHP and MySQL
License: MIT License
How to program a basic secure login system using PHP and MySQL
License: MIT License
if(strlen($_POST['password']) < 12) {
die("Your password is too short. The minimum length is 12 characters.");
}
if(!preg_match("#[A-Z]+#", ($_POST['password']))) {
die("Your password must contain at least one uppercase letter.");
}
if(!preg_match("#[a-z]+#", ($_POST['password']))) {
die("Your password must contain at least one lowercase letter.");
}
if(!preg_match("#[0-9]+#", ($_POST['password']))) {
die("Your password must contain at least one number.");
}
if(!preg_match("#[\W]+#", ($_POST['password']))) {
die("Your password must contain at least one special character.");
}
This is the textbook way to kill a session:
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 42000,
$params["path"], $params["domain"],
$params["secure"], $params["httponly"]
);
}
session_destroy();
Hello hello hello!
So I was reading through the code and the issues as i have used this script quite a bit and just added things/removed things. So my idea was that we make a config file and get database info from there as well as if they want certain things(Complex password etc). If this idea is accepted be sure to check pull request as i will bring them in :D
For line 30 31 and 31 Login.php
// The parameter values
$query_params = array(
':username' => $_POST['username']
);
I think you should use
$name = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);
$query_params = array(
':username' => $name
);
Need a method where the admin needs to approve a newly created account.
Hello,
First of all, thank you very much for your script, it was exactly what I was looking for :)
Secondly, is it possible to show me which users are currently logged in?
Thanks,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.