bei mir kommt folgende fehlemedung:
Warning: readdir(): supplied argument is not a valid Directory resource in C:\Programme\xampp\htdocs\huch\gbdata\captcha\captcha_check.php on line 53
Eingabe falsch
Code wäre hier:
- Code: Alles auswählen
<?php
/**
* Captcha Bild Überprüfung
*
* Systemvoraussetzung:
* Linux, Windows
* PHP 4 >= 4.0.0-RC2 , PHP 5
* GD-Bibliothek ( > gd-1.6 )
* FreeType-Bibliothek
*
* Prüft ein Captcha-Bild
*
* LICENSE: GNU General Public License (GPL)
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* @category Captcha
* @author Damir Enseleit <info@selfphp.de>
* @copyright 2001-2006 SELFPHP
* @version $Id: captcha_check.php,v 0.10 2006/04/07 13:15:30 des1 Exp $
* @link http://www.selfphp.de
*/
/**
* Prüft ein Captcha-Bild
*
* @param string $codeCaptcha Hash-Wert
* @param string $stringCaptcha Eingabe durch den User
* @param string $dir Das Verzeichnis mit den Captcha-Bilder
* @param integer $delFile Die Zeit in Minuten, nachdem ein Captcha-Bild gelöscht wird
*
* @return bool TRUE / FALSE
*/
function CheckCaptcha($codeCaptcha,$stringCaptcha,$dir,$delFile=5)
{
// Setzt den Check erst einmal auf FALSE
$captchaTrue = FALSE;
// Übergebene Hash-Variable überprüfen
if(!preg_match('/^[a-f0-9]{32}$/',$codeCaptcha))
return FALSE;
// Übergebene Captcha-Variable überprüfen
if(!preg_match('/^[a-zA-Z0-9]{1,6}$/',$stringCaptcha))
return FALSE;
$handle = @opendir($dir);
while (false !== ($file = readdir($handle))) !!!zeile mit dem Fehler!!!
{
if (preg_match("=^\.{1,2}$=", $file))
{
continue;
}
if (is_dir($dir.$file))
{
continue;
}
else
{
$lastTime = ceil((time() - filemtime($dir.$file)) / 60);
if($lastTime > $delFile)
{
unlink($dir.$file);
}
else{
if(strtolower($file) == strtolower($codeCaptcha.'_'.$stringCaptcha.'.png'))
{
$captchaTrue = TRUE;
}
if (preg_match("=^$codeCaptcha=i", $file))
{
unlink($dir.$file);
}
}
}
}
@closedir($handle);
if ($captchaTrue)
return TRUE;
else
return FALSE;
}
// Temporäres Verzeichnis der Captcha-Bilder
$Captchadir = 'huchcaptch/';
// Löschen der alten Captcha-Bilder nach wieviel Minuten
$delFile = 10;
// Überprüfung starten
$resultCaptcha = CheckCaptcha($_POST["codeCaptcha"],$_POST["stringCaptcha"],$captchaDir,$delFile);
?>
ich komme wirklich nicht weiter und drehe langsam durch. kann etwas am server nicht stimmen, irgendwelche rechte?
das script habe ich im übrigen von: http://www.selfphp.info/kochbuch/kochbuch.php?code=22
vielen dank![/b]
