Пример #1
0
include "inventory_check_start.php";
include "util.php";
if ($_POST) {
    $inputStream = $_POST["inputStream"];
    $streamArray = explode("\r\n", $inputStream);
    foreach ($streamArray as $entry) {
        $parseEntry = explode("\t", $entry);
        $pid = @$parseEntry[0];
        $checked = @$parseEntry[1];
        //checked qty
        //$pidLen = strlen($pid);
        //$padLength = 11-$pidLen;
        //echo "pid length is $padLength --";
        $pid = str_pad($pid, 11, "0", STR_PAD_LEFT);
        echo "{$pid} {$checked} <br>";
        if (ifExists($pid)) {
            $inv = db("select * from inventory_check where pid = '{$pid}' limit 1");
            $prevQty = $inv["checked"];
            $checked = $checked + $prevQty;
            db("update inventory_check set checked = '{$checked}' where pid = '{$pid}' ");
        } else {
            db("insert into inventory_check (pid, checked) values ('{$pid}', '{$checked}')");
        }
    }
}
?>

<form action="inventory_check.php" method="post">
  <table id="pack1"class="table table-condensed table-striped table-bordered table-hover">
    <tr>
      <th>আইডি</th>
Пример #2
0
    foreach ($data as $key => $value) {
        if ($value == '') {
            $valid = false;
            break;
        }
    }
    if (filter_var($data['email'], FILTER_VALIDATE_EMAIL) === false) {
        $valid = false;
    }
    return $valid;
}
if (isset($_POST)) {
    $error = '';
    $data = array();
    if ($_POST['form'] == 'signup') {
        if (ifExists($_POST['email'])) {
            $error = 'Already Registered';
        } else {
            if (valid($_POST)) {
                signup($_POST);
            } else {
                $error = 'Invalid Data Entered';
            }
        }
    } elseif ($_POST['form'] == 'login') {
        if (valid($_POST)) {
            if (check_credentials($_POST) == false) {
                $error = 'Invalid Log In Credentials';
            } else {
                $data['token'] = $token;
            }