Source for file inc.php
Documentation is available at inc.php
* Program Initilization and base functions
* This is the initilization script.
* @author Eric Lamb <eric@ericlamb.net>
* @link http://blog.ericlamb.net/
* @copyright 2008 Eric Lamb
include 'includes/classes/mySQL.class.php';
* Include DB connection values
include 'includes/connect.php';
* Check if we're dealing with 0 paramaters or help
if(isset ($argv[1]) && in_array($argv[1], array('--help', '-h', '-?'))) {
* Displays the CLI help mode.
* @param string $parse The source directory to parse
Takes a given string (--search) and searches the
Stupid Deal of the Day for a match. If a match is
found an email is sent to (--email)
<?php echo $argv[0]; ?> <option>
<option> With the --help, -help, -h,
or -? options, you can get this help.
<?php echo $argv[0]; ?> --search="term1" --email="foo@bar.com"
* Returns the passed array and createds the paramater array
* @param array $argv Passed values
foreach ($argv as $arg) {
if (preg_match('#^-{1,2}([a-zA-Z0-9]*)=?(.*)$#', $arg, $matches)) {
/* make unix like -afd == -a -f -d */
if(preg_match("/^-([a-zA-Z0-9]+)/", $matches[0], $match)) {
for($i= 0; strlen($string) > $i; $i++ ) {
$_ARG[$string[$i]] = true;
* Validates an string to ensure it matches a valid email address syntax
if (!preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/" , $email)) {
|