Selamat Berjumpa kembali di gudang skripsi, kali ini kami akan memberikan sedikit contoh sederhana koneksi PHP dengan database mySQL
Contoh sederhana koneksi :
<?php $srvr="localhost"; $db="test"; $usr="root"; $pwd="test"; mysql_connect($srvr,$usr,$pwd); mysql_select_db($db); ?>
Contoh Sederhana login :
<?php session_start(); include("koneksi.php"); if(!$_POST['usertxt'] || !$_POST['pswtxt']){ echo "<script>alert('Data tidak boleh ada yang kosong !')</script>"; echo "<meta http-equiv='refresh' content='0;index.php'>"; }else { $sql = "Select * from tbl_user where user='$_POST[usertxt]' And password='".md5($_POST['pswtxt'])."'"; $proses = mysql_query($sql); $data = mysql_fetch_array($proses); $login = mysql_num_rows($proses); if ($login==0){ echo "<script>alert('Password Anda salah !')</script>"; echo "<meta http-equiv='refresh' content='0;index.php'>"; }else{ $_SESSION['user'] =$data['user']; echo "<meta http-equiv='refresh' content='0;home.php'>"; } } ?>
demikian semoga bermanfaat
1 komentar:
A review of my favorite casino - DrmCD
The casino offers some 광양 출장마사지 excellent gaming options to help you find the 강원도 출장마사지 It includes the best slots games, 의왕 출장안마 a wide range of 영천 출장샵 video games 평택 출장샵 and live dealer games
Posting Komentar