Skip to content

Commit

Permalink
fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Vimall03 committed Aug 10, 2023
1 parent 4e0568d commit d63720d
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ function convertCartToArray(cart) {
<div class="col-2 text-center">';
if ($row['m_type'] == "Veg") {
echo '<i class="fa fa-minus-circle fa-2x text-success"></i>';
} else {
} else if ($row['m_type'] == "Non-Veg") {
echo '<i class="fa fa-minus-circle fa-2x text-danger"></i>';
}
echo '</div>
Expand Down
10 changes: 8 additions & 2 deletions vendor/add_menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$rid = $_SESSION['r_id'];

// Check if the user is logged in or redirect to the login page
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] != true) {
if (!isset($_SESSION['vendorloggedin']) || $_SESSION['vendorloggedin'] != true) {
header("location: user_login.php");
exit;
}
Expand Down Expand Up @@ -101,7 +101,13 @@
echo "<td>Name: <input required type='text' name='m_name' value=''><br></td>";
//echo "<td>" . $row['it</td>";
echo "<td>Price: <input required type='number' name='m_price' value=''><br></td>";
echo "<td>Category: <input required type='text' name='m_type' value=''><br></td>";


echo "<td>Category: <select name='m_type'>";
echo "<option value='Veg' " . ($row['order_status'] === 'Veg' ? 'selected' : '') . ">Veg</option>";
echo "<option value='Non-Veg' " . ($row['order_status'] === 'Non-Veg' ? 'selected' : '') . ">Non-Veg</option>";
echo "</select>";

echo "<td><input required type='submit' value='Update'></td>";
echo "</form>";
echo "</tr>";
Expand Down
2 changes: 1 addition & 1 deletion vendor/delete_menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$rid = $_SESSION['r_id'];

// Check if the user is logged in or redirect to the login page
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] != true) {
if (!isset($_SESSION['vendorloggedin']) || $_SESSION['vendorloggedin'] != true) {
header("location: user_login.php");
exit;
}
Expand Down
8 changes: 7 additions & 1 deletion vendor/edit_menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$rid = $_SESSION['r_id'];

// Check if the user is logged in or redirect to the login page
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] != true) {
if (!isset($_SESSION['vendorloggedin']) || $_SESSION['vendorloggedin'] != true) {
header("location: user_login.php");
exit;
}
Expand Down Expand Up @@ -116,6 +116,12 @@
//echo "Description: <input type='text' name='item_description' value='" . $row['item_description'] . "'><br>";
echo "Price: <input type='number' name='m_price' value='" . $row['m_price'] . "'><br>";
echo "Category: <input type='text' name='m_type' value='" . $row['m_type'] . "'><br>";

echo "Category: <select name='m_type'>";
echo "<option value='Veg' " . ($row['order_status'] === 'Veg' ? 'selected' : '') . ">Veg</option>";
echo "<option value='Non-Veg' " . ($row['order_status'] === 'Non-Veg' ? 'selected' : '') . ">Non-Veg</option>";
echo "</select>";

echo "<input type='submit' value='Update'>";
echo "</form>";
echo "<form action='delete_menu.php' method= 'post'>";
Expand Down
2 changes: 1 addition & 1 deletion vendor/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
session_start();
include 'partials/_dbconnect.php';
$rid = $_SESSION['r_id'];
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] != true) {
if (!isset($_SESSION['vendorloggedin']) || $_SESSION['vendorloggedin'] != true) {
header("location: vendor_login.php");
exit;
}
Expand Down
7 changes: 3 additions & 4 deletions vendor/vendor_login.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
$login= false;
$showError = false;
$showalert = false;

Expand Down Expand Up @@ -27,10 +26,10 @@
if(password_verify($password, $row['p_password'])){
//password_verify() - function is used to verify the the hash of the entered password
// by matching it with the password hash stored in the database.
$login = true;
$vendorlogin= true;
session_start();
$_SESSION['r_id']= $row['r_id'];
$_SESSION['loggedin'] = true;
$_SESSION['vendorloggedin'] = true;
$_SESSION['p_email'] = $email;
$_SESSION['r_name'] = $row['r_name'];
header("location: home.php");
Expand Down Expand Up @@ -81,7 +80,7 @@
<!-- Alert bootstrap -->

<?php
if ($login) {
if ($vendorlogin){
echo ' <div class="alert alert-success alert-dismissible fade show" role="alert">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-check-circle-fill" viewBox="0 0 16 16">
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/>
Expand Down
2 changes: 1 addition & 1 deletion vendor/vendor_signup.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
</div>
<button type="submit" class="btn btn-dark btn-block">Sign Up</button>
</form>
<p class="mt-3 text-center">Already have an account? <a href="vendor_login.html">Log In</a></p>
<p class="mt-3 text-center">Already have an account? <a href="vendor_login.php">Log In</a></p>
</div>
</div>
</div>
Expand Down

0 comments on commit d63720d

Please sign in to comment.