Dette er mine sider:
Login.htm:
------------------------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<style type="text/css">
body , html {
height: 100%;
margin: 0px;
padding: 0px;
}
</style>
<title>Tackleprices.com | Merchant Area</title>
<style type="text/css">
<!--
.left-frame {
border-right-width: 1px;
border-right-style: solid;
border-right-color: #CCCCCC;
padding-bottom: 5px;
}
.top-border {
border-top-width: 1px;
border-top-style: solid;
border-top-color: #CCCCCC;
}
.register {
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #CCCCCC;
padding-top: 5px;
}
.bottom-border {
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #CCCCCC;
}
-->
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="200" align="center" valign="bottom" bgcolor="#EFEFEF" class="left-frame"><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif">©
2004, Tackleprices.com</font></td>
<td valign="top">
<form name="form1" action="login_check.php" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="60" colspan="4"> </td>
</tr>
<tr>
<td width="30" height="30" align="center" class="top-border"> </td>
<td width="120" height="30" align="center" class="top-border"> </td>
<td height="30" colspan="2" valign="bottom" class="top-border"> </td>
</tr>
<tr>
<td width="30" height="110" rowspan="2" align="center" valign="bottom"> </td>
<td width="120" height="110" rowspan="2" align="center" valign="bottom"><img src="/img/login.gif" width="97" height="105"></td>
</tr>
<tr>
<td height="110" colspan="2" valign="bottom" class="leftspan"><font color="#006393" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Tackleprices
| Merchant Area</strong></font><br>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">Enter your username and password to login</font><br> <img src='/img/break_CCCCCC.gif' width='400' height='1' vspace='8'></td>
</tr>
<tr>
<td width="30" rowspan="4" align="center" valign="top" class="register"> </td>
<td width="120" rowspan="4" align="center" valign="top" class="register">[ <a href="/merchant/add.php"><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#990000">Register</font></a> ]</td>
<td width="93" height="25" class="leftspan"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Username:</font></td>
<td width="826" height="25">
<input type="text" name="username" class="form1">
</td>
</tr>
<tr>
<td height="30" valign="middle" class="leftspan"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Password</font>:</td>
<td height="30" valign="middle"> <input type="password" name="password" class="form1">
</td>
</tr>
<tr>
<td height="30" valign="top"> </td>
<td height="30" valign="bottom"> <input type="submit" name="Submit" value="Login"></td>
</tr>
<tr>
<td height="30" colspan="2" class="bottom-border"> </td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
login_check.php:
------------------------------------------------------------------------------------
<?
/* Check User Script */
session_start(); // Start Session
include("/home/tacklepr/public_html/db.php");
// Convert to simple variables
$username = $_POST['username'];
$password = $_POST['password'];
if((!$username) || (!$password)){
echo "Please enter ALL of the information! <br />";
include 'login.htm';
exit();
}
// Convert password to md5 hash
$password = md5($password);
// check if the user info validates the db
$sql = mysql_query("SELECT * FROM merchants WHERE login_name='$username' AND password='$password' AND status_admin='1'");
$login_check = mysql_num_rows($sql);
if($login_check > 0){
while($row = mysql_fetch_array($sql)){
foreach( $row AS $key => $val ){
$$key = stripslashes( $val );
}
// Register some session variables!
session_register('id');
$_SESSION['id'] = $id;
session_register('login_name');
$_SESSION['login_name'] = $login_name;
session_register('merchant_name');
$_SESSION['merchant_name'] = $merchant_name;
session_register('password');
$_SESSION['password'] = $password;
mysql_query("UPDATE merchants SET last_login=now() WHERE id='$id'");
}
} else {
echo "You could not be logged in! Either the username and password do not match or you have not validated your membership!<br />
Please try again!<br />";
include 'login.php';
}
header("Location: index.php");
?>
index.php:
------------------------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd"><?
session_start();
// check if the user info validates the db
include("/home/tacklepr/public_html/db.php");
$sql_doublecheck = mysql_query("SELECT * FROM merchants WHERE login_name='$login_name' AND password='$password' AND status_admin='1'");
$doublecheck = mysql_num_rows($sql_doublecheck);
if($doublecheck != 1) {
include '/home/tacklepr/public_html/merchant/login.htm';
exit();
}
include "/home/tacklepr/public_html/merchant/menu/menu.htm";
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Tackleprices.com | Merchant Area</title>
<link href="/merchant/styles/default.css" rel="stylesheet" type="text/css">
<?
include "/home/tacklepr/public_html/merchant/include/head.php";
?>
</head>
<body>
<div id="container">
<?
include("/home/tacklepr/public_html/db.php");
include "/home/tacklepr/public_html/merchant/include/menues.php";
?>
</div>
</body>
</html>