| Current Path : /home/sunflowe/www2/j15/components/com_easycaptcha/captchas/Secimg-Captcha/ |
| Current File : /home/sunflowe/www2/j15/components/com_easycaptcha/captchas/Secimg-Captcha/captcha.php |
<?php
/**
* EasyCaptcha
* @version $Id: captcha.php 545 2008-02-15 15:16:12Z snipersister $
* @package EasyCaptcha
* @license Released under the terms of the GNU General Public License (see LICENSE.php in the Joomla! root directory)
* @author EasyJoomla.org - Project
**/
$codeid = $_GET['captcha_id'];
$codeid = mysql_escape_string($codeid);
mt_srand((double)microtime()*1000000);
$imageid = mt_rand(0,39);
include_once("../../../../configuration.php");
if(class_exists('JConfig'))
{
$config = new JConfig;
mysql_connect($config->host, $config->user, $config->password);
mysql_select_db($config->db);
$mosConfig_dbprefix = $config->dbprefix;
}
else
{
die("Could not find Config class!");
}
$sqlab = "select * from ".$mosConfig_dbprefix."easycaptchas_secimg";
$res = mysql_query($sqlab);
while ($code = mysql_fetch_assoc($res))
{
$age = time() - $code["codedate"];
if($age > 600)
{
$sqlab = "delete from ".$mosConfig_dbprefix."easycaptchas_secimg where CodeID = '".$code["CodeID"]."'";
mysql_query($sqlab);
}
}
$sqlab = "select * from ".$mosConfig_dbprefix."easycaptchas_secimg where CodeID = '$codeid'";
$res = mysql_query($sqlab);
if (!mysql_num_rows($res))
{
$sqlab = "insert ".$mosConfig_dbprefix."easycaptchas_secimg (CodeID, ImageID, codedate) values ('$codeid', '$imageid','".time()."')";
mysql_query($sqlab);
}
else
{
$sqlab = "UPDATE ".$mosConfig_dbprefix."easycaptchas_secimg SET ImageID = '$imageid', codedate = '".time()."' WHERE CodeID = '$codeid'";
mysql_query($sqlab);
}
include("inc/img".$imageid.".php")
?>