Viktror
Новичок
Аутентификация!`
Уважаемые форумчане посмотрите скрипт насколко защещен вход в систему используя его!
поделитесь своим опытом!
Спасибо!
Уважаемые форумчане посмотрите скрипт насколко защещен вход в систему используя его!
PHP:
<?php
session_start();
require_once("db_fns.php");
require_once("design_forms_fns.php");
$get_login=preg_replace("/[^a-z0-9]/i", "", $_POST["login"]);//обрезаем все чтобы нельзя было сделать mySQL инъекцию
$get_passwd=preg_replace("/[^a-z0-9]/i", "", $_POST["passwd"]);
if($get_login&&$get_passwd)
{
if(!db_connect()){
login_form("Sorry we experienced technical problems try to enter in are few min later!");
exit;
}
$query="select * from users where login='$get_login'";
$results=mysql_query($query);
if ($results){
list($id_user,$m_login, $m_passwd, $first_name, $second_name)=mysql_fetch_row($results);
if($get_passwd!=$m_passwd
or $get_login!=$m_login){
login_form("Sorry but there is no such a user with this name and password!");
exit;
}
$_SESSION['valid_user']=$first_name." ".$second_name;
//display_index_page($header_1,$main_menu,$footer);
echo "you loged like". $_SESSION['valid_user'];
}
else{
login_form("Sorry but there is no such a user with this name and password!");
exit;
}
}
if(!empty($get_login)){
login_form("Could not log you in!");
exit;
}
echo "hi";
login_form("");
exit;
?>
Спасибо!