PHP Classes

Programming suggestions

Recommend this page to a friend!

      Fox captcha  >  All threads  >  Programming suggestions  >  (Un) Subscribe thread alerts  
Subject:Programming suggestions
Summary:Small improvement suggestion from a programmer
Messages:2
Author:joe guy
Date:2011-08-30 11:35:58
Update:2011-09-01 00:55:46
 

  1. Programming suggestions   Reply   Report abuse  
Picture of joe guy joe guy - 2011-08-30 11:35:58
Hi,

Suggestion #1

not needed to create a class with
$img = new Fox_captcha(1,1,1);

this is better:
if(Fox_captcha::test($_POST['code'])){ ...


Suggestion #2

not needed for user to set $img->class_dir

find the path automatically:

$this->class_dir = str_replace('Fox_captcha.php', '', __FILE__);
$this->class_dir = str_replace('\\', '/', $this->class_dir);
$this->class_dir = str_replace($_SERVER['DOCUMENT_ROOT'], '', $this->class_dir);
$this->class_dir = '/' . ltrim($this->class_dir, '/');





  2. Re: Programming suggestions   Reply   Report abuse  
Picture of Said Bakr Said Bakr - 2011-09-01 00:55:46 - In reply to message 1 from joe guy
Hi,
Thank you for your valuable suggestion. I will regard them in the next version.