📁 File Manager
Editing:
/home/wedigitalindia/public_html/demo.wedigitalindia.com/bbhealthy.in/login.php
<!DOCTYPE html> <html lang="en"> <head> <?php include_once("assets/include/head.php")?> </head> <?php // error_reporting(E_ALL); // ini_set('display_errors', 1); if (isset($_POST["login"])) { include 'config.php'; if (!empty($_POST['email']) && !empty($_POST['password'])) { $user = $_POST['email']; $pass = $_POST['password']; // Use prepared statements to prevent SQL injection $stmt = mysqli_prepare($con, "SELECT cust_id, cust_name, cust_email FROM tbl_customer WHERE cust_email=? AND cust_password=?"); mysqli_stmt_bind_param($stmt, "ss", $user, $pass); mysqli_stmt_execute($stmt); mysqli_stmt_store_result($stmt); // Bind result variables mysqli_stmt_bind_result($stmt, $id, $dbusername, $dbEmail); // Check if a row was fetched if (mysqli_stmt_fetch($stmt)) { // Now you have fetched specific fields into variables // $id, $dbusername, $dbEmail // You can directly store these fields in an array for JSON encoding $user_data = array( 'Userid' => $id, 'username' => $dbusername, 'use_email' => $dbEmail, ); // Encode user data as JSON $item_data = json_encode($user_data); // Set the cookie with user data setcookie('shopping_user', $item_data, time() + (86400 * 30), '/'); // '/' makes the cookie available throughout the site // Redirect to the desired page header("Location: index.php?success=1"); exit(); } else { $re = "<div class='alert alert-danger' role='alert'>Invalid email or password.</div>"; } mysqli_stmt_close($stmt); } else { $re = "<div class='alert alert-danger' role='alert'>Email and Password fields are required.</div>"; } } ?> <body> <div id="main"> <?php include_once("assets/include/header.php")?> <!-- sub-banner started... --> <!--<section class="breadcrumb-area">--> <!-- <picture>--> <!-- <source media="(min-width: 768px)" srcset="assets/images/Login.webp">--> <!-- <source media="(max-width: 767px)" srcset="assets/images/banner-2.jpg">--> <!-- <img src="#" alt="Sub Banner image">--> <!-- </picture>--> <!-- <div class="container">--> <!-- <div class="row">--> <!-- <div class="col-md-12">--> <!-- <div class="breadcrumb-content">--> <!-- <ul class="breadcrumb-links">--> <!-- <li><a href="index.php">Home</a></li>--> <!-- <li>Login</li>--> <!-- </ul>--> <!-- </div>--> <!-- </div>--> <!-- </div>--> <!-- </div>--> <!--</section>--> <!-- sub-banner ended... --> <!-- login area start --> <div class="login-register-area"> <div class="container-fluid"> <div class="row g-0 align-items-center"> <div class="col-md-6 d-none d-md-block"> <img class="responsive" src="assets/images/6343845.jpg" alt=""> </div> <div class="col-md-4 mx-auto"> <div class="login-register-wrapper"> <div class="login-form-container"> <div class="login-register-form"> <div class="section-title"> <h2 class="text-white">Login to Your Account</h2> </div> <form action="#" method="post"> <input type="email" name="email" placeholder="Email" /> <input type="password" name="password" placeholder="Password" /> <div class="button-box"> <div class="login-toggle-btn"> <input type="checkbox" id="remember"/> <label for="remember">Remember me</label> <a href="forgot-pass">Forgot Password?</a> </div> <button type="submit" name="login"><span>Login</span></button> </div> </form> <div class="mt-4 text-center text-white">Don't have an account? <a href="<?php path();?>/register" style="text-decoration:underline; color: #fff; font-weight:bold">SignUp Now</a></div> </div> </div> </div> </div> </div> </div> </div> <!-- login area end --> <?php include_once("assets/include/footer.php")?> </div> </body> </html>
Save
Cancel