Selasa, 15 Maret 2011

Praktikum Pemrograman Berbasis Web - Modul 02 Pemrosesan Form

TUGAS PRAKTIKUM
validasi.php
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Administrator</title>
</head>
<body>
<?php
if(($_POST['user']=='hendri') AND ($_POST['pass']=='12345')){
    echo 'Berhasil, Anda masuk ke halaman sdministrator dengan Username: '.$_POST['user'];
    echo '<br><br>Selamat datang, '. $_POST['user'];
}
else{
    echo "<br><br><br><body text='red'><strong><center>Invalid Login!<br><br><a href='loginform.html'><h4>Back to Login</h4></a></center></strong></body>";
}
?>
</body>
</html>

cek.js
function error1(){
    alert('Masukkan Username dan Password!');
}
function check(){
    if(form1.pass.value == "" || form1.user.value=="")
    {
        error1();
    }
}

model.css
#apDiv1{
    position:absolute;
    width:373px;
    height:330px;
    z-index:1;
    left: 449px;
    top: 136px;
    background-color: #FFFFFF;
    border: 2px solid Blue;
}
#apDiv3{
    position:absolute;
    width:80px;
    height:25px;
    z-index:2;
    left: 289px;
    top: 274px;
}
.style3{
    font-size: 10px;
    font-weight: bold;
}
#apDiv2{
    position:absolute;
    width:412px;
    height:115px;
    z-index:2;
    top: 0px;
    left: 2px;
}
#header{
    width:373px;
    height:98px;
    background-image: url();
}
#footer{
    width:373px;
    height:40px;
    background-image: url();
}
body {
    background-image: url(bws.jpg);
}

loginform.html
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Login</title>
    <link rel="stylesheet" href="model.css" type="text/css"/>
    <script type="text/javascript" src="cek.js"></script>
</head>
<body onLoad="document.form1.user.focus();">
<form name="form1" method="post" action="validasi.php">
<div id="apDiv1">
<div id="header"></div>
<div align="center"><br><br>
<div align="center"><strong><br>Username: </strong><br>
    <input type="text" name="user" size="40" value="" style="background-color:yellow">
    <br><br>
    <strong>Password: </strong>
    <br>
    <input type="password" name="pass" size="40" style="background-color:yellow">
    <br><br><br>
    <input type="submit" name="submit" value="LOGIN" onClick="check()">
    <br>
    <span color="#0000FF" class="style3">&copy;Copyright bang_hendri</span><br>
    <br>
</div>
</div>
<br>
<div align="center" id="apDiv3"></div>
<div id="footer" align="center"><br></div>
</div>
</form>
</body>
</html>

Screenshot

Tidak ada komentar:

Posting Komentar