tommyboy123x Posted June 5, 2007 Share Posted June 5, 2007 i'm putting together an upload script that reads header information to verify, for example, if a file is actually a .odt (open office text document), but the header looks something like this... chr(80).chr(75).chr(3).chr(4).chr(20).chr(0).chr(0).chr(0).chr(0).chr(0).chr(*).chr(*).chr(197).chr(54)........chr(116).chr(80) the chr(*) represents some random character, which i don't really want to figure out how to find. So is there any way to have a wildcard value which will allow it to be anything? the check looks something like this... $ext = the extension if ($ext == '.odt'){ $filestr = fread($handle, 78); //78 is the length of the header i'm using fclose($handle); if ($filestr != chr(80).chr(75).chr(3).chr(4).chr(20).chr(0).chr(0).chr(0).chr(0).chr(0)."?"."?".chr(197).chr(54).chr(94)............chr(116).chr(80)){ deleteold2($number); echo $filestr; //for debugging purposes exit(); } Quote Link to comment https://forums.phpfreaks.com/topic/54363-wildcard/ Share on other sites More sharing options...
trq Posted June 5, 2007 Share Posted June 5, 2007 You could probably use preg_match instead of your current implementation. Quote Link to comment https://forums.phpfreaks.com/topic/54363-wildcard/#findComment-268842 Share on other sites More sharing options...
tommyboy123x Posted June 5, 2007 Author Share Posted June 5, 2007 so your saying grab the 78 bytes then check if both "sections" are in it? i'm just really paranoid when people are uploading stuff to my server so i tend to over-do things lol Quote Link to comment https://forums.phpfreaks.com/topic/54363-wildcard/#findComment-268844 Share on other sites More sharing options...
tommyboy123x Posted June 5, 2007 Author Share Posted June 5, 2007 out of curiosity / future reference, IS there some kind of wild card character for PHP? Quote Link to comment https://forums.phpfreaks.com/topic/54363-wildcard/#findComment-268857 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.