![]() |
fix captcha_helper file based on microtime() and php7.x - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: fix captcha_helper file based on microtime() and php7.x (/showthread.php?tid=70228) |
fix captcha_helper file based on microtime() and php7.x - BYOOS - 03-10-2018 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: // ----------------------------------- 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 |