Added some sanity checks

This commit is contained in:
2013-04-14 00:45:19 +02:00
parent c7f248dae6
commit e038912a38
2 changed files with 14 additions and 2 deletions

Binary file not shown.

View File

@@ -5,7 +5,7 @@
include ("Console/Getopt.php"); include ("Console/Getopt.php");
$VERSION="1.1"; $VERSION="1.1";
$AUTHOR="(c) 2012 Jack-Benny Persson (jack-benny@cyberinfo.se)"; $AUTHOR="(c) 2013 Jack-Benny Persson (jack-benny@cyberinfo.se)";
// Exit codes // Exit codes
$STATE_OK=0; $STATE_OK=0;
@@ -73,6 +73,7 @@ if(sizeof($opts) > 0)
{ {
case 'h': case 'h':
print_help(); print_help();
exit ($STATE_OK);
break; break;
case 'V': case 'V':
@@ -95,6 +96,17 @@ if(sizeof($opts) > 0)
} }
} }
if (empty($filename))
{
fwrite(STDERR,"A filename is requierd\n");
exit($STATE_UNKNOWN);
}
if (empty($md5))
{
fwrite(STDERR,"You need to enter an MD5 checksum\n");
exit($STATE_UNKNOWN);
}
$file = md5_file($filename); $file = md5_file($filename);
if ($file == $md5) if ($file == $md5)