הנה הקוד לבקשתך:
PHP קוד:
<?php
session_start();
include ('config.php');
$ip = $_SERVER["REMOTE_ADDR"];
$date = date("d/m/Y H:i:s");
$username = $_POST['username'];
$password = $_POST['password'];
$query = mysql_query("INSERT INTO logsin(name,password,ip,date) VALUES ('$username','$password','$ip','$date')") or die (mysql_error());
$q="SELECT * from admins where username='$username' and password='$password'";
$result= mysql_query($q) or die
("Could not execute query : $q." . mysql_error());
if (mysql_num_rows($result) == 0)
{
?>
<html dir="rtl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
<title>התחברות לאדמין</title>
<style>
*
{
FONT-SIZE: 10pt;
FONT-FAMILY: ARIAL;
}
b
{
FONT-WEIGHT: bold;
}
.listtitle
{
BACKGROUND: #14859C;
COLOR: #EEEEEE;
white-space: nowrap;
}
td.list
{
BACKGROUND: #EEEEEE;
white-space: nowrap;
}
</style>
</head>
<body onLoad="document.form.username.focus();">
<center><br><br><font face="ARIAL" size="7"><font size="7"><br></font>
<font size="7" face="ARIAL"><br>
</font></font>
<h1><font face="ARIAL" size="10"><u>דף התחברות לאדמין</u></font></h1>
<table dir="rtl" style="BORDER-RIGHT: rgb(0,0,0) 1px solid; BORDER-TOP: rgb(0,0,0) 1px solid; FONT-SIZE: 12px; BORDER-LEFT: rgb(0,0,0) 1px solid; BORDER-BOTTOM: rgb(0,0,0) 1px solid; FONT-FAMILY: Arial; BORDER-COLLAPSE: collapse" cellSpacing="1" cellPadding="5">
<h1>פרטים שגויים אנא נסה שנית</h1>
<tr>
<td class=listtitle colspan=2><font face="ARIAL" size="7" color="#000000">בבקשה הכנס את השם
משתמש וסיסמה שלך:</font></td></tr>
<form action="login.php" method="POST" name="form">
<input type=hidden name=referer value="/">
<tr><td class=list align=right>שם משתמש:</td><td class=list>
<input type=text name=username size="20"></td></tr>
<tr><td class=list align=right>סיסמה:</td><td class=list>
<input type=password name=password size="20"></td></tr>
<tr><td class=listtitle align=right colspan=2><center><input type="submit" name="submit" onmouseover="this.style.background='#14859C'" onmouseout="this.style.background='#14859C'" style="border: 1px solid #000000; font-size: 10px; background: #14859C font color: #ADADAD" value="התחבר" /> <input type="reset" name="reset" onmouseover="this.style.background='#14859C'" onmouseout="this.style.background='#14859C'" style="border: 1px solid #000000; font-size: 10px; background: #14859C font color: #ADADAD" value=" נקה " /></center></td></tr>
</form>
</table>
<br>
<br>All rights reserved to
<font face="Arial"><b><font color="#FF0000">
<span class="style1">E</span></font>spire&<font color="#FF0000"><span class="style1">M</span></font>code
</b></font>
</center>
</body>
</html>
<?
}
else
{
$r=mysql_fetch_array($result);
$login_username=$r["username"];
session_register("login_username");
Header("Location: index.php");
}
?>