Skip to content

Commit

Permalink
Merge pull request darey-io#4 from propitix/feature/fix-login
Browse files Browse the repository at this point in the history
fix login issues
  • Loading branch information
darey-io authored Jul 3, 2020
2 parents 029b244 + 21702e7 commit 6ea300f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 14 deletions.
8 changes: 4 additions & 4 deletions html/create_user.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php include('functions.php');

/*if (!isAdmin()) {
if (!isAdmin()) {
$_SESSION['msg'] = "You must log in first";
header('location: login.php');
}*/
}

?>
<!DOCTYPE html>
Expand Down Expand Up @@ -50,11 +50,11 @@
<br>
<div class="input-group">
<label></label>
<input type="password" name="password_1" pattern=".{8,16}" placeholder=" Password" >
<input type="password" name="password_1" placeholder=" Password" >
</div>
<div class="input-group">
<label></label>
<input type="password" name="password_2" pattern=".{8,16}" placeholder=" Confirm Password" >
<input type="password" name="password_2" placeholder=" Confirm Password" >
</div>
<div class="input-group">
<button type="submit" class="btn" name="register_btn"> + Create user</button>
Expand Down
13 changes: 13 additions & 0 deletions html/db-schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CREATE DATABASE IF NOT EXISTS multi_login;

USE multi_login ;

CREATE TABLE users(
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
username VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
user_type VARCHAR (255) NOT NULL
);

INSERT INTO users (username, password, email, user_type) VALUES ('admin', '21232f297a57a5a743894a0e4a801fc3', '[email protected]', 'admin');
3 changes: 1 addition & 2 deletions html/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
session_start();

// connect to database
$db = mysqli_connect('localhost', 'root', '', 'multi_login');
$db = mysqli_connect('localhost', 'admin', 'admin.com', 'multi_login');

// variable declaration
$username = "";
Expand Down Expand Up @@ -167,4 +167,3 @@ function isAdmin()
}



2 changes: 1 addition & 1 deletion html/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</div>
<div class="input-group">
<label></label>
<input type="password" name="password" pattern=".{8,16}" placeholder=" Password " >
<input type="password" name="password" placeholder=" Password " >
</div>
<div class="input-group">
<button type="submit" class="btn" name="login_btn">Login</button>
Expand Down
6 changes: 1 addition & 5 deletions html/loginstyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,4 @@ input::placeholder{
}
.errors{
color: #FF0000;
}




}
4 changes: 2 additions & 2 deletions html/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
</div>
<div class="input-group">
<label>Password</label>
<input type="password" name="password_1" pattern=".{8,16}" placeholder=" Password Must Be 8 Characters" >
<input type="password" name="password_1" placeholder=" Password Must Be 8 Characters" >
</div>
<div class="input-group">
<label>Confirm password</label>
<input type="password" name="password_2" pattern=".{8,16}" placeholder=" Password Must Be 8 Characters" >
<input type="password" name="password_2" placeholder=" Password Must Be 8 Characters" >
</div>
<div class="input-group">
<button type="submit" class="btn" name="register_btn">Register</button>
Expand Down

0 comments on commit 6ea300f

Please sign in to comment.