Example #1
0
        if (empty($out)) {
            $test = true;
            break;
        }
    }
    return $test;
}
$error = null;
if (isset($_POST['register'])) {
    if (isset($_POST['username']) && isset($_POST['password']) && isset($_POST['cpassword']) && isset($_POST['email'])) {
        global $user;
        $usr = $_POST['username'];
        $pwd = $_POST['password'];
        $cpwd = $_POST['cpassword'];
        $email = $_POST['email'];
        if (!notempty()) {
            if ($pwd === $cpwd) {
                $result = $user->register($usr, $pwd, $email);
                if ($result !== true) {
                    $error = $result;
                }
            } else {
                $error = "Password not match.";
            }
        } else {
            $error = "All field are required.";
        }
    }
}
#var_dump($_POST);
?>
 public function parseData()
 {
     global $woocsvImport;
     //===================
     //! version 2.0.0
     //  -check body data and fill in the log
     //
     //===================
     //add action before parsing all data
     do_action('woocsv_before_parse_data');
     //check the post_status
     $post_status = array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash');
     if (!in_array($this->body['post_status'], $post_status)) {
         $woocsvImport->importLog[] = sprintf(__('post status changed from %s to publish', 'woocsv-import'), $this->body['post_status']);
         $this->body['post_status'] = 'publish';
     }
     //check if there is a name or a title, else put status to draft
     /* !2.0.2 added product type check to make sure only to check for simple products  */
     if (empty($this->body['post_title']) && $this->body['post_type'] == 'product') {
         $woocsvImport->importLog[] = __('title is empty status changed to draft', 'woocsv-import');
         $this->body['post_status'] = 'draft';
     }
     //check ping status
     if (!in_array($this->body['ping_status'], array('open', 'closed'))) {
         $woocsvImport->importLog[] = sprintf(__('ping status changed from %s to ping', 'woocsv-import'), $this->body['ping_status']);
         $this->body['ping_status'] = 'open';
     }
     //check menu_order
     if (!is_numeric($this->body['menu_order'])) {
         $woocsvImport->importLog[] = sprintf(__('menu order changed from %s to 0', 'woocsv-import'), $this->body['menu_order']);
         $this->body['menu_order'] = 0;
     }
     //==========================
     //! version 2.0.0
     //  -check some meta data and fill in the log
     //
     //==========================
     //check stock status
     if (in_array('stock_status', $this->header) && !in_array($this->meta['_stock_status'], array('instock', 'outofstock'))) {
         $woocsvImport->importLog[] = sprintf(__('stock status changed from %s to instock', 'woocsv-import'), $this->meta['_stock_status']);
         $this->meta['_stock_status'] = 'instock';
     }
     //check visibility
     if (in_array('visibility', $this->header) && !in_array($this->meta['_visibility'], array('visible', 'catalog', 'search', 'hidden'))) {
         $woocsvImport->importLog[] = sprintf(__('visibility changed from %s to visible', 'woocsv-import'), $this->meta['_visibility']);
         $this->meta['_visibility'] = 'visible';
     }
     //check backorders
     if (in_array('backorders', $this->header) && !in_array($this->meta['_backorders'], array('yes', 'no', 'notify'))) {
         $woocsvImport->importLog[] = sprintf(__('backorders changed from %s to no', 'woocsv-import'), $this->meta['_backorders']);
         $this->meta['_backorders'] = 'no';
     }
     //check featured
     if (in_array('featured', $this->header) && !in_array($this->meta['_featured'], array('yes', 'no'))) {
         $woocsvImport->importLog[] = sprintf(__('featured changed from %s to no', 'woocsv-import'), $this->meta['_featured']);
         $this->meta['_featured'] = 'no';
     }
     //check manage_stock
     if (in_array('manage_stock', $this->header) && !in_array($this->meta['_manage_stock'], array('yes', 'no'))) {
         $woocsvImport->importLog[] = sprintf(__('manage_stock changed from %s to no', 'woocsv-import'), $this->meta['_manage_stock']);
         $this->meta['_manage_stock'] = 'no';
     }
     //=======================
     //! version 2.0.0
     //  sort out the prices and fill in the log
     //
     //=======================
     /* !2.0.3 changed 0 to '' */
     /* !2.0.5 empty function to notempty to allow 0 values */
     if ($woocsvImport->options['merge_products'] == 1) {
         $regular_price = in_array('regular_price', $this->header) && notempty($this->meta['_regular_price']) ? $this->meta['_regular_price'] : $this->meta['_regular_price'];
         $sale_price = in_array('sale_price', $this->header) && notempty($this->meta['_sale_price']) ? $this->meta['_sale_price'] : $this->meta['_sale_price'];
         $price = in_array('price', $this->header) && notempty($this->meta['_price']) ? $this->meta['_price'] : $this->meta['_price'];
     } else {
         $regular_price = in_array('regular_price', $this->header) && notempty($this->meta['_regular_price']) ? $this->meta['_regular_price'] : '';
         $sale_price = in_array('sale_price', $this->header) && notempty($this->meta['_sale_price']) ? $this->meta['_sale_price'] : '';
         $price = in_array('price', $this->header) && notempty($this->meta['_price']) ? $this->meta['_price'] : '';
     }
     //old way
     if ($price && !$sale_price && !$regular_price) {
         $woocsvImport->importLog[] = __('Old price field used!!!! Please use regular_price and sale_price in stead', 'woocsv-import');
         $regular_price = $price;
     }
     //new way
     //product on sale
     if ($sale_price > 0 && $sale_price < $regular_price) {
         $woocsvImport->importLog[] = __('Product is on sale', 'woocsv-import');
         $price = $sale_price;
     } else {
         //the product is not on sale
         $price = $regular_price;
         $sale_price = '';
     }
     $this->meta['_regular_price'] = $regular_price;
     $this->meta['_sale_price'] = $sale_price;
     $this->meta['_price'] = $price;
     //add action after parsing all data
     do_action('woocsv_after_parse_data');
 }
    $antiInject[":computerModel"] = $_GET['computerModel'];
}
if (notempty($_GET['serviceRequested'])) {
    $query .= "DHR.serviceRequested = :serviceRequested AND ";
    $antiInject[":serviceRequested"] = $_GET['serviceRequested'];
}
if (notempty($_GET['extraParts'])) {
    $query .= "DHR.extraParts = :extraParts AND ";
    $antiInject[":extraParts"] = $_GET['extraParts'];
}
if (notempty($_GET['requestTime'])) {
    $query .= "DHR.requestTime >= :requestTime AND ";
    $sqlDate = $_GET['requestTime'] . " 00:00:00";
    $antiInject[":requestTime"] = $sqlDate;
}
if (notempty($_GET['complete'])) {
    $query .= "DHR.complete = :complete AND ";
    $antiInject[":complete"] = $_GET['complete'];
}
$query = $query . " NULL IS NULL ORDER BY complete ASC, requestTime ASC";
/*DEBUG TEXT
echo $query . "<br/><br/>";
foreach($antiInject as $thing)
{
	echo $thing;
}
echo "<br/><br/>";
/*DEBUG TEXT*/
$ret = executeSQL_Safe_Manual($query, $dbConn, $antiInject);
//SQLTable($ret, $keys);
foreach ($ret as $a) {