403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.60
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/projects/meteo-ca/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/projects/meteo-ca/profile.php
<?php
require 'db.php';
session_start();

if (!isset($_SESSION["username"])) {
    header("Location: login.php");
    exit();
}

$username = $_SESSION["username"];
$message = "";

// Fetch current user info
$stmt = $conn->prepare("SELECT email, created_at FROM users WHERE username = ?");
$stmt->bind_param("s", $username);
$stmt->execute();
$stmt->bind_result($email, $created_at);
$stmt->fetch();
$stmt->close();

// Handle form submission
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $new_email = trim($_POST["email"]);
    $new_password = trim($_POST["password"]);
    $confirm_password = trim($_POST["confirm_password"]);

    if (!empty($new_email)) {
        if (!filter_var($new_email, FILTER_VALIDATE_EMAIL)) {
            $message = "<div class='alert alert-danger'>Email format nije validan.</div>";
        } else {
            $stmt = $conn->prepare("UPDATE users SET email = ? WHERE username = ?");
            $stmt->bind_param("ss", $new_email, $username);
            $stmt->execute();
            $stmt->close();
            $email = $new_email;
            $message = "<div class='alert alert-success'>Email uspešno ažuriran!</div>";
			require 'activity_log.php';
			logActivity($username, 'Ažurirane informacije o profilu.');
        }
    }

    if (!empty($new_password)) {
        if ($new_password !== $confirm_password) {
            $message = "<div class='alert alert-danger'>Lozinka se ne poklapa.</div>";
        } elseif (strlen($new_password) < 6) {
            $message = "<div class='alert alert-danger'>Lozinka mora da ima minimum 6 karaktera.</div>";
        } else {
            $hashed_password = password_hash($new_password, PASSWORD_DEFAULT);
            $stmt = $conn->prepare("UPDATE users SET password = ? WHERE username = ?");
            $stmt->bind_param("ss", $hashed_password, $username);
            $stmt->execute();
            $stmt->close();
            $message = "<div class='alert alert-success'>Lozinka uspešno ažurirana!</div>";
			require 'activity_log.php';
			logActivity($username, 'Updated profile information');
        }
    }
}
?>
<!DOCTYPE html>
<html>
<head>
    <title>Moj profil</title>
    <!-- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"> -->
	<link rel="stylesheet" type="text/css" href="css/bootstrap533.css">
</head>
<body class="bg-light">
<div class="container mt-5">
    <div class="col-md-6 offset-md-3">
        <div class="card shadow p-4">
            <h3 class="mb-3 text-center">Moj profil</h3>
            <?php echo $message; ?>
            <p><strong>Korisničko ime:</strong> <?php echo htmlspecialchars($username); ?></p>
            <p><strong>Lozinka:</strong> <?php echo htmlspecialchars($email); ?></p>
            <p><strong>Član od:</strong> <?php echo htmlspecialchars($created_at); ?></p>

            <hr>
            <h5>Ažuiranje Email-a</h5>
            <form method="post">
                <div class="mb-3">
                    <input type="text" name="email" class="form-control" placeholder="Unesite novi email">
                </div>
                <button type="submit" class="btn btn-primary w-100 mb-3">Ažuriraj Email</button>
            </form>

            <h5>Promena lozinke</h5>
            <form method="post">
                <div class="mb-3">
                    <input type="password" name="password" class="form-control" placeholder="Nova lozinka">
                </div>
                <div class="mb-3">
                    <input type="password" name="confirm_password" class="form-control" placeholder="Potvrdi novu lozinku">
                </div>
                <button type="submit" class="btn btn-warning w-100">Ažuriraj lozinku</button>
            </form>

            <hr>
            <div class="d-flex justify-content-between">
                <a href="dashboard.php" class="btn btn-secondary">Nazad</a>
                <a href="logout.php" class="btn btn-danger">Odjava</a>
            </div>
        </div>
    </div>
</div>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit