script antibot image
Posté : 15 avr. 2007, 01:14
bonsoir a tous j'ai un petit problème que j'arrive pas a resoudre le problème, je vient d'installer se code ci dessous
http://www.phpcs.com/code.aspx?ID=38969#infocode
jusqu'a la tout se deroule bien, l'image s'affiche bien. Quand je veut ecrire le chiffre que l'image me donne je peut ecrire les chiffres different de l'image, il m'accepte quand meme il me retourne aucune erreur et me laisse passer sur la seconde page qui pourrait m'aider je vous montre ma page.
merci a vous de votre aide
http://www.phpcs.com/code.aspx?ID=38969#infocode
jusqu'a la tout se deroule bien, l'image s'affiche bien. Quand je veut ecrire le chiffre que l'image me donne je peut ecrire les chiffres different de l'image, il m'accepte quand meme il me retourne aucune erreur et me laisse passer sur la seconde page qui pourrait m'aider je vous montre ma page.
<?php
/* index.php
* - Identification
* Copyright (c) 2003 Frédéric Jacquot
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
include("includes/config.inc.php");
include(WEB_ROOT."includes/database.inc.php");
include(WEB_ROOT."includes/functions.inc.php");
include(WEB_ROOT."includes/lang.inc.php");
include(WEB_ROOT."includes/session.inc.php");
if (isset($_POST["ident"]))
{
if ($_POST["login"]==PREF_ADMIN_LOGIN && $_POST["password"]==PREF_ADMIN_PASS)
{
$_SESSION["logged_status"]=1;
$_SESSION["admin_status"]=1;
$_SESSION["logged_username"]=$_POST["login"];
$_SESSION["logged_nom_adh"]=_T("Administrateur");
dblog(_T("Identification"));
}
else
{
$requete = "SELECT id_adh, bool_admin_adh, nom_adh, prenom_adh
FROM ".PREFIX_DB."adherents
WHERE login_adh=" . txt_sqls($_POST["login"]) . "
AND activite_adh='1'
AND mdp_adh=" . txt_sqls($_POST["password"]);
$resultat = &$DB->Execute($requete);
if (!$resultat->EOF)
{
if ($resultat->fields[1]=="1")
$_SESSION["admin_status"]=1;
$_SESSION["logged_id_adh"]=$resultat->fields[0];
$_SESSION["logged_status"]=1;
$_SESSION["logged_nom_adh"]=strtoupper($resultat->fields[2]) . " " . strtolower($resultat->fields[3]);
dblog(_T("Identification"));
}
else
dblog(_T("Echec authentification. Login :")." \"" . $_POST["login"] . "\"");
}
}
if ($_SESSION["logged_status"]!=0)
header("location: gestion_adherents.php");
else
{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Performant-Heberg : Espace clients</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="fr">
<meta name="description" content="Performant-Hosting : Espace clients">
<meta name="keywords" content="Performant-Heberg, heberg, performant, hebergement, bande passante, windows, debian, html, php, perl, mysql, backup, allopass, directadmin, ftp, apache">
<meta http-equiv="identifier-url" name="Identifier-URL" content="">
<meta http-equiv="revisit-after" name="Revisit-after" content="7 days">
<meta http-equiv="robots" name="Robots" content="all">
<meta name="robots" content="INDEX|FOLLOW">
<link href="http://www.performant-heberg.com/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.Style8 {color: #000000}
.Style10 {color: #09BAB2}
.Style12 {
color: #09BAB2;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 10px;
}
-->
</style>
</head>
<body bgcolor="#FFFFFF">
<table width="760" height="80" align="center">
<tr>
<td>
<img border="0" src="http://www.performant-heberg.com/images/logo.gif" width="844" height="112"></td>
</tr>
</table>
<br>
<table width="835" align="center">
<tr>
<td width="130" valign="top">
<table width="173" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="173">
<img src="http://www.performant-heberg.com/images/gestion.jpg" width="186" height="50" alt="" />
</td>
</tr>
<tr>
<td align="center" valign="middle" background="http://www.performant-heberg.com/images/left_nav_bg.gif">
<table border="0" align="center" cellpadding="2" cellspacing="0" width="149">
<tr valign="top">
<td width="5" valign="middle"> <img src="http://www.performant-heberg.com/images/puce.jpg" width="5" height="8" alt="" border="0" /></td>
<td width="136" align="left" valign="middle">
<font color="#999999"><b class="Style1">
<a href="http://www.performant-heberg.com/clients/">
Panneau de gestion</a></b></font></td>
</tr>
</table>
<table width="173" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="173">
<img src="http://www.performant-heberg.com/images/paiment.jpg" width="186" height="50" alt="" />
</td>
</tr>
<tr>
<td align="center" valign="middle" background="http://www.performant-heberg.com/images/left_nav_bg.gif"><table border="0" align="center" cellpadding="2" cellspacing="0">
<tr valign="top">
<td width="5" valign="middle"> <img src="http://www.performant-heberg.com/images/puce.jpg" width="5" height="8" alt="" border="0" /></td>
<td width="132" align="left" valign="middle">
<b class="Style1">
<a href="http://www.performant-heberg.com/renouvellement.php">
Renouvellement</a></b></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<br>
<td valign="top">
<table width="95%" align="center">
<td align="center">
<br><p align="center"><font face="Tahoma" size="3"><b>Espace de votre compte sur Performant-Heberg<br></b></font></p>
<form action="http://www.performant-heberg.com/clients/interface.php" method="post">
<font face="Tahoma" size="2"><b>Identification</b></font><br>
<br>
<table style="height: 65%;" border="1" bordercolor="#3c5f7c" width="60%">
<tbody><tr>
<td align="center">
<table>
<tbody><tr>
<td><font face="Tahoma" size="2">Identifiant :</font></td>
<td><input name="login" type="text"></td>
</tr>
<tr>
<td><font face="Tahoma" size="2">Mot de passe :</font></td>
<td><input name="password" type="password"></td>
</tr>
<tr>
<td><font face="Tahoma" size="2"><center>
<?
session_start();
if(isset($_POST['submit']))
{
if ($_SESSION['ident'] == $_POST['code'])
{
echo'le code entré est bon';
}
else
{
echo' le code entré n\'est pas bon';
}
}
else
{
?>
<img src="http://www.performant-heberg.com/crypt/anti_spam.php?strlen=4&name=ident"</center></font></td>
<td><input type="text" name="code"></td>
</tr>
</tbody></table>
<br><input name="ident" value="Identification" type="submit"><br>
</td>
</tr>
</tbody></table>
<br><a href="http://www.performant-heberg.com/clients/lostpasswd.php"><font face="Tahoma" size="2">Mot de passe perdu ?</font></a><br><br><br>
</form>
</td>
</table></td>
<td width="5"> </td>
</table>
<br>
<table width="760" height="33" align="center" cellpadding="3">
<tr>
<td valign="top" class="txtb" bgcolor="#CCCCCC"><center>© 2007 - 2008, Performant-Herberg.com.</center></td>
</tr>
</table>
</body>
</html>
<?
}
?>
<?
}
?>
et voici le script de mon image (chez un ami il fonctionne tres bien donc a mon avis c'est ma page qui et au dessus)<?php
session_start();
// type de flood
$name = $_GET['name'];
// nb de caractères
$strlen = (int) $_GET['strlen'];
// taille de l'image ( width )
$width = $strlen * 25 + 20;
$height = 30;
// création
$img = imagecreatetruecolor( $width, $height );
// antialising, c'est plus bô! :-)
imageantialias( $img, 1 );
// chaine
$string = '123456789';
$chaine = '';
for( $i = 0; $i < $strlen; $i++ )
$chaine .= $string[ mt_rand( 0, 8 ) ];
$_SESSION[ $name ] = $chaine;
// couleur de départ
$c1 = array( mt_rand( 200, 255), mt_rand( 200, 255), mt_rand( 200, 255) );
// couleur finale
$c2 = array( mt_rand( 150, 200), mt_rand( 150, 200), mt_rand( 150, 200) );
$colors = array( imagecolorallocate( $img, 70, 130, 255 ) , imagecolorallocate( $img, 255, 237, 175 ), imagecolorallocate( $img, 166, 250, 186 ), imagecolorallocate( $img, 253, 188, 251 ), imagecolorallocate( $img, 255, 255, 255 ) );
// création de l'image
for( $i = 0; $i < $width; $i++ )
{
$r = $c1[0] + $i * ( $c2[0] - $c1[0] ) / $width;
$v = $c1[1] + $i * ( $c2[1] - $c1[1] ) / $width;
$b = $c1[2] + $i * ( $c2[2] - $c1[2] ) / $width;
$color = imagecolorallocate( $img, $r, $v, $b );
imageline( $img, $i, 0, $i, $height, $color );
}
// caractères
for( $i = 0; $i < $strlen; $i++ )
{
$col = imagecolorallocate( $img, mt_rand( 0, 120 ), mt_rand( 0, 120 ), mt_rand( 0, 120 ) );
imagettftext( $img, mt_rand( 20, 15 ), mt_rand( 0, 0 ), 10 + $i * 30, 25, $col, 'comic.ttf', $chaine[ $i ] );
}
// quelques lignes qui embêtent
for( $i = 0; $i < 8; $i++ )
{
imageline( $img, mt_rand(0, $width), mt_rand(0, $height), mt_rand(0, $width), mt_rand(0, $height), $colors[mt_rand( 0, 4 )] );
}
$noir = imagecolorallocate( $img, 0, 0, 0 );
// bordure
imageline( $img, 0, 0, $width, 0, $noir );
imageline( $img, 0, 0, 0, $height, $noir );
imageline( $img, $width - 1, 0, $width - 1, $height, $noir );
// header: image
header("Content-type: image/png");
imagepng( $img );
imagedestroy( $img );
?>
merci a vous de votre aide