function output_message($message = "") { if (!isempty($message)) { return "<p class=\"message\">{$message}</p>"; } else { return ""; } }
private function checkitem($userdata, $param, $key) { if (get_item($userdata, $param) && !isempty($userdata[$param])) { return 0; } $this->set_message(sprintf(lang('account.param.empty'), $param) . '<br />'); return 1; }
public function validateData() { if (!is_string($this->AMT)) { $this->AMT = sprintf("%01.2F", $this->AMT); } //echo "MID:"; if (isempty($this->MID)) { return false; } if (strlen($this->MID) > 20) { return false; } //echo "AMT:"; if (strlen((string) $this->AMT) > 13) { return false; } if (strpos(',', (string) $this->AMT) !== false) { return false; } //echo "VS:"; if (isempty($this->VS)) { return false; } if (strlen($this->VS) > 10) { return false; } if (!preg_match('/^[0-9]+$/', $this->VS)) { return false; } //echo "CS:"; if (isempty($this->CS)) { return false; } if (strlen($this->CS) > 4) { return false; } if (!preg_match('/^[0-9]+$/', $this->CS)) { return false; } //echo "RURL:"; if (isempty($this->RURL)) { return false; } if (!preg_match("/^https?://.+\$/i", $this->RURL)) { return false; } if (!isempty($this->SS)) { //echo "SS:"; if (strlen($this->SS) > 10) { return false; } if (!preg_match('/^[0-9]+$/', $this->SS)) { return false; } } return true; }
protected function validateData() { if (isempty($this->VS)) { return false; } if (!($this->RES == "OK" || $this->RES == "NO")) { return false; } return true; }
function buildNumberAttributes($field) { $output = ""; if (!isempty($field["format"]) && $field['format'] == 'value') { $output .= !isempty($field["min"]) ? ' min="' . $field['min'] . '"' : ""; $output .= !isempty($field["max"]) ? ' max="' . $field['max'] . '"' : ""; $output .= !isempty($field["step"]) ? ' step="' . $field['step'] . '"' : ""; } return $output; }
public function update_user($user) { $password = ''; $args = array(':username' => $user->get_username(), ':email' => $user->get_email(), ':first_name' => $user->get_first_name(), ':last_name' => $user->get_last_name(), ':admin' => $user->get_admin(), ':active' => $user->get_active()); if (!isempty($user->get_password())) { $args[':password'] = $this->encrypt->encrypt($user->get_password()); $password = '******'; } $query = "UPDATE user_data SET\n\t\t\t\temail = :email, first_name = :first_name, last_name = :last_name, admin = :admin, active = :active {$password}\n\t\t\t\tWHERE username = :username"; $update = $this->db->query($query, $args); return $update; }
public function update($user) { $password = ''; $args = array(':email' => $user->get_email(), ':first_name' => $user->get_first_name(), ':last_name' => $user->get_last_name(), ':admin' => $user->get_admin(), ':status' => $user->get_status(), ':id' => $user->get_id()); if (!isempty($user->get_password())) { $args[':password'] = $this->encrypt->encrypt($user->get_password()); $password = '******'; } $query = "UPDATE user_admin SET\n\t\t\t\temail = :email, first_name = :first_name, last_name = :last_name, admin = :admin, status = :status {$password}\n\t\t\t\tWHERE id = :id"; $update = $this->db->query($query, $args); return $update; }
public function update_user($user) { $password = ''; $args = array(':user_name' => $user->get_user_name(), ':group' => $user->get_user_group(), ':email' => $user->get_user_email(), ':first_name' => $user->get_user_first_name(), ':last_name' => $user->get_user_last_name()); if (!isempty($user->get_user_password())) { $args[':password'] = $user->get_user_password(); $args[':pwd'] = $this->encrypt->encrypt($user->get_user_password()); $password = '******'; } $query = "UPDATE user_info SET\n\t\t\t\tuser_group = :group, user_email = :email, user_first_name = :first_name, user_last_name = :last_name {$password}\n\t\t\t\tWHERE user_name = :user_name"; $update = $this->db->query($query, $args); return $update; }
function compare_user_admin($user1, $user2) { if (isempty($user1['password'])) { $user2['password'] = ''; } if (!isset($user1['admin'])) { $user1['admin'] = 0; } if (!isset($user1['status'])) { $user1['status'] = 0; } return array_merge(array_diff_assoc($user1, $user2), array_diff_assoc($user2, $user1)); }
public function GetRedirectUrl() { $url = parent::GetRedirectUrl(); $url .= "&CID=" . urlencode($this->CID); $url .= "&TPAY=" . urlencode($this->TPAY); if (!isempty($this->TEM)) { $url .= "&TEM=" . urlencode($this->TEM); } if (!isempty($this->TSMS)) { $url .= "&TSMS={$this->TSMS}"; } return $url; }
public function process() { if (isempty($_POST['email'])) { $_SESSION['message'] = lang('login.email.empty'); redirect('login'); } else { if (isempty($_POST['password'])) { $_SESSION['message'] = lang('login.password.empty'); redirect('login'); } else { $this->check_login($_POST['email'], $_POST['password']); } } }
function mysql($action, $args = '') { if ($action == 'dump') { $postfix = 'mysqldump'; $io = '>'; } elseif ($action == 'restore') { $postfix = 'mysql'; $io = '<'; } elseif (isempty($action)) { $cmd = 'mysql connect 192.168.1.16 2>&1'; $op = `{$cmd}`; return $op; } // $cmd = sprintf('%1s -uaxel_1 -pkakadax -h localhost todos_backbone %2s E:/Sites/php/mysql_backup/file.sql 2>&1', $postfix, $io); $cmd = sprintf('%1s -uaxel_1 -pkakadax -h localhost todos_backbone %2s /var/www/vhosts/webpremiere.de/mysql_backup/file.sql 2>&1', $postfix, $io); $op = `{$cmd}`; return $op; }
public static function updateDupeTable($formID, $objectID, $data) { // trans begin $result = mfcs::$engine->openDB->transBegin("objects"); if ($result !== TRUE) { errorHandle::newError(__METHOD__ . "() - unable to start database transactions", errorHandle::DEBUG); return FALSE; } // wipe the old dupe information $sql = sprintf("DELETE FROM `dupeMatching` WHERE `formID`='%s' AND `objectID`='%s'", mfcs::$engine->openDB->escape($formID), mfcs::$engine->openDB->escape($objectID)); $sqlResult = mfcs::$engine->openDB->query($sql); if (!$sqlResult['result']) { mfcs::$engine->openDB->transRollback(); mfcs::$engine->openDB->transEnd(); errorHandle::newError(__METHOD__ . "() - removing from duplicate table: " . $sqlResult['error'], errorHandle::DEBUG); return FALSE; } //insert data foreach ($data as $name => $raw) { if (!isset(mfcs::$engine->cleanPost['MYSQL'][$name]) || isempty(mfcs::$engine->cleanPost['MYSQL'][$name])) { if (!isempty($raw)) { http::setPost($name, $raw); $postSet = TRUE; } else { continue; } } $sql = sprintf("INSERT INTO `dupeMatching` (`formID`,`objectID`,`field`,`value`) VALUES('%s','%s','%s','%s')", mfcs::$engine->openDB->escape($formID), mfcs::$engine->openDB->escape($objectID), mfcs::$engine->openDB->escape($name), mfcs::$engine->cleanPost['MYSQL'][$name]); $sqlResult = mfcs::$engine->openDB->query($sql); if (isset($postSet) && $postSet === TRUE) { http::setPost($name, ""); } if (!$sqlResult['result']) { mfcs::$engine->openDB->transRollback(); mfcs::$engine->openDB->transEnd(); errorHandle::newError(__METHOD__ . "() - : " . $sqlResult['error'], errorHandle::DEBUG); return FALSE; } } // trans commit mfcs::$engine->openDB->transCommit(); mfcs::$engine->openDB->transEnd(); return TRUE; }
public static function showNew() { $reviews = array_key_exists('reviews', $_SESSION) ? $_SESSION['reviews'] : null; $base = array_key_exists('base', $_SESSION) ? $_SESSION['base'] : ""; echo '<h1>Create a new ClassBash review</h1>'; if (is_null($reviews) || isempty($reviews) || is_null($reviews[0])) { $review = null; } else { $review = $reviews[0]; } echo '<h1>ClassBash review form</h1>'; echo '<section>'; if (!is_null($review) && $review->getErrors() > 0) { $errors = $review->getErrors(); foreach ($errors as $key => $value) { echo $value . "<br>"; } } echo '</section><form method="post" action="/' . $base . '/review/new">'; echo 'Reviewer name: <input type="text" name="reviewerName"'; if (!is_null($review)) { echo 'value = "' . $review->getReviewerName() . '"'; } echo 'required> <br>'; echo '<br> Submission Id: <input type="text" name="submissionId"'; if (!is_null($review)) { echo 'value = "' . $review->getSubmissionId() . '"'; } echo 'required> <br>'; echo '<br> Score: <input type="number" name="score"'; if (!is_null($review)) { echo 'value = "' . $review->getScore() . '"'; } echo 'required min="1" max="5"> <br>'; echo '<br> Review:<br>'; echo '<textarea name="review" placeholder="Write your review here" rows="10" cols="80" required>'; if (!is_null($review)) { echo $review->getReview(); } echo '</textarea><br> <br>'; echo '<input type="submit" value="Submit">'; echo '</form></section>'; }
/** * returns the database object for the project ID. If no projectID is provided, * returns an array of all the projects, using getProject method defaults * we need to add caching to this, once caching is moved from EngineCMS to EngineAPI * * @author Michael Bond * @param integer $projectID MySQL ID of the project to get * @return array */ public static function get($projectID = NULL) { if (isnull($projectID)) { return self::getProjects(); } $sql = sprintf("SELECT * FROM `projects` WHERE `ID`='%s'", mfcs::$engine->openDB->escape($projectID)); $sqlResult = mfcs::$engine->openDB->query($sql); if (!$sqlResult['result']) { errorHandle::newError(__METHOD__ . "() - " . $sqlResult['error'], errorHandle::DEBUG); return FALSE; } $project = mysql_fetch_array($sqlResult['result'], MYSQL_ASSOC); if (!isempty($project['forms']) && ($project['forms'] = decodeFields($project['forms'])) === FALSE) { return FALSE; } if (!isempty($project['groupings']) && ($project['groupings'] = decodeFields($project['groupings'])) === FALSE) { return FALSE; } return $project; }
function lang($key) { global $lang; $text = get_item($lang, $key); return !isempty($text) ? $text : $key; }
<tbody> <?php $i = $limitFrom; foreach ($results as $res) { $i++; $db->where('id', $res['user_id']); $user = $db->getOne("users"); ?> <tr> <td><?php echo $i; ?> </td> <td><?php echo isempty($res['action']); ?> </td> <td><?php echo $user['name'] . ' ' . $user['lastname']; ?> </td> <td><?php echo dateTimeUStoEU($res['date_time']); ?> </td> </tr> <?php } echo "<tr>\n\t\t\t\t\t<td colspan='7' style='background-color: #ffffff;'><div style='float:right;'>";
function isNotEmpty($value) { return !isempty($value); }
function add_other_dx($patient_pid, $dos, $encounter_id, $medics, &$errors) { if (!isempty($medics->medical->systems->otherdx)) { $row = fetchProviderInfo($medics); if ($row['id']) { // TBD array error check NEEDED $patient_provider_name = $row['username']; } addForm($encounter_id, "Other DX", sqlInsert("INSERT INTO form_aperio_opd SET " . "date = '{$dos}', " . "pid = '{$patient_pid}', " . "authorized = 1, " . "activity = 1, " . "opd = '" . form2db($medics->medical->systems->otherdx) . "'"), "aperio_opd", $patient_pid, 1, $dos, $patient_provider_name); return "Added OtherDX for Patient ID " . $patient_pid . "."; } }
function verifySiNonce($hash, $action, $userid = false) { global $config; $tickTock = floor(time() / $config->nonce->timelimit); if (!isempty($hash) and ($hash === siNonce($action, $userid) or $hash === siNonce($action, $userid, $tickTock - 1))) { return true; } //else return false; }
$table = $_REQUEST['table']; $type = $_REQUEST['type']; $state = $_REQUEST['state']; $time = $_REQUEST['time']; $g_code = $_REQUEST['g_code']; $other = $_REQUEST['other']; $updated = $_REQUEST['updated']; $location = $_REQUEST['location']; $phone_no = $_REQUEST['num']; if ($table == '0') { $sql = "select login_count from users where phone_no='{$phone_no}'"; $result = mysql_query($sql); while ($row = mysql_fetch_assoc($result)) { $logcount = $row[0]; } if (isempty($logcount)) { $logcount = 0; } $logcount = $logcount + 1; $sql = "insert into ( phone_no, login_count) values ('{$phone_no}', {$logcount} )"; if (!mysql_query($sql)) { // already exist then update; $sql = "update users set login_count = {$logcount} where phone_no = '{$phone_no}'"; if (!mysql_query($sql)) { echo "failed"; exit(0); } } echo "succeed"; exit(0); }
public function GetRedirectUrl() { $url = $this->redirectUrlBase; if (!isempty($this->PT)) { $url .= "?PT={$this->PT}"; $url .= "&MID={$this->MID}"; } else { $url .= "?MID={$this->MID}"; } $url .= "&AMT={$this->AMT}"; $url .= "&CURR={$this->CURR}"; $url .= "&VS={$this->VS}"; $url .= "&RURL={$this->RURL}"; $url .= "&IPC={$this->IPC}"; $url .= "&NAME={$this->NAME}"; $url .= "&SIGN={$this->SIGN}"; if (!isempty($this->CS)) { $url .= "&CS={$this->CS}"; } if (!isempty($this->RSMS)) { $url .= "&RSMS=" . urlencode($this->RSMS); } if (!isempty($this->REM)) { $url .= "&REM=" . urlencode($this->REM); } if (!isempty($this->DESC)) { $url .= "&DESC=" . urlencode($this->DESC); } if (!isempty($this->AREDIR)) { $url .= "&AREDIR={$this->AREDIR}"; } if (!isempty($this->LANG)) { $url .= "&LANG={$this->LANG}"; } return $url; }
public function GetRedirectUrl() { $url = $this->redirectUrlBase; if (!isempty($this->PT)) { $url .= "?PT={$this->PT}"; $url .= "&MID={$this->MID}"; } else { $url .= "?MID={$this->MID}"; } $url .= "&AMT={$this->AMT}"; $url .= "&CURR={$this->CURR}"; $url .= "&VS={$this->VS}"; if (!isempty($this->SS)) { $url .= "&SS={$this->SS}"; } $url .= "&CS={$this->CS}"; $url .= "&RURL=" . urlencode($this->RURL); $url .= "&TIMESTAMP={$this->TIMESTAMP}"; $url .= "&HMAC={$this->HMAC}"; if (!isempty($this->RSMS)) { $url .= "&RSMS=" . urlencode($this->RSMS); } if (!isempty($this->REM)) { $url .= "&REM=" . urlencode($this->REM); } if (!isempty($this->DESC)) { $url .= "&DESC=" . urlencode($this->DESC); } if (!isempty($this->AREDIR)) { $url .= "&AREDIR={$this->AREDIR}"; } if (!isempty($this->LANG)) { $url .= "&LANG={$this->LANT}"; } return $url; }
function validate_pass2($pass) { $msg = "==>Password (confirm)"; if (isHTML($pass, $msg)) { return FALSE; } if (isempty($pass, $msg)) { return FALSE; } if (isRestrictedChars($pass, $msg)) { return FALSE; } if (isNotConfirmed($pass, $_REQUEST["pass1"], $msg)) { return FALSE; } return TRUE; }
echo toScreen($input); } ?> </textarea></td> <td> <input type="submit" value="Convert"> </td> <td> <select name="to"> <?php foreach ($options as $key => $value) { echo "<option value=\"{$key}\""; if ($to == $key) { echo ' selected'; } echo ">{$value}</option>"; } ?> </select> <br /> <textarea><?php if (!isempty($output)) { echo toScreen($output); } ?> </textarea></td> </tr> </table> </form> <?php include ROOT . '/footer.php';
public function GetRedirectUrl() { $url = $this->redirectUrlBase; $url .= "?MID={$this->MID}"; $url .= "&AMT={$this->AMT}"; $url .= "&VS={$this->VS}"; $url .= "&CS={$this->CS}"; $url .= "&RURL=" . urlencode($this->RURL); if (!isempty($this->DESC)) { $url .= "&DESC=" . urlencode($this->DESC); } $url .= "&SIGN={$this->SIGN}"; return $url; }
function sc_bin2dec($str) { $return = ''; $str = stripNonBin($str); $arr = str_split($str, 8); foreach ($arr as $char) { if (strlen($char) != 8) { continue; } $return .= str_pad(base_convert($char, 2, 10), 3, '0', STR_PAD_LEFT) . ' '; } if (!isempty($return)) { return substr($return, 0, -1); } return $return; }
function __fetch_customer_names($customer_ids = NULL) { global $application; if ($customer_ids !== NULL && empty($customer_ids)) { return array(); } else { $name_list = execQuery("SELECT_CUSTOMER_NAMES", array("customer_ids" => $customer_ids)); $full_names = array(); foreach ($name_list as $name) { $full_names[$name['customer_id']] = 'N/A'; if (isset($name['name_ci']) && !isempty(trim($name['name_ci']))) { $full_names[$name['customer_id']] = trim($name['name_ci']); } if (isset($name['name_bi']) && !isempty(trim($name['name_bi']))) { $full_names[$name['customer_id']] = trim($name['name_bi']); } if (isset($name['name_si']) && !isempty(trim($name['name_si']))) { $full_names[$name['customer_id']] = trim($name['name_si']); } } return $full_names; } }
public function GetRedirectUrl() { $url = $this->redirectUrlBase . '?'; $url .= "pu_predcislo={$this->pu_predcislo}"; $url .= "&pu_cislo={$this->pu_cislo}"; $url .= "&pu_kbanky={$this->pu_kbanky}"; $url .= "&suma={$this->suma}"; $url .= "&mena={$this->mena}"; $url .= "&vs={$this->vs}"; $url .= "&ss={$this->ss}"; $url .= "&url=" . urlencode($this->url); $url .= "¶m=" . urlencode($this->param); if (!isempty($this->acc_prefix)) { $url .= "&acc_prefix={$this->acc_prefix}"; } if (!isempty($this->acc_number)) { $url .= "&acc_number={$this->acc_number}"; } if (!isempty($this->mail_notif_att)) { $url .= "&mail_notif_att={$this->mail_notif_att}"; } if (!isempty($this->email_adr)) { $url .= "&email_adr=" . urlencode($this->email_adr); } if (!isempty($this->client_login)) { $url .= "&clien_login={$this->client_login}"; } if (!isempty($this->auth_tool_type)) { $url .= "&auth_tool_type={$this->auth_tool_type}"; } $url .= "&sign1=" . urlencode($this->sign1); return $url; }
private static function validateSubmission($formID, $field, $value = NULL, $objectID) { if ($field['type'] == "fieldset" || $field['disabled'] == "true") { return NULL; } // If the IDNO is managed by the system, skip it: if ($field['type'] == "idno" && $field['managedBy'] != "user") { return NULL; } if (strtolower($field['required']) == "true" && (isnull($value) || !isset($value) || isempty($value))) { errorHandle::newError(__METHOD__ . "() - missing", errorHandle::DEBUG); errorHandle::errorMsg("Missing data for required field '" . $field['label'] . "'."); return FALSE; } // Perform validations here $valid = TRUE; if (!empty($field['format'])) { if (strtolower($field['format']) == 'characters' || strtolower($field['format']) == 'digits') { if (!empty($field['min']) && $field['min'] > strlen($value)) { $valid = FALSE; } if (!empty($field['max']) && $field['max'] < strlen($value)) { $valid = FALSE; } } else { if (strtolower($field['format']) == 'words') { if (!empty($field['min']) && $field['min'] > str_word_count($value)) { $valid = FALSE; } if (!empty($field['max']) && $field['max'] < str_word_count($value)) { $valid = FALSE; } } } } // Skip if it's already invalid if ($valid === TRUE) { // No validation to test if (isempty($field['validation']) || $field['validation'] == "none") { $valid = TRUE; } else { if (!str2bool($field['required']) && is_empty($value)) { $valid = TRUE; } else { $valid = FALSE; if (validate::isValidMethod($field['validation']) === TRUE) { if ($field['validation'] == "regexp") { $valid = validate::$field['validation']($field['validationRegex'], $value); } else { $valid = validate::$field['validation']($value); } } } } } if ($valid === FALSE) { errorHandle::newError(__METHOD__ . "() - data", errorHandle::DEBUG); errorHandle::errorMsg("Invalid data provided in field '" . $field['label'] . "'."); return FALSE; } // Duplicate Checking (Form) if (strtolower($field['duplicates']) == "true") { if (self::isDupe($formID, $field['name'], $value, $objectID)) { errorHandle::newError(__METHOD__ . "() - Dupe -- " . $field['name'], errorHandle::DEBUG); errorHandle::errorMsg("Duplicate data (in form) provided in field '" . $field['label'] . "'."); return FALSE; } } if (!is_empty(mfcs::$engine->errorStack)) { return FALSE; } else { return TRUE; } }