Jump to content

Wildcard?


tommyboy123x

Recommended Posts

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();
}

Link to comment
https://forums.phpfreaks.com/topic/54363-wildcard/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.