Thursday, April 3, 2014

Validasi Login Check di pemrograman PHP

<?php
include "koneksi.php";
session_start();
$sk=$_POST['sk'];
$password=$_POST['password'];

ini adalah validasi pada login check di pemrograman PHP :

$sql="select*from login where sk='$sk' and password='$password'";
$result=mysql_query($sql,$dbcon);
$data=(mysql_fetch_array($result));


if($sk == "" || $password == "")
{
header("location:login.php?init=1");
}
else
{
if($password == "$data[password]")
{
$_SESSION['sk']=$data['sk'];
$_SESSION['password']=$data['password'];

header("location:home.php?page=homeuser");
}
else
{
header("location:login.php?init=2");
}
}
?>

No comments:

Post a Comment