Log in with ajax and sweetAlert2, no jquery needed. For alerts we're using SweetAlert 2.
CREATE DATABASE login;
USE `login`;
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`pass` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
insert into `users`(`id`,`email`,`pass`) values
(1,'demoz@demologin.com','@demologin');
In loginController.php , you may changed the if statement for password_verify(), remember, function requires the first argument to be a plain text password + hashed password from DB. In this example we don't use hashed passwords and uses a simple DB for practice purposes.
password_verify($_POST["pass"], $hashed_password_from_database)
- Bootstrap v5.3
- FontAwesome 5.15
- Sweetalert2
- Fork it!
- Create your feature branch:
git checkout -b your-branch
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin your-branch
- Submit a PR
Created with ❤️ by Adhir2099