Hello Everyone! My name is Zin Min Htet.
I will show you how to create php LogIn-Register with Security.
This Login-Register form prevent you from attacking CSRF, XSS, SQL Injection & other..
There is also simple Installation & Usage for beginner.
CREATE TABLE users (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL,
password VARCHAR(100) NOT NULL,
salt VARCHAR(10) NOT NULL,
email VARCHAR(50) NOT NULL,
token VARCHAR(30) NOT NULL,
created_date VARCHAR(50) NOT NULL
)Inside the Database Class
# Insert your localhost
$db_host = "localhost";
# Your database name
$db_name = "logInOut";
# Username is root in localhost
$db_username = "root";
# If you don't have a password no need to be set.
$db_password = "Pass@1234";Inside the init.php
# Initialize Class
$dbCon = new Database();
$pdo = $dbCon->connection();
$account = new Account($pdo);Inside the register.php
# $account->Register('','','','','',''); At least 6 Param
$result = $account->Register($_POST['name'], $_POST['pass'], $_POST['mail'], $time, $CSRF, $_POST['CSRF']);
# If you don't wanna use CSRF, give value to null or ''.
$result = $account->Register($_POST['name'], $_POST['pass'], $_POST['mail'], $time, '', '');
# You can also catch back the error message like that.
if (isset($result['ErrorMsg'])) {
$err = $result['ErrorMsg'];
}
Inside the index.php or login.php
# $account->LogIn('','','','',''); At least 5 Param
$result = $account->LogIn($_POST['pass'], $_POST['mail'], $time, $CSRF, $_POST['CSRF']);
# If you don't wanna use CSRF, give value to null or ''.
$result = $account->LogIn($_POST['pass'], $_POST['mail'], $time, '', '');
# You can also catch back the error message like that.
if (isset($result['ErrorMsg'])) {
$err = $result['ErrorMsg'];
}
URL : http://account.zakerxa.com
If you wanna customize more features learn from account.php
Facebook : [ Profile | Messenger ]
Phone : +959777637858
Email : zakexa@gmail.com