soedirman15@gmail.com atau WA 085740291996

Jumat, 11 Oktober 2013

Rancang Bangun Aplikasi Inventori Berbasis WEB Php

//index.php/////////////////////


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link rel="stylesheet" type="text/css" href="style.css"/>

<script type="text/javascript">
function ilang()
{
if (document.getElementById('txtuser').value=='isi username..')
{
document.getElementById('txtuser').value='';
}
}
function nongol ()
{
if(document.getElementById('txtuser').value=='')
{
document.getElementById('txtuser').value='isi username..';
}
}
</script>





<title>Halaman Utama</title>
</head>
<body>
<div id="wrapper-login">
<div id="login-head">
 
    LOGIN- Inventory Control
    </div>
    <div id="login-form">
    <form id="form1" name="form1" method="post" action="login.php">
        <table width="277" border="0" align="center">
        <tr>
     
        <td width="76" align="left">Username</td>
        <td width="10" align="left"></td>
        <td width="169" align="left"><input name="txtuser" type="text" id="txtuser" value="isi username.." onfocus="ilang()" onblur="nongol()"/></td>
        </tr>
        <tr>
        <td align="left">Password</td>
        <td align="left"></td>
        <td align="left"><input name="txtpass" type="password" id="txtpass" /></td>
        </tr>
        <tr>
        <td align="left"></td>
        <td align="left"></td>
        <td align="left"><input type="submit" name="Submit" value="Login" /></td>
        </tr>
        </tr>
        </table>
        </form>
    <p></p>
    <p>Develoved By TI - 2010</p>
    </div>
    </div>
</body>
</html>


//style.css/////////////
/* CSS Document */

/*Setiing Gaya Untuk Body */
body{
margin:0 0 0 0;
font-family:Arial, Helvetica, sans-serif;
font-size:small;

}

#wrapper-head{ /*Setiing Pembungkus Header*/
width:100%;
height:80px;
border:#FF0000 1px solid;

}

#wrapper-content{/*Setiing Pembungkus Content Aplikasi (Form)*/
width:100%;
height:300px;
border:#0000FF 1px solid;
}

#wrapper-login{/*Aturan Untuk Pembungkus Login*/
width:300px;
height:270px;
border:#CCCCCC 1px solid;
margin:auto;
margin-top:150px;
box-shadow: 0px 1px 7px #666666;
border-radius: 5px;
}

#login-head{/*Aturan Header Login*/
width:290px;
height:20px;
/*Aturan Header Login*/
padding:5px 5px 5px 5px;
font-weight:bold;
box-shadow: 0 6px 7px -6px #666666;
background-color:#909;
}

#login-form{/*Aturan Form Login*/
width:300px;
height:215px;
/*Aturan Form Login*/
text-align:center;
padding-top:25px;
}

.textbox{
border:#ccccc 1px solid;
border-radius:4px;
height:25px;
color:#0FC;
}
.textbox:focus{
box-shadow: 0px 1px 7px #ffff00;
}
.tombol{
border:#CCCCCC 1px solid;
height:30px;
padding-left:5px;
padding-right:5px;
background-color:#6666666;
color:#999;
}
.tombol:hover{
background-color:#cccccc;
color:#06F;
}




//db.php////////////////
<?php
//koneksi ke my sql
mysql_connect ("localhost","root","")or die ("ERROR;".mysql_error());
//pilih database
mysql_select_db("dbwebl_m2") or die ("ERROR: ".mysql_error());
?>


//home.php////////////////////////
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<div id="wrapper-head">
header
</div>
<div id="wrapper-content">
Content
</div>
</body>
</html>

//login.php/////////////////
<?php
//memenaggil koneksi
include "db.php";

//menangkap isian data dari text box
$user=$_POST["txtuser"];
$pwd=md5($_POST["txtpass"]);

//cari di tabel username dan pasword tersebut
$sql=mysql_query("select * from pegawai where username='$user' and password='$pwd'");

$row=mysql_fetch_row($sql);
//jika row terisi maka d ijinkan untuk masuk
if($row)
{
//buat cookie untuk penyimpanan data user yang sign in
setcookie("inventoryuser",$row[0],time()+28800);



?>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>


<style type ="text/css">
body{
font-family : Arial, Helvetica, sans-serif;
font_size : 12px;
}
#sign-box-wrap{
border:1px #09F solid;
margin:auto;
width:550px;
height:auto;
background-color:#C09;
margin-top:40px;
box-shadow:0px 1px 5px #333
}
#title-box{
background-color:#F06;
height:20px;
width:540px;
border-bottom:1px #C96 solid;
color:#00F;
font-weight:bold;
padding-top:5px;
padding-left:10px;
}
#box-content{
width:530px;
margin:10px 10px 10px 0px;
height:50px;
text-align:center;
color:#990;
margin-top:0px;
padding-top:15px;
}
</style>

<meta http-equiv="refresh" content="2;url=home.php" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LogIn Confirmasi</title>

</head>






<body style="background-color:#0F9;">
<div id="sign-box-wrap">
    <div id="title-box">
    Login Confirmation
    </div>
    <div id="box-content">
    Selamat datang <?php echo $row[2];?><br /> Halaman ini akan pindah otomatis dalam 2 detik...
    </div>
</div>

</body>
</html>

<?php
}

else
{ ?>
<div id="err" style="display:none"><?php echo mysql_error();?></div>
<script type="text/javascript">

elol=document.getElementById('err').innerHTML;
alert ('Invalid Password!\n'+elol);
//back halaman
window.location.href='javascript:history.go(-1)';
</script>
<?php
}
?>

0 komentar:

Posting Komentar