
14-12-2005, 22:04
|
 |
|
|
חבר מתאריך: 02.10.05
הודעות: 2,355
|
|
הנה:
קוד PHP:
<?php //------------------------------------------------ //this program is programed by nadav tenenbaum //verzion 1.5.0.0.0.0 //------------------------------------------------ $err_msg=""; $faild="0"; function my_err() { global $faild; global $err_msg; if ($faild != "1") { $faild="1"; $err_msg .="Eror <br /> \n"; } } if (isset($_POST['posted'])) { if (isset($_COOKIE['login'])) { die("you are allready login"); } if (isset($_SESSION['login'])) { die("you are allready login"); } $pass_s=sha1($_POST['pass']); $claint_s=mysql_escape_string($_POST['claint']); //check if user do not whant to use cookies if (!isset($_POST['cookie'])) { $no_cookie="1"; } $link=mysql_connect('localhost','root','070794')or die("Error!"); //connect to mysql or error mysql_select_db('agzoz',$link); //select my database $check=mysql_query("SELECT * FROM claints WHERE claint='".$claint_s."'"); //claint select $access="0"; if (mysql_num_rows($check) > 0) { //make shour thet claint is corecct $access="1"; } //now we check this if ($access!="1") { //delate cookies $faild="1"; my_err(); $err_msg .="the claint is incorrect <br /> \n"; } //well herre all work fine elseif ($access=="1") { $pass=mysql_query("SELECT * FROM claints WHERE pass='".$pass_s."'"); //claint select if (mysql_num_rows($pass) > 0) { //make shour thet the pass is correcct $access="2"; } } //if mysql do not find the pass rows if ($access!="2") { //delate cookies my_err(); $err_msg .="the password is incorrect \n"; } if ($faild != "1") { if ($no_cookie != "1") { setcookie("claint",$_POST['claint'],time()+60*60*24*367*3); setcookie("login","1",time()+60*60*24*367*3); } else { session_start(); $_SESSION['login']="1"; $_SESSION['claint']=$_POST['claint']; } mysql_close($link); include("user_panel.php"); exit; } } ?> <!doctype html public "-//W3C//DTD HTML 4.01//EN">
<html>
<head> <title>Untitled</title> <meta http-equiv="generator" content="PHP Designer 2005" /> </head>
<body> <form action="login.php" method="POST" enctype="application/x-www-form-urlencoded" name="log"> <input type="hidden" value="1" name="posted" /> <center> <table> <tr> <td><input type="text" name="claint" style='direction:rtl;' /></td> <td><font size="3">שם משתמש</font></td> </tr> <tr> <td><input type="password" name="pass" style='direction:rtl;' /></td> <td><font size="3">סיסמא</font></td> </tr> <tr> <td> <input type="checkbox" value="cookie" /> <font size="3">השתמש בעוגיות</font> </td> <td> <input type="submit" value="שלח" /> </td> </tr> </table>
<center> </form>
</body> </html>
include("user_panel.php"); עושה בעיות... אני ינסה לעשות header...
נערך לאחרונה ע"י tnadav1 בתאריך 14-12-2005 בשעה 22:09.
|