Skip to content

Commit

Permalink
Connected to phpmyadmin for admin use
Browse files Browse the repository at this point in the history
  • Loading branch information
khyati18 committed Nov 9, 2020
1 parent b4f4638 commit bb25e32
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 19 deletions.
24 changes: 24 additions & 0 deletions Documentation/SETUP_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,30 @@ use inventory;
```
6. Update your MySQL root user password in [db_connection.php](./config/db_connection.php)

## For Admin Only - Connect to phpmyadmin server

1. Install phpmyadmin
```
sudo apt install phpmyadmin php-mbstring php-gettext
```
- For the server selection, choose apache2
- Select Yes when asked whether to use dbconfig-common to set up the database
- You will then be asked to choose and confirm a MySQL application password for phpMyAdmin
2. Enable mbstring
```
sudo phpenmod mbstring
```
3. Restart apache
```
sudo systemctl restart apache2
```
4. Open phpmyadmin
```
http://your_domain_or_IP/phpmyadmin (http://127.0.0.1:8000/phpmyadmin)
```

*For error refer: [https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-18-04](https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-18-04)*

## Potential Errors

1. Error: XAMPP: Starting Apache…fail
Expand Down
14 changes: 6 additions & 8 deletions admin.html → admin/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<title>Admin</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="./css/styles.css" type="text/css">
<link rel="stylesheet" href="../css/styles.css" type="text/css">
</head>

<body>
Expand All @@ -18,8 +18,8 @@
<h1>Inventory Control</h1>
</div>

<form action="authenticate.php" method="POST">
<div class="container-main">
<div class="container-main">
<form action="../admin/authenticate.php" method="POST">
<p>Please enter your details.</p>

<hr>
Expand All @@ -35,12 +35,10 @@ <h1>Inventory Control</h1>
<hr>

<button type="submit" class="button" name="submit">Submit</button>
<div style="text-align: center; margin-top: 20px;">
<a href="index.html" style="color: gray; font-size: 20px;">Login as a normal user</a>
</div>
</div>
</form>
<script src="./js/script.js"></script>
<button onclick="window.location.href='../index.html'" class="button">Login as User</button>
</div>
<script src="../js/script.js"></script>

</body>
</html>
4 changes: 2 additions & 2 deletions authenticate.php → admin/authenticate.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
include 'config/db_connection.php';
include '../config/db_connection.php';

$conn = OpenCon();
echo $conn->error;
Expand All @@ -16,7 +16,7 @@
if ($name == "admin" && $user_id == 0)
{
// output data of each row
header('Location: ./home.php');
header('Location: http://localhost:8000/phpmyadmin/');
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ hr {
.button {
background-color: cadetblue;
color: white;
padding: 16px 0;
margin: 2% 40%;
padding: 10px 0;
margin: 0.5% 30%;
border: none;
cursor: pointer;
width: 20%;
width: 40%;
opacity: 0.9;
}

Expand Down
Empty file removed home.php
Empty file.
10 changes: 4 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<h1>Inventory Control</h1>
</div>

<form action="action.php" method="POST">
<div class="container-main">
<div class="container-main">
<form action="action.php" method="POST">
<p>Please enter your details.</p>

<hr>
Expand All @@ -35,11 +35,9 @@ <h1>Inventory Control</h1>
<hr>

<button type="submit" class="button" name="submit">Submit</button>
<div style="text-align: center; margin-top: 20px;">
<a href="admin.html" style="color: gray; font-size: 20px;">Login as Admin</a>
</div>
</div>
</form>
<button onclick="window.location.href='./admin/admin.html'" class="button">Login as Admin</button>
</div>
<script src="./js/script.js"></script>

</body>
Expand Down

0 comments on commit bb25e32

Please sign in to comment.