PDA

View Full Version : Upload fonts to a directory and have them automatically used and randomly selected.



eSite
13 Jul 2006, 06:23 AM
Ok so I'm trying to modify a PHP script from a blogging tool.
The script generates a CAPTCHA using a single and same .ttf for all installations.
I find that is is a vulnerability issue, consequently I would like to add several fonts and have them automatically used and randomly selected.


$font_face = "texb.ttf";
$font_face is the filename (with its extension) of the font that will actually be used for the CAPTCHA

$font_path = PATH.'fonts/'.$font_face;
$font_path is the full path to that same font, not to its directory !

For an easy hack to implement, the fonts should be sorted from their directory before $font_face is set.
Note : there is an index.html to ignore in that directory.
And $font_face should be the random font.

How do I do this in PHP4 ?