Exemplo n.º 1
0
function check()
{
    //var_dump(checkID());die();
    if (checkID() == FALSE) {
        return false;
    }
    return true;
}
    $texttoalert = $texttoalert . 'Surname is empty \\n';
} else {
    $result_name = trim($_POST["surName"]);
    if (preg_match("/^[a-zA-Z0-9]+\$/", $_POST['surName']) == 0) {
        $statusQuery4 = FALSE;
        $texttoalert = $texttoalert . 'Surname can between A-Z and a-z\\n';
    }
}
//-----------------------[End] Check Surname-----------------------//
//-----------------------[Start] Check ID Num-----------------------//
if (empty($_POST["people_id"])) {
    $statusQuery5 = FALSE;
    $texttoalert = $texttoalert . 'ID Card Number is empty \\n';
} else {
    $idnum = preg_replace("/[-]|[ ]/", "", $_POST["people_id"]);
    if (checkID($idnum)) {
    } else {
        $statusQuery6 = FALSE;
        $texttoalert = $texttoalert . 'ID Card Number is incorrect \\n';
    }
}
//-----------------------[End] Check ID Num-----------------------//
//-----------------------[Start] Check Email-----------------------//
if (empty($_POST["email"])) {
    $statusQuery7 = FALSE;
    $texttoalert = $texttoalert . 'E-mail is empty \\n';
} elseif (preg_match("/[@]/", $_POST["email"]) == 0) {
    $statusQuery8 = FALSE;
    //$texttoalert = $texttoalert.'E-mail is error \n';
    $texttoalert = $texttoalert . $_POST["email"] . '\\n';
}
Exemplo n.º 3
0
        if (($x[$i] > 'z' || $x[$i] < 'a') && ($x[$i] > '9' || $x[$i] < '0') && $x[$i] != '_') {
            return false;
        }
    }
    return true;
}
if ($_GET['cmd'] == 'recv') {
    $uid = $_POST['uid'];
    $uname = $_POST['uname'];
    $grade = $_POST['grade'];
    $passwd = $_POST['passwd'];
    if ($passwd != $_POST['reppasswd']) {
        header("Location: error.php?word=Password not match!");
        return;
    } else {
        if (!checkID($uname)) {
            header("Location: error.php?word=Please use real name!");
            return;
        } else {
            $fln = "../users/" . $uid . ".uinfo";
            if (is_file($fln)) {
                header("Location: error.php?word=User id already used");
            }
            $opf = fopen($fln, "w");
            fprintf($opf, "%s\n%s\n", $uname, $grade);
            fclose($opf);
            $fln = "../users/" . $uid . ".upasswd";
            $opf = fopen($fln, "w");
            fprintf($opf, "%s", MD5($passwd));
            fclose($opf);
            echo "<font style='font-size: 24px'>";
Exemplo n.º 4
0
<?php

//$categoryName='menu';
//categoryName='Onion powder Onion (minced)';
$categoryName = $_GET['item'];
$outputID = null;
$outputMenu = null;
$outputData = null;
$description = null;
// Load the JSON data
$data = json_decode(file_get_contents("spices.json"));
$categoryList = $data->categories;
$spices = $data->spices;
//var_dump($categories);
$outputID = checkID($categoryList, $categoryName);
//var_dump($outputID);
if ($outputID == null) {
    $description = searchDescription($spices, $categoryName);
} else {
    $outputMenu = checkMenu($categoryList, $outputID);
    //var_dump($outputMenu);
}
//
$outputData = (object) ["menu" => $outputMenu, "description" => $description];
echo json_encode($outputData);
/**
 * check output ID numbers from the category list
 * @param  [array] $categoryList
 * @param  [string] $categoryName
 * @return [array] $outputID
 */
Exemplo n.º 5
0
require "init_j.php";
$args = array('action' => FILTER_SANITIZE_STRING, 'name' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_NO_ENCODE_QUOTES), 'id' => FILTER_VALIDATE_INT, 'type' => FILTER_SANITIZE_STRING, 'brand' => FILTER_SANITIZE_STRING, 'model' => FILTER_SANITIZE_STRING);
$inputs = filter_input_array(INPUT_POST, $args);
switch ($inputs['action']) {
    case 'typeahead-type':
        $query = "SELECT `type` as `name` FROM `" . $S_CONFIG['prefix'] . "type` WHERE `type` LIKE '%" . $inputs['name'] . "%' GROUP BY `name`;";
        break;
    case 'typeahead-brand':
        $query = "SELECT `brand` as `name` FROM `" . $S_CONFIG['prefix'] . "brand` WHERE `brand` LIKE '%" . $inputs['name'] . "%' GROUP BY `name`;";
        break;
    case 'typeahead-model':
        $query = "SELECT `model` as `name` FROM `" . $S_CONFIG['prefix'] . "model` WHERE `model` LIKE '%" . $inputs['name'] . "%' GROUP BY `name`;";
        break;
    case 'add':
        $typeId = checkID($S_CONFIG['link'], "type", $inputs['type']);
        $brandId = checkID($S_CONFIG['link'], "brand", $inputs['brand']);
        if (!$typeId) {
            $query = "INSERT INTO `" . $S_CONFIG['prefix'] . "type` VALUE (0, '" . $inputs['type'] . "');";
            mysqli_query($S_CONFIG['link'], $query) or exit(mysqli_error($S_CONFIG['link']));
            $typeId = mysqli_insert_id($S_CONFIG['link']);
        }
        if (!$brandId) {
            $query = "INSERT INTO `" . $S_CONFIG['prefix'] . "brand` VALUE (0, '" . $typeId . "', '" . $inputs['brand'] . "');";
            mysqli_query($S_CONFIG['link'], $query) or exit(mysqli_error($S_CONFIG['link']));
            $brandId = mysqli_insert_id($S_CONFIG['link']);
        }
        if ($inputs['id'] == 0) {
            $query = "INSERT INTO `" . $S_CONFIG['prefix'] . "model` VALUE \n\t\t\t(NULL, '" . $typeId . "', '" . $brandId . "', '" . $inputs['model'] . "');";
            mysqli_query($S_CONFIG['link'], $query) or exit(mysqli_error($S_CONFIG['link']));
            $modelId = mysqli_insert_id($S_CONFIG['link']);
        } else {
Exemplo n.º 6
0
//                                {
//                                    $price                = number_format(($data5 * ($data4/100)), 2, '.', ''); 
//                                    $special_price        = ($data4 - $price); 
//                                    $special              = number_format(($special_price), 2, '.', ''); 
//                                    $query = "INSERT INTO sohorepro_special_pricing SET sp_list_price = '".$data4."', sp_discount = '".$data5."', sp_special_price = '". $special ."' ";
//                                    mysql_query($query);
//                                }
			}                        
                        $pro = tempProd();
                        foreach ($pro as $PP)
                        {   
                            $product_id      = $PP['id'];
                            $list_price      = $PP['list_price'];
                            $discount        = $PP['discount'];
                            $special_price   = $PP['price'];
                            $id_check        = checkID($product_id);
                            if(count($id_check) < 1)
                            {
                                if($discount != '0.00')
                                    {
                                        $query = "INSERT INTO sohorepro_special_pricing_excel SET sp_product_id = '".$product_id."', sp_list_price = '".$list_price."', sp_discount = '".$discount."', sp_special_price = '". $special_price ."' ";
                                        mysql_query($query); 
                                    }
                            }
                            
                        }
                        
                        $result = "success";
		}
                
}