Cara Membuat Website dengan Mudah - File: login.php

Artikel kali ini merupakan lanjutan dari artikel sebelumnya, dan simpan kode dibawah ini dengan nama login.php

<?php
session_start();

if (!empty($_SESSION['username'])) {
header('location:index.php');
}
?>
<html>
<head>
<title>LOGIN</title>
</head>

<body>
<h1>LOGIN</h1>

<?php
//kode php ini kita gunakan untuk menampilkan pesan eror
if (!empty($_GET['error'])) {
if ($_GET['error'] == 1) {
echo '<h3>Username dan Password belum diisi!</h3>';
} else if ($_GET['error'] == 2) {
echo '<h3>Username belum diisi!</h3>';
} else if ($_GET['error'] == 3) {
echo '<h3>Password belum diisi!</h3>';
} else if ($_GET['error'] == 4) {
echo '<h3>Username dan Password tidak terdaftar!</h3>';
}
}
?>

<form name="login" action="otentikasi.php" method="post">
<table border="0" cellpadding="5" cellspacing="0">
<tr>
    <td>Username</td>
    <td>:</td>
    <td><input type="text" name="username" /></td>
    </tr>
<tr>
    <td>Password</td>
    <td>:</td>
    <td><input type="password" name="password" /></td>
    </tr>
<tr align="right">
    <td colspan="3"><input type="submit" name="login" value="Login" /></td>
    </tr>
</table>
</form>
</body>
</html>


Nah untuk artikel selanjutnya kita akan membahas bagaimana Cara Membuat Website dengan Mudah - File: logout.php

TUTORIAL LENGKAPNYA DAPAT DIUNDUH DI LINK INI:
Cara Membuat Website Dengan Mudah
Cara Membuat Website dengan Mudah - File: cek-login.php
Cara Membuat Website dengan Mudah - File: config.php
Cara Membuat Website dengan Mudah - File: delete.php
Cara Membuat Website dengan Mudah - File: edit.php
Cara Membuat Website dengan Mudah - File: index.php
Cara Membuat Website dengan Mudah - File: insert.php
Cara Membuat Website dengan Mudah - File: login.php
Cara Membuat Website dengan Mudah - File: logout.php
Cara Membuat Website dengan Mudah - File: otentikasi.php
Cara Membuat Website dengan Mudah - File: view.php
Cara Membuat Website dengan Mudah - File: update.php

Mari Belajar Teknologi Informasi

0 Response to "Cara Membuat Website dengan Mudah - File: login.php"

Post a Comment