Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- userID fullname email role password
- 1 Tester one test@gmail.com N ALSJALDDJ6464!JJLSK
- 2 Tester two tester@gmail.com C @ALSJAL5656DDJJJLSK
- <?php
- error_reporting(E_ALL ^ E_NOTICE);
- ini_set('display_errors', 1);
- // establishing the MySQLi connection
- // Create connection
- $servername = "localhost";
- $username = "root";
- $password = "root";
- $dbname = "timewise";
- $conn = new mysqli($localhost, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- // checking the user
- if(isset($_POST['btnLogin'])){
- $email = mysqli_real_escape_string($conn,$_POST['uemail']);
- $pass = mysqli_real_escape_string($conn,$_POST['upass']);
- //$pass = crypt($pass);
- $sel_user = "SELECT * FROM users WHERE email='$email' AND pass='$pass'";
- $run_user = mysqli_query($conn, $sel_user);
- if (!$sel_user) {
- die(mysqli_error($conn));
- }
- $check_user = mysqli_num_rows($run_user);
- if($check_user>0){
- $_SESSION['email'] = $email;
- print '<script type="text/javascript">window.location = "index.html"</script>';
- }
- else {
- echo '<center><span style="color:#801b1b; border:1px solid #e5a3a3; background:#ffcfcf; padding:5px;">Email or password is not correct, please try again!</span></center>';
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement