gan ane mao tanya ane ko g bisa login yec pas input user ane ganti md5 nah pas cek login ane g bisa masuk kira2 salahnya di mn gtu ?
//input user
<?php
include "config.php";
$user =$_POST['user'];
$pass =md5($_POST['pass']);
$admin =mysql_query ("insert into admin_user(user,password)values('$user','$pass')");
if($admin){
echo "<meta http-equiv='refresh' content='0; url=admin.php'>";
}else{
echo "data gagal di simpan";
}
?>
//cek user
<?php
session_start();
include "config.php";
$username = $_POST['user'];
$password = md5($_POST['pass']);
$sql = mysql_query("select * from admin_user where user = '$username' AND password='$password'");
$data=mysql_fetch_array($sql);
$hasil = mysql_num_rows($sql);
if ($hasil > 0){
session_register("user");
session_register ("password");
$_SESSION[user]=$data[user];
$_SESSION[password]=$data[password];
echo"<meta http-equiv='refresh' content='0; url=home.php'>";
}
else{
?>
<script type="text/javascript">
alert("password dan user anda tidak valid");
</script>
<?php
echo"<meta http-equiv='refresh' content='0; url=index.php'>";
}
?>