function checkNumber($n, $maxNumber) { if (isMax(stringToArray($n), $maxNumber)) { echo "\n\nnot possible and max is {$n}\n\n"; } else { $n++; $new = stringToArray($n); sort($new); if ($new == $compairNumber) { echo "\n\nThe next number is {$n}\n\n"; } else { checkNumber($n, $maxNumber); } } }
public function getEDTRecords($pid, $option = false) { $result = false; if (!$this->isPatient($pid) || !checkNumber($pid)) { return $result; } $q = "SELECT P.edtid, A.pname,E.dateperf,E.activitytype,E.enames,E.description,E.duration,E.outcome, E.cost, A.pid\r\n\t\t\t FROM EDTRecords E, PatientExaminations P JOIN Patients A\r\n\t\t\t ON A.pid = P.pid\r\n\t\t\t WHERE P.edtid = E.edtid AND A.pid = '" . $pid . "'"; // Print out entries for current visit only if true if ($option == 'current') { $q .= " AND P.pid IN(SELECT pid FROM CheckInOuts WHERE outdate IS NULL)"; } elseif ($option == 'unprocessed') { $q .= " AND P.processed = 0"; } $result = $this->dbh->query($q); return $result; }
$lastName = ucfirst(filter_var($lastName, FILTER_SANITIZE_STRING)); //NICKNAME $nickName = trim($_POST['nickName']); $nickNameCheck = checkLetters($nickName); if (!$nickNameCheck == 1) { exit($nickNameCheck); } $nickName = ucfirst(filter_var($nickName, FILTER_SANITIZE_STRING)); //EMAIL $email = trim($_POST['email']); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { exit("Invalid email"); } //PHONE NUMBER $mobilePhone = trim($_POST['number']); $mobilePhoneCheck = checkNumber($mobilePhone); if (!$mobilePhoneCheck == 1) { exit($mobilePhoneCheck); } $mobilePhone = filter_var($mobilePhone, FILTER_SANITIZE_STRING); //TEXT OK //If they want to screw with the submit page thats thier problem. It ain't going in our database $textOK = trim($_POST['text']); if ($textOK == 'Yes') { $text = 'Yes'; } else { $text == 'No'; } //GRADE //Remeber don't trust the user, if you don't have to give them db asscess don't do it switch (trim($_POST['grade'])) {
$integer = 247; $arrayOfNumbers = array(); $numberFound; if ($integer < 102) { $numberFound = FALSE; } elseif ($integer > 101 && $integer < 999) { for ($i = 102; $i <= $integer; $i++) { if (checkNumber($i)) { array_push($arrayOfNumbers, $i); $numberFound = TRUE; } } } elseif ($integer > 101 && $integer >= 999) { for ($i = 102; $i < 999; $i++) { if (checkNumber($i)) { array_push($arrayOfNumbers, $i); $numberFound = TRUE; } } } if (!$numberFound) { echo "no"; } else { $result = implode(', ', $arrayOfNumbers); echo $result; } function checkNumber($number) { $string = (string) $number; $firstDigit = $string[0];
function getKeyItemlistWithStrength() { mysql_query('SET CHARACTER SET utf8'); $ItemGroupId = checkNumber($_POST['pItemGroupId']); $bStrength = $itemGroupId == 1 ? 1 : 'NULL'; $result = mysql_query(" SELECT ItemNo,ItemName FROM itemlist WHERE ItemGroupId={$ItemGroupId} AND (bStrength= {$bStrength} OR {$bStrength} is NULL) AND bKeyItem = 1 Order By ItemName"); if (mysql_num_rows($result) > 0) { while ($obj = mysql_fetch_object($result)) { $arr[] = $obj; } } echo '{rows:' . json_encode($arr, JSON_HEX_APOS) . '}'; }
function checkIDSQL($id) { if (checkNumber($id) == false && $id != '') { Eerr('提示', 'id中有非法字符'); } }
//Write a PHP script NonRepeatingDigits.php that declares an integer variable N, and then finds all 3-digit numbers that are less or equal than N (<= N) and consist of unique digits. Print "no" if no such numbers exist. function checkNumber($num) { $arr = array(); for ($i = 102; $i <= 987; $i++) { if ($i <= $num) { $isUnique = function ($var) { $var = (string) $var; for ($i = 0; $i < strlen($var); $i++) { if ($var[$i] == $var[$i + 1] && $var[$i] == $var[$i + 1]) { $isUnique = false; } } return $isUnique; }; if ($isUnique == true) { array_push($arr, $i); } } } if (count($arr) == 0) { print 'no'; } else { print implode(', ', $arr); } } checkNumber(1234); checkNumber(145); checkNumber(15); checkNumber(247);
function inputTextArea($textName, $valueStr, $width, $height, $helpStr) { $Css = ''; $HeightStr = ''; $width = aspTrim(lCase($width)); if ($width != '') { if (right($width, 1) != '%' && right($width, 2) != 'px') { $width = $width . 'px'; } $Css = ' style=\'width:' . $width . ';\''; } if ($height != '') { if (checkNumber($height)) { //自动加个px像素 $height = $height . 'px'; } $HeightStr = 'height:' . $height . ';'; if ($Css != '') { $Css = replace($Css, ';\'', ';' . $HeightStr . ';\''); } else { $Css = ' style=\'height:' . $height . ';\''; } } $Css = replace($Css, ';;', ';'); //去掉多余的值 $inputTextArea = '<textarea name="' . $textName . '" type="text" id="' . $textName . '"' . $Css . '>' . $valueStr . '</textarea>' . $helpStr; return @$inputTextArea; }
public function checkOutPatient($data) { if (!$this->isPatient($data['pid']) || !checkFilled($data) || !verifyDate($data['outdate']) || !checkNumber($data['eidout']) || !checkNumber($data['pid']) || !$this->isCheckedIn($data['pid'])) { return false; } $where = array('field' => 'pid', 'value' => $data['pid']); // Add up costs of EDT records for that visit $total = 0; $t = new Treatment(); $edts = $t->getEDTRecords($data['pid'], true); foreach ($edts as $e) { $total = $total + $e['cost']; } $data['totalbill'] = $total; unset($data['pid']); // remove pid from elements return $this->dbh->update('CheckInOuts', $data, $where, true); }
function isNumber($content) { $isNumber = checkNumber($content); return @$isNumber; }