Senin, 13 April 2015

Login + Proses mySQL

<form method='post' action='proses.php'>

nama anda : <input type='text' name='user'><br><br>

sandi anda : <input type='password' name='password'><br><br>

<input type='submit' value='LOGIN'>

</form>




<?php
//koneksi
$db = 'al baru';
$con = mysql_connect('localhost', 'root', '');
mysql_select_db($db, $con);
//variabel
$user = $_POST['user'];
$password = $_POST['password'];
//pilih dari database
$q = mysql_query("select * from daftar where user='$user'");
$r = mysql_fetch_array($q);
//kondisi login
if($r['password'] == $password){
if($r['status'] == 'ok'){
echo $r['nama']." Anda sudah ok, jumlah dari  ".$r['nilai'];
}else{
echo $r['nama']." belum beruntung,,,coba lg nanti ";
}
}else{
echo "tidak bisa login";
}
?>



...SEKIAN...

Tidak ada komentar:

Posting Komentar