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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
<?php
session_start();
if (!isset($_SESSION['nombre']))
{
$_SESSION['nombre'] = 0;
}
if( $_SERVER['REQUEST_URI'] == $_SERVER['PHP_SELF'] )
{
$_SESSION['nombre']++;
}
else
{
$_SESSION['nombre']=0;
}
echo $_SESSION['nombre'];
if(isset($_POST['submit'])&& !empty($_POST['submit']))
{
extract($_POST);
//requete connection
$requete="SELECT * FROM bugs_utilisateur WHERE login='".$log."'";
$sql=mysql_query($requete);
if(mysql_num_rows($sql)>0)
{
$result=mysql_fetch_array($sql);
$pass=md5($pwd);
if($pass==$result['pass'])
{
$_SESSION['Auth']=crypt(sha1(md5($result['statut_id'])));
if($result['statut_id']=='1')
{
$_SESSION['Auth']=sha1(md5(2));
}
$_SESSION['login']=$result['login'];
}
else
{
?>
<script>alert('Mot de passe erroné')</script>
<?php
if($_SESSION['nombre']<3)
{
?>
<form action="<?php echo 'http://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].$_SERVER["PHP_SELF"]; ?>" method="post">
<label for="log"><b>Nom d'utilisation: </b></label>
<input class="field" type="text" name="log" id="log" value="" size="23" />
<label for="pwd"><b>Mot de passe:</b></label>
<input class="field" type="password" name="pwd" id="pwd" size="23" />
<input type="submit" name="submit" value=" " class="button_login" />
<input type="hidden" name="redirect_to" value=""/>
</form><?php
}
else
{
echo "je bloque ton ip";
}
}
}
else
{
?>
<script>alert('Login inconnu')</script>
<?php
if($_SESSION['nombre']<3)
{
?>
<form action="<?php echo 'http://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].$_SERVER["PHP_SELF"]; ?>" method="post">
<label for="log"><b>Nom d'utilisation: </b></label>
<input class="field" type="text" name="log" id="log" value="" size="23" />
<label for="pwd"><b>Mot de passe:</b></label>
<input class="field" type="password" name="pwd" id="pwd" size="23" />
<input type="submit" name="submit" value=" " class="button_login" />
<input type="hidden" name="redirect_to" value=""/>
</form><?php
}
else
{
echo "je bloque ton ip";
}
}
}
else
{
?>
<form action="<?php echo 'http://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].$_SERVER["PHP_SELF"]; ?>" method="post">
<label for="log"><b>Nom d'utilisation: </b></label>
<input class="field" type="text" name="log" id="log" value="" size="23" />
<label for="pwd"><b>Mot de passe:</b></label>
<input class="field" type="password" name="pwd" id="pwd" size="23" />
<input type="submit" name="submit" value=" " class="button_login" />
<input type="hidden" name="redirect_to" value=""/>
</form>
<?php
}
?> |
Partager