bonjour j'ai fait une petite fonction d'authentification à insérer dans toute les pages mais je me fais hacker. Je pense qu'elle a un problème mais je n'arrive pas à le trouver. Voilà ma fonction :
merci pour votre aideCode:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 function securiter($table,$redirect) { if ((!isset($_POST['log'])) && (!session_is_registered('siad_pass'))) { echo"<script language='javascript'> alert('Veuillez vous identifier ! ');</script>"; echo"<script language='javascript'>"; echo" document.location='".$redirect."'"; echo"</script>"; } else { if (session_is_registered('siad_pass')) { $password=$_SESSION['password']; $login=$_SESSION['login']; } else { $login=$_POST['log']; $password=md5($_POST['pwd']); $v=mysql_query("select * from $table where login='$login' and password='$password'"); $d=mysql_num_rows($v); if (!$d) { echo"<script language='javascript'> alert('erreur sur le login ou sur le mot de passe ! ');</script>"; echo"<script language='javascript'>"; echo" document.location='",$redirect,"'"; echo"</script>"; } else {session_register('siad_pass'); $_SESSION['login']=$login; $_SESSION['password']=$password; $_SESSION['id']=$d; } } } }
