• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
fix captcha_helper file based on microtime() and php7.x

#1
Hello

By wishing to integrate a captcha to a small ad application named FladsClassifeds, the image creation with the imageimage (fileimage) function creates an image file with the rights to zero 0000 on the server.

FIX root/system/captcha_helper.php
correctif         && (str_replace(array('_.jpg', '_.png'), '', $filename) + $expiration) < $now)
Code:
// -----------------------------------
// Remove old images
// -----------------------------------

$now = microtime(TRUE);

$current_dir = @opendir($img_path);
while ($filename = @readdir($current_dir))
{
if (in_array(substr($filename, -4), array('.jpg', '.png'))
&& (str_replace(array('_.jpg', '_.png'), '', $filename) + $expiration) < $now)
{
@unlink($img_path.$filename);
}
}

@closedir($current_dir);

create image on the server correctif  line   $img_filename = $now.'_.png';
[code]

// -----------------------------------
//  Generate the image
// -----------------------------------
$img_url = rtrim($img_url, '/').'/';

if (function_exists('imagejpeg'))
{
$img_filename = $now.'_.jpg';
umask(0333);
imagejpeg($im, $img_path.$img_filename);
}
elseif (function_exists('imagepng'))
{
umask(0333);
$img_filename = $now.'_.png';
imagepng($im, $img_path.$img_filename);
}
else
{
return FALSE;
}

$img = '<img '.($img_id === '' ? '' : 'id="'.$img_id.'"').' src="'.$img_url.$img_filename.'" style="width: '.$img_width.'; height: '.$img_height .'; border: 0;" alt=" " />';
ImageDestroy($im);

return array('word' => $word, 'time' => $now, 'image' => $img, 'filename' => $img_filename);
/code]

I hope it can serve
Gabriel
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.