SlideShare a Scribd company logo
Pemrograman Web 9 - Input Form DB dan Session
Pemrograman Web 9 - Input Form DB dan Session
<?php
// mulai session
session_start();
?>
<!DOCTYPE html>
<html>
<body>
<?php
// set variable pada session
$_SESSION["favcolor"] = “hijau";
$_SESSION["favanimal"] = “kucing";
echo “Variabel telah dibuat.";
?>
</body>
</html>
Pemrograman Web 9 - Input Form DB dan Session
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<body>
<?php
// menampilkan variable yang dibuat sebelumnya
echo “Warna favorit adalah " . $_SESSION["favcolor"] .
".<br>";
echo “Binatang peliharaan favorit adalah " .
$_SESSION["favanimal"] . ".";
?>
</body>
</html>
Pemrograman Web 9 - Input Form DB dan Session
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<body>
<?php
// menghapus semua variable yang di set
session_unset();
// menghapus/menghancurkan session
session_destroy();
?>
</body>
</html>
Pemrograman Web 9 - Input Form DB dan Session
Pemrograman Web 9 - Input Form DB dan Session
<?php
mysql_connect("localhost","root","") or die
("Gagal Terhubung Ke Database");
mysql_select_db(“dbtes") or die ("Database
Tidak Ditemukan");
?>
<form class="form-horizontal" method="post" name="pendaftaran" action="registrasi.php">
<div class="form-group">
<label class="control-label col-sm-2" for="name">Nama:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="nama" placeholder="masukkan nama" name="nama">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="name">Email:</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="email" placeholder="masukkan email" name="email">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="name">Username:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="username" placeholder="masukkan username" name="username">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="pwd">Password:</label>
<div class="col-sm-10">
<input type="password" class="form-control" id="password" placeholder="masukkan password" name="password">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input class="btn btn-primary" type="submit" name="submit" value="DAFTAR">
</div>
</div>
</form>
<?php
include "koneksi.php";
$nama = $_POST['nama'];
$email = $_POST['email'];
$username = $_POST['username'];
$password = $_POST['password'];
if (empty($nama)){
echo "<script>alert('Nama belum diisi')</script>";
echo "<meta http-equiv='refresh' content='1 url=daftar.php'>";
}else
if (empty($email)){
echo "<script>alert('Email belum diisi')</script>";
echo "<meta http-equiv='refresh' content='1 url=daftar.php'>";
}else
if(empty($username)){
echo "<script>alert('Username belum diisi')</script>";
echo "<meta http-equiv='refresh' content='1 url=daftar.php'>";
}else
if (empty($password)){
echo "<script>alert('Password belum diisi')</script>";
echo "<meta http-equiv='refresh' content='1 url=daftar.php'>";
}else{
$daftar = mysql_query("INSERT INTO pengguna (id_user,nama,username,password) values
('$nama','$email','$username','$password')");
if ($daftar){
echo "<script>alert('Berhasil Mendaftar')</script>";
echo "<meta http-equiv='refresh' content='1 url=daftar.php'>";
}else{
echo "<script>alert('Gagal Mendaftar')</script>";
echo "<meta http-equiv='refresh' content='1 url=daftar.php'>";
}
}
?>
<?php
include "koneksi.php";
session_start();
if (isset($_SESSION['username'])){
header ("location:index.php");
}
?>
<div class="container">
<div class="page-header">
<h1><b>Form Masuk Akun</b></h1>
<br />
</div>
<br />
<form class="form-horizontal" method="post" name="login" action="logincek.php">
<div class="form-group">
<label class="control-label col-sm-2" for="email">Username:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="username" placeholder="masukkan username" name="username">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="pwd">Password:</label>
<div class="col-sm-10">
<input type="password" class="form-control" id="password" placeholder="Enter password" name="password">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default" value="LOGIN">Masuk</button>
</div>
</div>
</form>
</div>
<?php
include "koneksi.php";
$username = $_POST['username'];
$password = $_POST['password'];
if (empty($username)){
echo "<script>alert('Username belum diisi')</script>";
echo "<meta http-equiv='refresh' content='1 url=login.php'>";
}else if (empty($password)){
echo "<script>alert('Password belum diisi')</script>";
echo "<meta http-equiv='refresh' content='1 url=login.php'>";
}else{
session_start();
$login = mysql_query("select * from pengguna where
username='$username' and password='$password'");
if (mysql_num_rows($login) > 0){
$_SESSION['username'] = $username;
header("location:index.php");
}else{
echo "<script>alert('Username atau Password salah')</script>";
echo "<meta http-equiv='refresh' content='1 url=login.php'>";
}
}
?>
<?php
include "koneksi.php";
session_start();
if (!isset($_SESSION['username'])){
header ("location:login.php");
}
?>
Berhasil Login, <a href="logout.php">Logout</a>
<?php
session_start();
session_destroy();
echo "<script>alert('Terima kasih, Anda Berhasil
Logout')</script>";
echo "<meta http-equiv='refresh' content='1
url=login.php'>";
?>
Ad

Recommended

Pemrograman Web 8 - MySQL
Pemrograman Web 8 - MySQL
Nur Fadli Utomo
 
Php
Php
anilcoolz881234
 
My shell
My shell
Ahmed Salah
 
C A S Sample Php
C A S Sample Php
JH Lee
 
Php talk
Php talk
Jamil Ramsey
 
M.php
M.php
SanderZHackedOwn
 
Add loop shortcode
Add loop shortcode
Peter Baylies
 
Php 101: PDO
Php 101: PDO
Jeremy Kendall
 
Coding for php with mysql
Coding for php with mysql
Rajamanickam Gomathijayam
 
Php
Php
Linh Tran
 
London XQuery Meetup: Querying the World (Web Scraping)
London XQuery Meetup: Querying the World (Web Scraping)
Dennis Knochenwefel
 
Check username availability with vue.js and PHP
Check username availability with vue.js and PHP
Yogesh singh
 
Perl5i
Perl5i
Marcos Rebelo
 
Not Really PHP by the book
Not Really PHP by the book
Ryan Kilfedder
 
Future of HTTP in CakePHP
Future of HTTP in CakePHP
markstory
 
New in cakephp3
New in cakephp3
markstory
 
Karan chanana
Karan chanana
karan chanana
 
TICT #13
TICT #13
azman_awan9
 
TICT #11
TICT #11
azman_awan9
 
Jqeury ajax plugins
Jqeury ajax plugins
Inbal Geffen
 
Advanced Querying with CakePHP 3
Advanced Querying with CakePHP 3
José Lorenzo Rodríguez Urdaneta
 
Cpsh sh
Cpsh sh
Ben Pope
 
PHP an intro -1
PHP an intro -1
Kanchilug
 
Coding website
Coding website
PutuMahendra Wijaya
 
Pagination in PHP
Pagination in PHP
Vineet Kumar Saini
 
8時間耐久CakePHP2 勉強会
8時間耐久CakePHP2 勉強会
Yusuke Ando
 
Desain Grafis 6 - UI/UX on Web Application
Desain Grafis 6 - UI/UX on Web Application
Nur Fadli Utomo
 
Pemrograman Web 7 - Basic PHP
Pemrograman Web 7 - Basic PHP
Nur Fadli Utomo
 
Pemrograman Web 6 - jQuery
Pemrograman Web 6 - jQuery
Nur Fadli Utomo
 
Pemrograman Web 5 - Javascript
Pemrograman Web 5 - Javascript
Nur Fadli Utomo
 

More Related Content

What's hot (18)

Coding for php with mysql
Coding for php with mysql
Rajamanickam Gomathijayam
 
Php
Php
Linh Tran
 
London XQuery Meetup: Querying the World (Web Scraping)
London XQuery Meetup: Querying the World (Web Scraping)
Dennis Knochenwefel
 
Check username availability with vue.js and PHP
Check username availability with vue.js and PHP
Yogesh singh
 
Perl5i
Perl5i
Marcos Rebelo
 
Not Really PHP by the book
Not Really PHP by the book
Ryan Kilfedder
 
Future of HTTP in CakePHP
Future of HTTP in CakePHP
markstory
 
New in cakephp3
New in cakephp3
markstory
 
Karan chanana
Karan chanana
karan chanana
 
TICT #13
TICT #13
azman_awan9
 
TICT #11
TICT #11
azman_awan9
 
Jqeury ajax plugins
Jqeury ajax plugins
Inbal Geffen
 
Advanced Querying with CakePHP 3
Advanced Querying with CakePHP 3
José Lorenzo Rodríguez Urdaneta
 
Cpsh sh
Cpsh sh
Ben Pope
 
PHP an intro -1
PHP an intro -1
Kanchilug
 
Coding website
Coding website
PutuMahendra Wijaya
 
Pagination in PHP
Pagination in PHP
Vineet Kumar Saini
 
8時間耐久CakePHP2 勉強会
8時間耐久CakePHP2 勉強会
Yusuke Ando
 

More from Nur Fadli Utomo (20)

Desain Grafis 6 - UI/UX on Web Application
Desain Grafis 6 - UI/UX on Web Application
Nur Fadli Utomo
 
Pemrograman Web 7 - Basic PHP
Pemrograman Web 7 - Basic PHP
Nur Fadli Utomo
 
Pemrograman Web 6 - jQuery
Pemrograman Web 6 - jQuery
Nur Fadli Utomo
 
Pemrograman Web 5 - Javascript
Pemrograman Web 5 - Javascript
Nur Fadli Utomo
 
Desain Grafis 5 - Good Graphic Design
Desain Grafis 5 - Good Graphic Design
Nur Fadli Utomo
 
Desain Grafis 3 - Color
Desain Grafis 3 - Color
Nur Fadli Utomo
 
Desain Grafis 4 - UI/UX
Desain Grafis 4 - UI/UX
Nur Fadli Utomo
 
Pemrograman Web 4 - Bootstrap 3
Pemrograman Web 4 - Bootstrap 3
Nur Fadli Utomo
 
Pemrograman Web 3 - CSS Basic Part 2
Pemrograman Web 3 - CSS Basic Part 2
Nur Fadli Utomo
 
Desain Grafis 2 - Kerning Type
Desain Grafis 2 - Kerning Type
Nur Fadli Utomo
 
Desain Grafis 1 - Basic
Desain Grafis 1 - Basic
Nur Fadli Utomo
 
Pemrograman Web 2 - CSS
Pemrograman Web 2 - CSS
Nur Fadli Utomo
 
Pemrograman Web - HTML
Pemrograman Web - HTML
Nur Fadli Utomo
 
PC 9 - Matlab 2nd Chapter
PC 9 - Matlab 2nd Chapter
Nur Fadli Utomo
 
PC 8 - Matlab
PC 8 - Matlab
Nur Fadli Utomo
 
Pengolahan Citra 7 - Warna
Pengolahan Citra 7 - Warna
Nur Fadli Utomo
 
GK 3 Penggambaran Titik dan Garis
GK 3 Penggambaran Titik dan Garis
Nur Fadli Utomo
 
Citra Biner
Citra Biner
Nur Fadli Utomo
 
Pengolahan Citra 4 - Histogram Citra
Pengolahan Citra 4 - Histogram Citra
Nur Fadli Utomo
 
Pengolahan Citra 3 - Operasi-operasi Digital
Pengolahan Citra 3 - Operasi-operasi Digital
Nur Fadli Utomo
 
Desain Grafis 6 - UI/UX on Web Application
Desain Grafis 6 - UI/UX on Web Application
Nur Fadli Utomo
 
Pemrograman Web 7 - Basic PHP
Pemrograman Web 7 - Basic PHP
Nur Fadli Utomo
 
Pemrograman Web 6 - jQuery
Pemrograman Web 6 - jQuery
Nur Fadli Utomo
 
Pemrograman Web 5 - Javascript
Pemrograman Web 5 - Javascript
Nur Fadli Utomo
 
Desain Grafis 5 - Good Graphic Design
Desain Grafis 5 - Good Graphic Design
Nur Fadli Utomo
 
Pemrograman Web 4 - Bootstrap 3
Pemrograman Web 4 - Bootstrap 3
Nur Fadli Utomo
 
Pemrograman Web 3 - CSS Basic Part 2
Pemrograman Web 3 - CSS Basic Part 2
Nur Fadli Utomo
 
Desain Grafis 2 - Kerning Type
Desain Grafis 2 - Kerning Type
Nur Fadli Utomo
 
PC 9 - Matlab 2nd Chapter
PC 9 - Matlab 2nd Chapter
Nur Fadli Utomo
 
Pengolahan Citra 7 - Warna
Pengolahan Citra 7 - Warna
Nur Fadli Utomo
 
GK 3 Penggambaran Titik dan Garis
GK 3 Penggambaran Titik dan Garis
Nur Fadli Utomo
 
Pengolahan Citra 4 - Histogram Citra
Pengolahan Citra 4 - Histogram Citra
Nur Fadli Utomo
 
Pengolahan Citra 3 - Operasi-operasi Digital
Pengolahan Citra 3 - Operasi-operasi Digital
Nur Fadli Utomo
 
Ad

Recently uploaded (20)

Complete WordPress Programming Guidance Book
Complete WordPress Programming Guidance Book
Shabista Imam
 
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
2nd Sight Lab
 
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
mary rojas
 
Sysinfo OST to PST Converter Infographic
Sysinfo OST to PST Converter Infographic
SysInfo Tools
 
Which Hiring Management Tools Offer the Best ROI?
Which Hiring Management Tools Offer the Best ROI?
HireME
 
Best MLM Compensation Plans for Network Marketing Success in 2025
Best MLM Compensation Plans for Network Marketing Success in 2025
LETSCMS Pvt. Ltd.
 
HYBRIDIZATION OF ALKANES AND ALKENES ...
HYBRIDIZATION OF ALKANES AND ALKENES ...
karishmaduhijod1
 
Zoho Creator Solution for EI by Elsner Technologies.docx
Zoho Creator Solution for EI by Elsner Technologies.docx
Elsner Technologies Pvt. Ltd.
 
Streamlining CI/CD with FME Flow: A Practical Guide
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
 
How Automation in Claims Handling Streamlined Operations
How Automation in Claims Handling Streamlined Operations
Insurance Tech Services
 
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
dheeodoo
 
Automated Migration of ESRI Geodatabases Using XML Control Files and FME
Automated Migration of ESRI Geodatabases Using XML Control Files and FME
Safe Software
 
Building Geospatial Data Warehouse for GIS by GIS with FME
Building Geospatial Data Warehouse for GIS by GIS with FME
Safe Software
 
Download Adobe Illustrator Crack free for Windows 2025?
Download Adobe Illustrator Crack free for Windows 2025?
grete1122g
 
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
WSO2
 
Heat Treatment Process Automation in India
Heat Treatment Process Automation in India
Reckers Mechatronics
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
arctitecture application system design os dsa
arctitecture application system design os dsa
za241967
 
OpenChain Webinar - AboutCode - Practical Compliance in One Stack – Licensing...
OpenChain Webinar - AboutCode - Practical Compliance in One Stack – Licensing...
Shane Coughlan
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
Complete WordPress Programming Guidance Book
Complete WordPress Programming Guidance Book
Shabista Imam
 
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
Threat Modeling a Batch Job Framework - Teri Radichel - AWS re:Inforce 2025
2nd Sight Lab
 
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
mary rojas
 
Sysinfo OST to PST Converter Infographic
Sysinfo OST to PST Converter Infographic
SysInfo Tools
 
Which Hiring Management Tools Offer the Best ROI?
Which Hiring Management Tools Offer the Best ROI?
HireME
 
Best MLM Compensation Plans for Network Marketing Success in 2025
Best MLM Compensation Plans for Network Marketing Success in 2025
LETSCMS Pvt. Ltd.
 
HYBRIDIZATION OF ALKANES AND ALKENES ...
HYBRIDIZATION OF ALKANES AND ALKENES ...
karishmaduhijod1
 
Zoho Creator Solution for EI by Elsner Technologies.docx
Zoho Creator Solution for EI by Elsner Technologies.docx
Elsner Technologies Pvt. Ltd.
 
Streamlining CI/CD with FME Flow: A Practical Guide
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
 
How Automation in Claims Handling Streamlined Operations
How Automation in Claims Handling Streamlined Operations
Insurance Tech Services
 
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
dheeodoo
 
Automated Migration of ESRI Geodatabases Using XML Control Files and FME
Automated Migration of ESRI Geodatabases Using XML Control Files and FME
Safe Software
 
Building Geospatial Data Warehouse for GIS by GIS with FME
Building Geospatial Data Warehouse for GIS by GIS with FME
Safe Software
 
Download Adobe Illustrator Crack free for Windows 2025?
Download Adobe Illustrator Crack free for Windows 2025?
grete1122g
 
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
WSO2
 
Heat Treatment Process Automation in India
Heat Treatment Process Automation in India
Reckers Mechatronics
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
arctitecture application system design os dsa
arctitecture application system design os dsa
za241967
 
OpenChain Webinar - AboutCode - Practical Compliance in One Stack – Licensing...
OpenChain Webinar - AboutCode - Practical Compliance in One Stack – Licensing...
Shane Coughlan
 
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
 
Ad

Pemrograman Web 9 - Input Form DB dan Session

  • 3. <?php // mulai session session_start(); ?> <!DOCTYPE html> <html> <body> <?php // set variable pada session $_SESSION["favcolor"] = “hijau"; $_SESSION["favanimal"] = “kucing"; echo “Variabel telah dibuat."; ?> </body> </html>
  • 5. <?php session_start(); ?> <!DOCTYPE html> <html> <body> <?php // menampilkan variable yang dibuat sebelumnya echo “Warna favorit adalah " . $_SESSION["favcolor"] . ".<br>"; echo “Binatang peliharaan favorit adalah " . $_SESSION["favanimal"] . "."; ?> </body> </html>
  • 7. <?php session_start(); ?> <!DOCTYPE html> <html> <body> <?php // menghapus semua variable yang di set session_unset(); // menghapus/menghancurkan session session_destroy(); ?> </body> </html>
  • 10. <?php mysql_connect("localhost","root","") or die ("Gagal Terhubung Ke Database"); mysql_select_db(“dbtes") or die ("Database Tidak Ditemukan"); ?>
  • 11. <form class="form-horizontal" method="post" name="pendaftaran" action="registrasi.php"> <div class="form-group"> <label class="control-label col-sm-2" for="name">Nama:</label> <div class="col-sm-10"> <input type="text" class="form-control" id="nama" placeholder="masukkan nama" name="nama"> </div> </div> <div class="form-group"> <label class="control-label col-sm-2" for="name">Email:</label> <div class="col-sm-10"> <input type="email" class="form-control" id="email" placeholder="masukkan email" name="email"> </div> </div>
  • 12. <div class="form-group"> <label class="control-label col-sm-2" for="name">Username:</label> <div class="col-sm-10"> <input type="text" class="form-control" id="username" placeholder="masukkan username" name="username"> </div> </div> <div class="form-group"> <label class="control-label col-sm-2" for="pwd">Password:</label> <div class="col-sm-10"> <input type="password" class="form-control" id="password" placeholder="masukkan password" name="password"> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <input class="btn btn-primary" type="submit" name="submit" value="DAFTAR"> </div> </div> </form>
  • 13. <?php include "koneksi.php"; $nama = $_POST['nama']; $email = $_POST['email']; $username = $_POST['username']; $password = $_POST['password']; if (empty($nama)){ echo "<script>alert('Nama belum diisi')</script>"; echo "<meta http-equiv='refresh' content='1 url=daftar.php'>"; }else if (empty($email)){ echo "<script>alert('Email belum diisi')</script>"; echo "<meta http-equiv='refresh' content='1 url=daftar.php'>"; }else
  • 14. if(empty($username)){ echo "<script>alert('Username belum diisi')</script>"; echo "<meta http-equiv='refresh' content='1 url=daftar.php'>"; }else if (empty($password)){ echo "<script>alert('Password belum diisi')</script>"; echo "<meta http-equiv='refresh' content='1 url=daftar.php'>"; }else{ $daftar = mysql_query("INSERT INTO pengguna (id_user,nama,username,password) values ('$nama','$email','$username','$password')"); if ($daftar){ echo "<script>alert('Berhasil Mendaftar')</script>"; echo "<meta http-equiv='refresh' content='1 url=daftar.php'>"; }else{ echo "<script>alert('Gagal Mendaftar')</script>"; echo "<meta http-equiv='refresh' content='1 url=daftar.php'>"; } } ?>
  • 15. <?php include "koneksi.php"; session_start(); if (isset($_SESSION['username'])){ header ("location:index.php"); } ?> <div class="container"> <div class="page-header"> <h1><b>Form Masuk Akun</b></h1> <br /> </div> <br /> <form class="form-horizontal" method="post" name="login" action="logincek.php"> <div class="form-group"> <label class="control-label col-sm-2" for="email">Username:</label>
  • 16. <div class="col-sm-10"> <input type="text" class="form-control" id="username" placeholder="masukkan username" name="username"> </div> </div> <div class="form-group"> <label class="control-label col-sm-2" for="pwd">Password:</label> <div class="col-sm-10"> <input type="password" class="form-control" id="password" placeholder="Enter password" name="password"> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="submit" class="btn btn-default" value="LOGIN">Masuk</button> </div> </div> </form> </div>
  • 17. <?php include "koneksi.php"; $username = $_POST['username']; $password = $_POST['password']; if (empty($username)){ echo "<script>alert('Username belum diisi')</script>"; echo "<meta http-equiv='refresh' content='1 url=login.php'>"; }else if (empty($password)){ echo "<script>alert('Password belum diisi')</script>"; echo "<meta http-equiv='refresh' content='1 url=login.php'>"; }else{
  • 18. session_start(); $login = mysql_query("select * from pengguna where username='$username' and password='$password'"); if (mysql_num_rows($login) > 0){ $_SESSION['username'] = $username; header("location:index.php"); }else{ echo "<script>alert('Username atau Password salah')</script>"; echo "<meta http-equiv='refresh' content='1 url=login.php'>"; } } ?>
  • 19. <?php include "koneksi.php"; session_start(); if (!isset($_SESSION['username'])){ header ("location:login.php"); } ?> Berhasil Login, <a href="logout.php">Logout</a>
  • 20. <?php session_start(); session_destroy(); echo "<script>alert('Terima kasih, Anda Berhasil Logout')</script>"; echo "<meta http-equiv='refresh' content='1 url=login.php'>"; ?>