Bagaimana cara menampilkan foto profil user setelah login menggunakan php
<?php
session_start();
// cek apakah yang mengakses halaman ini sudah login
if($_SESSION['user_type']==""){
header("location:index.php?pesan=gagal");
}
?>
<?php include('koneksi.php') ?>
<!doctype html>
<html lang="en">
<head>
<title>Siswa TKJ</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700,800,900" rel="stylesheet">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="coba.css">
<link href="assets/css/main.css" rel="stylesheet">
<link rel="stylesheet" href="test.css">
</head>
<body>
<div class="wrapper d-flex align-items-stretch">
<nav id="sidebar">
<div class="custom-menu">
<button type="button" id="sidebarCollapse" class="btn btn-primary">
<i class="fa fa-bars"></i>
<span class="sr-only">Toggle Menu</span>
</button>
</div>
<div class="p-4 pt-5">
<h1><a href="siswa-menu.php" class="logo">Siswa</a></h1>
<ul class="list-unstyled components mb-5">
<div class="side-inner">
<div class="profile">
<img src="poto/<?=$_SESSION['photo']?>" alt="image"/>
</div>
<br>
<li>
<?php echo "<li style='color: white;'>"; ?>Halo <b><?php echo $_SESSION['username']; ?></b> ! Anda telah login sebagai <b><?php echo $_SESSION['user_type']; ?></b>.
</li>
<li>
<a href="materi-siswa.php">Materi</a>
</li>
<li>
<a href="tugas-siswa.php">Tugas</a>
</li>
<li>
<a href="jadwal-siswa.php">Jadwal</a>
</li>
<li>
<a href="pengumuman-murid.php">Pengumuman</a>
</li>
<li>
<a href="infopkl-siswa.php">Info PKL</a>
</li>
<li>
<a href="daftarbiodata.php">Daftar Biodata</a>
</li>
<li>
<a href="logout.php">Log Out</a>
</li>
</ul>
<div class="footer">
<p><!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
Copyright ©<script>document.write(new Date().getFullYear());</script> All rights reserved | This template is made with <i class="icon-heart" aria-hidden="true"></i> by <a href="https://colorlib.com" target="_blank">Colorlib.com</a>
<a href="#" class="instagram"><i class="bi bi-instagram"></i></a>
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. --></p>
</div>
</div>
</nav>
<!-- Page Content -->
<div id="content" class="p-4 p-md-5 pt-5">
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,300,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<section id="about" class="about">
<div class="container" data-aos="fade-up">
<div class="section-header">
<h2>Beranda</h2>
</div>
</div>
</section>
</div>
<script src="jquery.min.js"></script>
<script src="popper.js"></script>
<script src="bootstrap.min.js"></script>
<script src="main.js"></script>
</body>
</html>
1 Jawaban
daycode•1 tahun yang lalu
pastikan kalau di table si user sudah menyimpan nama file foto nya. kemudian nama file foto si user tinggal panggil pakai query "where user_id='isi id user yg login di sini'"
0
Silahkan Login untuk menjawab.