File manager - Edit - /home/custbahd/public_html/admin/profile.php
Back
<?php // We need to use sessions, so you should always start sessions using the below code. session_start(); // If the user is not logged in redirect to the login page... if (!isset($_SESSION['loggedin'])) { header('Location: index.php'); exit; } $DATABASE_HOST = 'localhost'; $DATABASE_USER = 'custbahd_customassistname'; $DATABASE_PASS = 'Rwatangabo1son'; $DATABASE_NAME = 'custbahd_customassist'; $con = mysqli_connect($DATABASE_HOST, $DATABASE_USER, $DATABASE_PASS, $DATABASE_NAME); if (mysqli_connect_errno()) { exit('Failed to connect to MySQL: ' . mysqli_connect_error()); } // We don't have the password or email info stored in sessions so instead we can get the results from the database. $stmt = $con->prepare('SELECT password, email FROM cadmin WHERE id = ?'); // In this case we can use the account ID to get the account info. $stmt->bind_param('i', $_SESSION['id']); $stmt->execute(); $stmt->bind_result($password, $email); $stmt->fetch(); $stmt->close(); ?> <?php //including the database connection file include_once("config.php"); //fetching data in descending order (lastest entry first) //$result = mysql_query("SELECT * FROM users ORDER BY id DESC"); // mysql_query is deprecated $result = mysqli_query($mysqli, "SELECT * FROM cadmin ORDER BY id ASC"); // using mysqli_query instead ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>CA Admin Panel @copy;</title> <link rel="icon" type="ico/png" href="image/logo.png"> <link href="css/style.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css"> </head> <body class="loggedin"> <nav class="navtop"> <div> <h1>Custom Assist Admin</h1> <a href="profile.php"><i class="fas fa-user-circle"></i>Profile</a> <a href="logout.php"><i class="fas fa-sign-out-alt"></i>Logout</a> <a href="home.php"><?=$_SESSION['name']?></a> </div> </nav> <div class="content"> <h2>Profile Page</h2> <div> <p>Your account details are below:</p> <table> <tr> <td>Username:</td> <td><?=$_SESSION['name']?></td> </tr> <tr> <td>Email:</td> <td><?=$email?></td> </tr> <tr> <td>Password:</td> <td><?=$password?></td> </tr> <tr> <td><a href="edit.php?id=$res[id]">Edit</a></td> </tr> </table> </div> </div> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Generation time: 0.54 |
proxy
|
phpinfo
|
Settings