Ejemplo n.º 1
0
     //validate the customer type enumeration
     if (validate_customer_type($_POST['customer_type'])) {
         $customer_type = $_POST['customer_type'];
         $smarty->assign('customer_type', $customer_type);
     }
 }
 if (isset($_POST['valid_license_days'])) {
     //ensure valid days is an integer between 0 and 999 (inclusive)
     if (validate_integer_pattern($_POST['valid_license_days'], 0, 999)) {
         $valid_license_days = $_POST['valid_license_days'];
         $smarty->assign('valid_license_days', $valid_license_days);
     }
 }
 if (isset($_POST['licenses_purchased'])) {
     //ensure valid days is an integer between 0 and 10,000 (inclusive)
     if (validate_integer_pattern($_POST['licenses_purchased'], 0, 10000)) {
         $licenses_purchased = $_POST['licenses_purchased'];
         $smarty->assign('licenses_purchased', $licenses_purchased);
     }
 }
 if (isset($_POST['site_license'])) {
     if ($_POST['site_license'] == 'on') {
         $licenses_purchased = 0;
         $smarty->assign('licenses_purchased', $licenses_purchased);
     }
 }
 if (isset($_POST['expiration'])) {
     if ($_POST['expiration'] == 'on') {
         $valid_license_days = 0;
         $smarty->assign('valid_license_days', $valid_license_days);
     }
Ejemplo n.º 2
0
function validate_customer_type($customer_type)
{
    //make sure this is an integer before we try to pass it to the database
    if (validate_integer_pattern($customer_type)) {
        //look up the enumeration in the db
        $query = "SELECT COUNT(*) FROM CustomerTypes WHERE ID = {$customer_type}";
        $result = mysql_query($query);
        if ($result) {
            $row = mysql_fetch_row($result);
            if ($row[0] > 0) {
                mysql_free_result($result);
                return TRUE;
            }
        }
    }
    mysql_free_result($result);
    return FALSE;
}