1. Persiapan Database
CREATE TABLE admin (
id int(10) unsigned NOT NULL auto_increment,
username varchar(80),
password varchar(10),
PRIMARY KEY (id)
);
2. Koneksi Database
function open_connection() {
$host=”localhost”;
$username=”root”;
$password=”";
$databasename=”gbadvance”;
$link=mysql_connect($host,$username,$password) or die (mysql_error());
mysql_select_db($databasename,$link);
return $link;
}
?>
3. Halaman Login Admin
Login Admin
4. Session
session_start();
require(“conn.php”);
$link=open_connection();
$sqla=”SELECT * FROM admin WHERE username=’{$_POST['user']}’ AND
password=’{$_POST['pass']}’ “;
$res=mysql_query($sqla);
if (mysql_num_rows($res)==0)
{
sumber: ilmu website
0 comments:
:a: :b: :c: :d: :e: :f: :g: :h: :i: :j: :k: :l: :m: :n: :o: :p: :q: :r: :s:
Post a Comment