Whats wrong with my code , i cant access to next page.
Looks like the text field cant be read by login.php
Thanks
Looks like the text field cant be read by login.php
Thanks
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {color: #0000FF}
.style2 {color: #392CB8}
.style3 {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-weight: bold;
}
.style6 {
font-size: 12px;
font-style: italic;
}
.style9 {font-size: 12px}
.style10 {color: #0000FF; font-size: 12px; }
.style11 {
font-size: 12;
font-weight: bold;
color: #FFFFFF;
}
.style12 {color: #FFFFFF}
-->
</style>
</head>
<body>
<table width="797" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="150" colspan="2" valign="top" bordercolor="#392CB8" bgcolor="#392CB8"><div align="center" class="style2"><img src="images/banner.jpg" width="797" height="150" align="top"></div></td>
</tr>
<tr>
<td width="180" height="50" valign="top" bgcolor="#392CB8"><table width="200" border="1" align="center" bordercolor="#392CB8" bgcolor="#392CB8">
<!--DWLayoutTable-->
<tr>
<td><!--DWLayoutEmptyCell--> </td>
</tr>
</table></td>
<td width="617" valign="top" bgcolor="#392CB8"><table width="300" border="1" align="center" bordercolor="#392CB8" bgcolor="#392CB8">
<tr>
<td width="61"><span class="style12"><a href="coba.php">[Home]</a></span></td>
<td width="8"> </td>
<td width="112"><span class="style12">[Information]</span></td>
<td width="8"> </td>
<td width="50"><div align="right" class="style12">[User]</div></td>
<td width="21"> </td>
<td width="15"><span class="style12">[Administrator]</span></td>
</tr>
</table></td>
</tr>
</table>
<table width="803" height="587" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="189" height="132" align="center" valign="middle" bordercolor="#392CB8" bgcolor="#392CB8" class="style1"><div align="right"></div> <div align="right">
<p align="center"><img src="images/gp.jpg" width="99" height="94"></p>
</div></td>
<td colspan="9" rowspan="3" valign="top"><form name="form1" method="post" action="">
</form>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<form action="login.php" method="post" name="form2">
<table width="254" border="1" align="center" id="table1">
<tr>
<td colspan="2"><div align="center">Please Login </div></td>
</tr>
<tr>
<td width="94">User Name </td>
<td width="144"><input name="txtuser" type="text" id="txtuser"></td>
</tr>
<tr>
<td>Password</td>
<td><input name="txtpass" type="password" id="txtpass"></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input name="login" type="submit" id="login" value="LOGIN">
<input type="reset" name="Submit2" value="RESET">
</div></td>
</tr>
</table>
</form> <p> </p></td>
<td width="1"></td>
</tr>
<tr>
<td height="343" valign="middle" bgcolor="#392CB8"><p align="center" class="style11"> </p>
<p align="center"> </p> <p> </p> <p> </p></td>
<td></td>
</tr>
<tr>
<td rowspan="5" valign="top" bgcolor="#392CB8"><p> </p>
<p> </p>
<p><span class="style1">
</span></p>
<p> </p>
<p> </p>
<p> </p> <p><span class="style1">
</span></p></td>
<td height="143"></td>
</tr>
<tr>
<td height="32" colspan="8" valign="top"><div align="left"><span class="style1">
</span></div></td>
<td width="16"></td>
<td></td>
</tr>
<tr>
<td width="62" height="19"> </td>
<td width="9"> </td>
<td colspan="4" valign="top"><div align="left" class="style1 style3"><em> POWER BY OPEN SOURCE : </em></div></td>
<td width="4"></td>
<td width="30"></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="55"> </td>
<td colspan="2" valign="top"><div align="center"><img src="images/php5.jpg" width="70" height="47"></div></td>
<td width="149" valign="top"><div align="center"><img src="images/mysql.gif" width="112" height="40"></div></td>
<td width="119" valign="top"><div align="center"><img src="images/wamp5.jpg" width="68" height="44" align="middle"></div></td>
<td width="121" valign="top"><div align="center"><img src="images/apache.jpg" width="60" height="47"></div></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="26"> </td>
<td colspan="6" valign="top"><div align="center" class="style6">CREATED BY CGK-INNOVATION 2007 </div></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="0"></td>
<td></td>
<td></td>
<td width="103"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</body>
</html>
Code:
<?php
session_start();
session_register("username");
?>
<table width="149" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutDefaultTable-->
<tr>
<td width="9" height="57"> </td>
<td width="140" valign="top"><a href="index.htm">back to main page</a> </td>
</tr>
</table>
<?php
if ((!$txtuser) or(!$txtpass)){
echo"<br>";
echo "User Name:$txtuser";
echo "<br>";
echo "Wrong Password ";
}else
{
include "koneksi.php";
$txtpass=md5($password);
$query_login=mysql_query("select * from tbluser where username='$txtuser' and password='$txtpass'",$koneksi) or die (mysql_error());
while($row=mysql_fetch_array($query_login))
{
if($txtpass=="$row[password]" && $txtuser=="$row[username]")
{
header("location:./login/user.php");
}
else
header("location:./index.php?error=1");
}}
?>
Comment