Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. *Read more...*

Task #596914 » index.php

Arjun Yovita, 2016-10-12 09:02 AM

 
<?php
session_start();
if (isset($_POST['submit'])){
include ("conn.php");
$username=$_POST['username'];
$password=$_POST['password'];
echo "query yang dimasukkan : ".$query="select * from admin where username='$username' and password=MD5('$password')";
echo "<br>";
$login=mysql_query($query);
$cek_login=mysql_num_rows($login);
if ($cek_login)
{
$row=mysql_fetch_array($login);
$id=$row['id'];
$nama=$row['nama'];
$_SESSION['id']=$id;
$_SESSION['nama']=$nama;
echo "<br>STATUS : Berhasil Login ";
?> <a href="home.php">Forward to Home Admin</a> <?php
}else{
echo "<br>STATUS : Password Anda salah!";
}
}
?>

<html>
<title>LOGIN YUK </title>
<head>
<script language="javascript">
function cek(){
var user= document.getElementById('userid').value;
var pass= document.getElementById('passwd').value;
if(user.replace(/^\s+| \s+$/g, '')==''){
alert('Username Harus Diisi!');
return false;
}
if(pass.replace(/^\s+| \s+$/g, '')==''){
alert('Password Harus diisi!');
return false;
}
return true;
}
</script>
</head>
<form action="index.php" method="post">
<table width="400" height="101" border="0" align="center">
<tr valign="bottom">
<td width="200" height="35" bgcolor="#CCCC33"><font size="4" face="verdana">Username</font></td>
<td width="137"><input type="text" name="username" size="20" id="userid"></td>
</tr>
<tr valign="top">
<td height="34" bgcolor="#99FF00"><font size="4" face="verdana">Password</font></td>
<td><input type="password" name="password" size="20" id="passwd"></td>
</tr>
<tr>
<td></td>
<td><input name="submit" type="submit" onClick="return cek()"
value="SUBMIT"></td>
</tr>
</table>
</form>
</body>
</html>
(2-2/2)