Sabtu, 02 November 2013

session start

<?php
  session_start();
  require_once("../koneksi/koneksi.php");  
  $username = $_POST['username'];
  $password = $_POST['password'];
  $cekuser = mysql_query("SELECT * FROM admin WHERE username = '$username'");
  $jumlah = mysql_num_rows($cekuser);
  $hasil = mysql_fetch_array($cekuser);
  if($jumlah == 0) {
echo "User ID Belum Terdaftar!<br/>";
echo "<a href=\"admin.php\">&laquo; Back</a>";
} else {
if($password <> $hasil['password']) {
echo "Password Salah!<br/>";
echo "<a href=\"admin.php\">&laquo; Back</a>";
} else {
$_SESSION['username'] = "$username";
header('location:admin.php');
}
}
?>

<?php
  session_start();
  if(isset($_SESSION['username'])) {
  header('location:admin.php'); }
  require_once("../koneksi/koneksi.php");
?>


<?php
  session_start();
  if(!isset($_SESSION['username'])) {
  header('location:index.php'); }
  else { $username = $_SESSION['username']; }
  require_once("../koneksi/koneksi.php");

  $query = mysql_query("SELECT * FROM admin WHERE username = '$username'");
  $hasil = mysql_fetch_array($query);
?>

Posting Lebih Baru Posting Lama Beranda

0 komentar: