本文整理汇总了PHP中validateDate函数的典型用法代码示例。如果您正苦于以下问题:PHP validateDate函数的具体用法?PHP validateDate怎么用?PHP validateDate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了validateDate函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: handleEditPage
function handleEditPage()
{
include_once 'login.php';
include_once 'showEventFunction.php';
$backURL = "<br/><a href = \"index.php\">Back to Home</a>";
// client side validation, if error, disable submit
// if form is set and not empty, continue
$showError = true;
$errOutput = isFormFilled($showError);
if ($errOutput) {
$output = "<h1>Error</h1>";
return $output . $errOutput . $backURL;
}
$event = array();
$errMsg = array();
// prevent sql injection & data sanitize
foreach ($_POST as $field => $value) {
$event[$field] = sanitizeData($value);
}
include_once 'database_conn.php';
$columnLengthSql = "\n\t\tSELECT COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH\n\t\tFROM INFORMATION_SCHEMA.COLUMNS\n\t\tWHERE TABLE_NAME = 'te_events'\n\t\tAND (column_name = 'eventTitle'\n\t\tOR column_name = 'eventDescription')";
//, DATA_TYPE
$COLUMN_LENGTH = getColumnLength($conn, $columnLengthSql);
// check data type and length validation
$isError = false;
$errMsg[] = validateStringLength($event['title'], $COLUMN_LENGTH['eventTitle']);
//title
$errMsg[] = validateStringLength($event['desc'], $COLUMN_LENGTH['eventDescription']);
//desc
$errMsg[] = validateDate($event['startTime']);
//startTime
$errMsg[] = validateDate($event['endTime']);
//endTime
$errMsg[] = validateDecimal($event['price']);
//price
for ($i = 0; $i < count($errMsg); $i++) {
if (!($errMsg[$i] === true)) {
$pageHeader = "Error";
$output = "<h1>{$pageHeader}</h1>";
$output . "{$errMsg[$i]}";
$isError = true;
}
}
//if contain error, halt continue executing the code
if ($isError) {
return $output . $backURL;
}
// prepare sql statement
$sql = "UPDATE te_events SET \n\t\teventTitle=?, eventDescription=?, \n\t\tvenueID=?, catID=?, eventStartDate=?, \n\t\teventEndDate=?, eventPrice=? WHERE eventID=?;";
$stmt = mysqli_prepare($conn, $sql);
mysqli_stmt_bind_param($stmt, "ssssssss", $event['title'], $event['desc'], $event['venue'], $event['category'], $event['startTime'], $event['endTime'], $event['price'], $event['e_id']);
// execute update statement
mysqli_stmt_execute($stmt);
// check is it sucess update
if (mysqli_stmt_affected_rows($stmt)) {
$output = "<h1>{$event['title']} was successfully updated.</h1>";
return $output . $backURL;
} else {
$output = "<h1>Nothing update for {$event['title']}</h1>";
return $output . $backURL;
}
echo "<br/>";
return;
}
开发者ID:lowjiayou,项目名称:YearTwoWebOne,代码行数:64,代码来源:handleEditPage.php
示例2: validateForm
function validateForm(&$errors)
{
global $firstname, $surname, $birthdate;
## firstname ##
if (!validateRequired($firstname)) {
$errors['firstname'][] = 'First name is required.';
} else {
if (!validateLength($firstname, 2)) {
$errors['firstname'][] = 'Minimum length is 2.';
}
}
## surname ##
if (!validateRequired($surname)) {
$errors['surname'][] = 'Surname is required.';
} else {
if (!validateLength($surname, 2)) {
$errors['surname'][] = 'Minimum length is 2.';
}
}
## date ##
if (!validateRequired($birthdate)) {
$errors['birthdate'][] = 'Date of Birth is required.';
} else {
if (!validateDate($birthdate)) {
$errors['birthdate'][] = 'Wrong date.';
}
}
## return ##
return empty($errors) ? true : false;
}
开发者ID:Khdoop,项目名称:Lecture20_Homework_PHPWEB,代码行数:30,代码来源:index.php
示例3: validateData
function validateData()
{
$required = $_GET["required"];
$type = $_GET["type"];
$value = $_GET["value"];
validateRequired($required, $value, $type);
switch ($type) {
case 'number':
validateNumber($value);
break;
case 'alphanum':
validateAlphanum($value);
break;
case 'alpha':
validateAlpha($value);
break;
case 'date':
validateDate($value);
break;
case 'email':
validateEmail($value);
break;
case 'url':
validateUrl($value);
case 'all':
validateAll($value);
break;
}
}
开发者ID:16cameronk,项目名称:Anniversary,代码行数:29,代码来源:validate.php
示例4: setDatabase
function setDatabase()
{
if (isset($_POST['submit'])) {
if (isset($_POST['inputNaam']) && isset($_POST['inputBeschrijving']) && isset($_POST['inputDatum']) && isset($_POST['inputPrioriteit']) && isset($_POST['inputTijd'])) {
// CONNECT TO DATABASE
try {
require 'app/config/db_connect.php';
// FILE OM MET DATABASE TE CONNECTEN
// ZET DE INPUT IN DE VARIABELEN
if (validateDate($_POST['inputDatum'], 'Y-m-d')) {
if (preg_match("/(2[0-4]|[01][1-9]|10):([0-5][0-9])/", $_POST['inputTijd'])) {
$naam = $_POST['inputNaam'];
$beschrijving = $_POST['inputBeschrijving'];
$datum = $_POST['inputDatum'];
$tijd = $_POST['inputTijd'];
$prioriteit = $_POST['inputPrioriteit'];
// ZET DE INGEVOERDE INFORMATIE IN DE DATABASE
$insert = 'INSERT INTO content (naam, beschrijving, datum, tijd, prioriteit, email) VALUES("' . $naam . '", "' . $beschrijving . '", "' . $datum . '","' . $tijd . '", "' . $prioriteit . '" , "' . $_SESSION['email'] . '")';
$conn->exec($insert);
} else {
echo 'de tijd is niet correct ingevuld';
}
} else {
echo 'de datum is niet correct inguvuld';
}
// CHECK OF DE DATA IN DE DATABASE IS GEZET
} catch (PDOException $e) {
echo $insert . "<br>" . $e->getMessage();
}
$conn = null;
} else {
echo 'Je hebt niet al de velden ingevuld';
}
}
}
开发者ID:jacob2299,项目名称:To-doList,代码行数:35,代码来源:functions_set_todolist.php
示例5: mysql_date_format
function mysql_date_format($date, $time = false)
{
if (empty($date) || !validateDate($date, 'm-d-Y')) {
return '';
}
if ($time) {
return date('Y-m-d H:i:s', strtotime(str_replace('-', '/', $date)));
} else {
return date('Y-m-d', strtotime(str_replace('-', '/', $date)));
}
}
开发者ID:sooraj-rc,项目名称:copierchoice,代码行数:11,代码来源:common_helper.php
示例6: postHydrate
public function postHydrate($post_params, $customMap = false)
{
$reflect = new \ReflectionObject($this);
foreach ($post_params as $key => $value) {
if (property_exists($this, $key)) {
$prop = $reflect->getProperty($key);
if (!$prop->isPrivate()) {
if (validateDate($value, 'd-m-Y') || validateDate($value, 'd-m-Y H:i:s') || validateDate($value, 'Y-m-d H:i:s') || validateDate($value, 'd-m-Y H:i') || validateDate($value, 'd.m.Y H:i')) {
$value = new \DateTime($value);
}
$this->{$key} = $value;
}
}
if ($customMap) {
foreach ($customMap as $key => $prop) {
$this->{$prop} = $post_params[$key];
}
}
}
}
开发者ID:bardascat,项目名称:blogify,代码行数:20,代码来源:AbstractEntity.php
示例7: validateTourdates
function validateTourdates($form)
{
global $db;
if (checkEmpty($form['venue_name'])) {
$msg = str_replace('field', _VENUE, _ALRT_REQUIRED_FIELD);
$show_tab_type = 'TOURDATES_INFO';
return $msg;
}
if (checkEmpty($form['tour_city'])) {
$msg = str_replace('field', _CITY, _ALRT_REQUIRED_FIELD);
$show_tab_type = 'TOURDATES_INFO';
return $msg;
}
if (checkEmpty($form['tour_state'])) {
$msg = str_replace('field', _LBL_STATE, _ALRT_REQUIRED_FIELD);
$show_tab_type = 'TOURDATES_INFO';
return $msg;
}
if (checkEmpty($form['tour_country'])) {
$msg = str_replace('field', _LBL_COUNTRY, _ALRT_REQUIRED_FIELD);
$show_tab_type = 'TOURDATES_INFO';
return $msg;
}
if (checkEmpty($form['tourdate'])) {
$msg = str_replace('field', _LBL_START_DATE, _ALRT_REQUIRED_FIELD);
$show_tab_type = 'TOURDATES_INFO';
return $msg;
}
if (checkEmpty($form['tourdate'])) {
$msg = _ALRT_SEL_STARTDATE;
$show_tab_type = 'TOURDATES_INFO';
return $msg;
} else {
$showdate = validateDate($form['tourdate']);
if ($showdate !== true) {
$msg = $showdate . ' ' . _LBL_FOR . ' ' . _LBL_START_DATE;
$show_tab_type = 'TOURDATES_INFO';
return $msg;
}
if (compareDate($form['tourdate'], date('m/d/Y'), 1)) {
$msg = _ALRT_VALID_TOURDATE;
$show_tab_type = 'TOURDATES_INFO';
return $msg;
}
}
$date = getYearMonthDateSearch($form['tourdate'], "/", "-");
if (isset($form['tourdate_id'])) {
$sql = 'SELECT AF_TOURDATE_ID FROM xebura_TOURDATE
WHERE AF_TOURDATE_ARTIST_ID = \'' . $_SESSION['User_Account_Id'] . '\'
AND (AF_TOURDATE_VENUE_ID = \'' . $form['venue'] . '\'
OR (AF_TOURDATE_VENUE_NAME = \'' . $form['venue_name'] . '\'
AND AF_TOURDATE_VENUE_CITY = \'' . $form['tour_city'] . '\'
AND AF_TOURDATE_VENUE_STATE = \'' . $form['tour_state'] . '\'
AND AF_TOURDATE_VENUE_COUNTRY = \'' . $form['tour_country'] . '\'))
AND AF_TOURDATE_STARTDATE = \'' . $date . '\'
AND AF_ARTIST_DISCOG_ID != \'' . $form['tourdate_id'] . '\'';
} else {
$sql = 'SELECT AF_TOURDATE_ID FROM xebura_TOURDATE
WHERE AF_TOURDATE_ARTIST_ID = \'' . $_SESSION['User_Account_Id'] . '\'
AND (AF_TOURDATE_VENUE_ID = \'' . $form['venue'] . '\'
OR (AF_TOURDATE_VENUE_NAME = \'' . $form['venue_name'] . '\'
AND AF_TOURDATE_VENUE_CITY = \'' . $form['tour_city'] . '\'
AND AF_TOURDATE_VENUE_STATE = \'' . $form['tour_state'] . '\'
AND AF_TOURDATE_VENUE_COUNTRY = \'' . $form['tour_country'] . '\'))
AND AF_TOURDATE_STARTDATE = \'' . $date . '\'';
}
if ($db->query_affected_rows($sql) > 0) {
$msg = _CHECK_DUPLICATE_TOURDATE;
$show_tab_type = 'TOURDATES_INFO';
return $msg;
}
return true;
}
开发者ID:romley,项目名称:xebura,代码行数:73,代码来源:validation.php
示例8: setAnswerDate
/**
* Mutator method for $answerDate
*
* @param mixed $newAnswerDate
* @throws InvalidArgumentException if $newAnswerDate is not a valid object or string
* @throws RangeException if $newAnswerDate is a date that does not exist
* @throws Exception for any other exception
*/
public function setAnswerDate($newAnswerDate)
{
//base case: if the date is null, use the current date and time
if ($newAnswerDate === null) {
$this->answerDate = new DateTime();
return;
}
//store the answer date
try {
$newAnswerDate = validateDate($newAnswerDate);
} catch (InvalidArgumentException $invalidArgument) {
throw new InvalidArgumentException($invalidArgument->getMessage(), 0, $invalidArgument);
} catch (RangeException $range) {
throw new RangeException($range->getMessage(), 0, $range);
} catch (Exception $exception) {
throw new Exception($exception->getMessage(), 0, $exception);
}
$this->answerDate = $newAnswerDate;
}
开发者ID:jfindley2,项目名称:amazon-product,代码行数:27,代码来源:answer.php
示例9: candie_promotion
function candie_promotion($promotion_id = NULL)
{
if (!check_correct_login_type($this->main_group_id) && !check_correct_login_type($this->group_id_supervisor)) {
redirect('/', 'refresh');
}
$message_info = '';
$merchant_id = $this->ion_auth->user()->row()->id;
$is_supervisor = 0;
//if is login by supervisor then need change some setting
if (check_correct_login_type($this->group_id_supervisor)) {
$merchant_id = $this->ion_auth->user()->row()->su_merchant_id;
$is_supervisor = 1;
$supervisor = $this->ion_auth->user()->row();
}
$search_month = NULL;
$search_year = NULL;
$is_history = 0;
if ($promotion_id != NULL) {
$allowed_list = $this->m_custom->get_list_of_allow_id('advertise', 'merchant_id', $merchant_id, 'advertise_id', 'advertise_type', 'pro');
if (!check_allowed_list($allowed_list, $promotion_id)) {
redirect('/', 'refresh');
}
//To check if it is history promotion, then disable the Save Button
$promotionAdvertise = $this->m_custom->getOneAdvertise($promotion_id);
if (!$promotionAdvertise) {
$is_history = 1;
} else {
if ($promotionAdvertise['year'] < get_part_of_date('year') || $promotionAdvertise['year'] == get_part_of_date('year') && $promotionAdvertise['month_id'] < get_part_of_date('month')) {
$is_history = 1;
$search_month = $promotionAdvertise['month_id'];
$search_year = $promotionAdvertise['year'];
}
}
}
$do_by_type = $this->main_group_id;
$do_by_id = $merchant_id;
$merchant_data = $this->m_custom->get_one_table_record('users', 'id', $merchant_id);
$candie_branch = $this->m_custom->get_keyarray_list('merchant_branch', 'merchant_id', $merchant_id, 'branch_id', 'name');
$candie_term = $this->m_custom->get_dynamic_option_array('candie_term', NULL, NULL, $merchant_data->company, NULL, 0, 3);
$month_list = $this->ion_auth->get_static_option_list('month');
$year_list = generate_number_option(get_part_of_date('year', $merchant_data->created_on, 1), get_part_of_date('year'));
if (isset($_POST) && !empty($_POST)) {
if ($this->input->post('button_action') == "submit") {
$upload_rule = array('upload_path' => $this->album_merchant, 'allowed_types' => $this->config->item('allowed_types_image'), 'max_size' => $this->config->item('max_size'), 'max_width' => $this->config->item('max_width'), 'max_height' => $this->config->item('max_height'));
$this->load->library('upload', $upload_rule);
$candie_id = $this->input->post('candie_id');
//$sub_category_id = $this->input->post('candie_category');
$sub_category_id = $merchant_data->me_sub_category_id;
//merchant cannot change sub category anymore
$title = $this->input->post('candie_title');
$description = $this->input->post('candie_desc');
$upload_file = "candie-file";
$start_date = validateDate($this->input->post('start_date'));
$end_date = validateDate($this->input->post('end_date'));
$search_month = $this->input->post('candie_month');
$search_year = $this->input->post('candie_year');
$candie_point = check_is_positive_numeric($this->input->post('candie_point'));
if ($candie_point < 30) {
$candie_point = 30;
}
$expire_date = validateDate($this->input->post('expire_date'));
$original_price = check_is_positive_decimal($this->input->post('original_price'));
$show_extra_info = $this->input->post('show_extra_info');
$price_before = check_is_positive_decimal($this->input->post('price_before'));
$price_after = check_is_positive_decimal($this->input->post('price_after'));
//$price_before_show = $this->input->post('price_before_show');
//$price_after_show = $this->input->post('price_after_show');
if ($show_extra_info == 121) {
$price_before_show = 1;
$price_after_show = 1;
} else {
$price_before_show = 0;
$price_after_show = 0;
}
$get_off_percent = check_is_positive_decimal($this->input->post('get_off_percent'));
$how_many_buy = check_is_positive_numeric($this->input->post('how_many_buy'));
$how_many_get = check_is_positive_numeric($this->input->post('how_many_get'));
$adv_worth = check_is_positive_decimal($this->input->post('adv_worth'));
$candie_extra_term = $this->input->post('candie_extra_term');
$image_data = NULL;
$candie_term_selected = array();
$post_candie_term = $this->input->post('candie_term');
if (!empty($post_candie_term)) {
foreach ($post_candie_term as $key => $value) {
$candie_term_selected[] = $value;
}
}
$candie_branch_selected = array();
$post_candie_branch = $this->input->post('candie_branch');
if (!empty($post_candie_branch)) {
foreach ($post_candie_branch as $key => $value) {
$candie_branch_selected[] = $value;
}
}
if ($candie_id == 0) {
if (!empty($_FILES[$upload_file]['name'])) {
if (!$this->upload->do_upload($upload_file)) {
$message_info = add_message_info($message_info, $this->upload->display_errors(), $title);
} else {
$image_data = array('upload_data' => $this->upload->data());
//.........这里部分代码省略.........
开发者ID:ailuropodagit,项目名称:tttkkk,代码行数:101,代码来源:Merchant.php
示例10: date_default_timezone_set
<?php
date_default_timezone_set('Europe/Sofia');
$text = $_GET['text'];
$rows = preg_split("/\n/", $text, -1, PREG_SPLIT_NO_EMPTY);
for ($row = 0; $row < count($rows); $row++) {
if (trim($rows[$row]) !== '') {
$pattern = "/(.*?);\\s*(\\d{1,2}-\\d{1,2}-\\d{4})\\s*;(.*?);\\s*(\\d+)\\s*;(.*)?/";
preg_match($pattern, trim($rows[$row]), $posts);
$date = $posts[2];
if (validateDate($date)) {
$date = new DateTime($date);
$comments = preg_split('/\\//', trim($posts[5]), -1, PREG_SPLIT_NO_EMPTY);
$facebook[] = ['name' => trim($posts[1]), 'date' => $date, 'text' => trim($posts[3]), 'likes' => $posts[4], 'comments' => $comments];
}
}
}
usort($facebook, function ($a, $b) {
return $b['date'] > $a['date'];
});
for ($i = 0; $i < count($facebook); $i++) {
$name = htmlspecialchars($facebook[$i]['name']);
$date = $facebook[$i]['date'];
$postText = htmlspecialchars($facebook[$i]['text']);
$likes = $facebook[$i]['likes'];
echo "<article><header><span>{$name}</span><time>{$date->format('j F Y')}</time></header><main><p>{$postText}</p></main><footer><div class=\"likes\">{$likes} people like this</div>";
if (!empty($facebook[$i]['comments'])) {
echo "<div class=\"comments\">";
for ($j = 0; $j < count($facebook[$i]['comments']); $j++) {
echo "<p>" . htmlspecialchars(trim($facebook[$i]['comments'][$j])) . "</p>";
}
开发者ID:nok32,项目名称:SoftUni,代码行数:31,代码来源:03.+FacebookPosts.php
示例11: setTime
/**
* mutator method for the comment time
*
* @param mixed $newTime new value of time as either string, DateTime object, or null for the current time
* @throws InvalidArgumentException if $newTime is not a valid object or string
* @throws RangeException if $newTime is a time and date that does not exist
* @throws Exception if some other exception is thrown
**/
public function setTime($newTime)
{
//base case: if the time is null, assign to the current time
if ($newTime === null) {
$this->time = new DateTime();
return;
}
//validate using the function defined in validate-date.php, and store if it works
try {
$newTime = validateDate($newTime);
} catch (InvalidArgumentException $invalidArgument) {
throw new InvalidArgumentException($invalidArgument->getMessage(), 0, $invalidArgument);
} catch (RangeException $range) {
throw new RangeException($range->getMessage(), 0, $range);
} catch (Exception $exception) {
throw new Exception($exception->getMessage(), 0, $exception);
}
$this->time = $newTime;
}
开发者ID:brbrown59,项目名称:mlssoccer-comments,代码行数:27,代码来源:comment.php
示例12: validateDate
<?php
require "../config.php";
function validateDate($date)
{
$d = DateTime::createFromFormat('d.m.Y', $date);
return $d && $d->format('d.m.Y') == $date;
}
if (!isset($_POST['name']) || strlen($_POST['name']) < 1) {
die("Bitte geben Sie einen gültigen Namen ein.");
}
if (!isset($_POST['public']) || !validateDate($_POST['public']) || !isset($_POST['editable']) || !validateDate($_POST['editable'])) {
die("Bitte geben Sie ein gültiges Datum ein.");
}
dbConn::execute("UPDATE :prefix:plan SET name = :0, public = :1, editable = :2 WHERE name = :3", htmlspecialchars($_POST['name']), DateTime::createFromFormat("d.m.Y", $_POST['public'])->format("Y-m-d H:i:s"), DateTime::createFromFormat("d.m.Y", $_POST['editable'])->format("Y-m-d H:i:s"), htmlspecialchars($_POST['originalName']));
dbConn::execute("DELETE FROM :prefix:email_subscriber WHERE plan = :0", htmlspecialchars($_POST['originalName']));
foreach ($_POST['subscribers'] as $r) {
dbConn::execute("INSERT INTO :prefix:email_subscriber (email, plan) VALUES (:0, :1);", $r, htmlspecialchars($_POST['name']));
}
echo "SUCCESS";
开发者ID:fhoner,项目名称:Schichtplaner,代码行数:20,代码来源:ajax.updatePlan.php
示例13: getDBEntryCount
$entries = getDBEntryCount($statement);
$statement .= setLimit($startAt, $rowsPerPage);
echo "Zielland: " . $input1;
} else {
if ($_POST["filter"] == "filterDate") {
if (isset($_GET["in1"])) {
$input1 = $_GET["in1"];
} else {
$input1 = filterfunktion($_POST["filterStartDate"]);
}
if (isset($_GET["in2"])) {
$input2 = $_GET["in2"];
} else {
$input2 = filterfunktion($_POST["filterEndDate"]);
}
if (validateDate($input1) || validateDate($input2)) {
$statement = filterDatespan(reformDatetoDB($input1), reformDatetoDB($input2));
$statement .= " GROUP BY id ";
$entries = getDBEntryCount($statement);
$statement .= setLimit($startAt, $rowsPerPage);
echo "Angebot gültig zwischen " . $input1 . " und " . $input2;
} else {
$statement = filterNone();
$statement .= " GROUP BY id ";
$entries = getDBEntryCount($statement);
$statement .= setLimit($startAt, $rowsPerPage);
echo "Kein Filter gesetzt";
}
} else {
if ($_POST["filter"] == "filterName") {
if (isset($_GET["in1"])) {
开发者ID:HetzelFl,项目名称:helping_supplies,代码行数:31,代码来源:filterPreparation.php
示例14: mysql_real_escape_string
}
//Build Query from input
$table = $_GET["table"];
$maxbid = $_GET["maxbid"];
$minbid = $_GET["minbid"];
$saletype = $_GET["saletype"];
$salevalidity = $_GET["salevalidity"];
$startdate = $_GET["startdate"];
$enddate = $_GET["enddate"];
//escape user input to help prevent injection attacks
$maxbid = mysql_real_escape_string($maxbid);
$minbid = mysql_real_escape_string($minbid);
$minbid = parseCurrency($minbid);
$maxbid = parseCurrency($maxbid);
$startdate = validateDate($startdate);
$enddate = validateDate($enddate);
//check that minbid/maxbid are in low->high order and not vice versa
if ($minbid > $maxbid) {
$temp = $maxbid;
$maxbid = $minbid;
$minbid = $temp;
}
$salestatus = mysql_real_escape_string($salestatus);
$saledate = mysql_real_escape_string($saledate);
// quote only values, not column name
$query = "SELECT * FROM {$table} WHERE PRICE < ";
if (is_numeric($maxbid)) {
$query .= "'{$maxbid}' and PRICE >= ";
}
//>= to capture values that are 0.
if (is_numeric($minbid)) {
开发者ID:nickklosterman,项目名称:PythonSheriffSales,代码行数:31,代码来源:phpRealEstateSalesDynamic.php
示例15: intval
$month -= 20;
} else {
if ($month >= 41 && $month <= 52) {
$year .= "20" . $data['year'];
$month -= 40;
} else {
$validPIN = false;
}
}
}
/*----- CHECK VALID DATE ------*/
if ($month < 10) {
$month = "0" . intval($month);
}
$date = $year . $month . $data['day'];
$validPIN = $validPIN && validateDate($date);
function validateDate($date, $format = 'Ymd')
{
$d = DateTime::createFromFormat($format, $date);
if ($d === false) {
return false;
}
return strcmp($d->format($format), $date) == 0;
}
/*------ CHECK VALID GENDER -----*/
$validPIN = $validPIN && strcmp($gender, "male") == 0 ^ $data['gender'] % 2 != 0;
/*------ CHECK VALID CHECKSUM ------*/
$checkSumArr = [2, 4, 8, 5, 10, 9, 7, 3, 6];
$sum = 0;
for ($i = 0; $i < strlen($pin) - 1; $i++) {
$sum += intval($pin[$i]) * $checkSumArr[$i];
开发者ID:AmaranthInHell,项目名称:SoftUni-1,代码行数:31,代码来源:03.PINValidation.php
示例16: is_array
if (!empty($q)) {
$url .= "?" . $q;
}
}
return $url;
}
}
$params = is_array($modx->event->params) ? $modx->event->params : array();
$out = $beforePage = $afterPage = '';
$display = (int) APIHelpers::getkey($params, 'display', '10');
$dateSource = APIHelpers::getkey($params, 'dateSource', 'content');
$dateField = APIHelpers::getkey($params, 'dateField', 'if(pub_date=0,createdon,pub_date)');
$tmp = date("Y-m-d H:i:s");
$currentDay = APIHelpers::getkey($params, 'currentDay', $tmp);
// Текущий день
if (!validateDate($currentDay)) {
$currentDay = $tmp;
}
$start = (int) APIHelpers::getkey($_GET, 'start', '0');
$elements = array('offset' => $start);
//Если положительное значение, то нужы события предстоящие. Если отрицательное - прошедшее
$rule = $start >= 0 ? 'after' : 'before';
$noRule = $start >= 0 ? 'before' : 'after';
if ($start < 0) {
$start = abs($start) > $display ? $start + $display : 0;
}
$d = $modx->db->escape($currentDay);
if ($dateSource == 'tv') {
$params['tvSortType'] = 'TVDATETIME';
$query = array('after' => "STR_TO_DATE(`dltv_" . $dateField . "_1`.`value`,'%d-%m-%Y %H:%i:%s') >= '" . $d . "'", 'before' => "STR_TO_DATE(`dltv_" . $dateField . "_1`.`value`,'%d-%m-%Y %H:%i:%s') < '" . $d . "'");
} else {
开发者ID:bagi091,项目名称:DocLister,代码行数:31,代码来源:snippet.DLBeforeAfter.php
示例17: formular_velkoobchod_validate
function formular_velkoobchod_validate($form_data)
{
$fieldsets_c = count($form_data[material_all]);
if (!empty($form_data)) {
foreach ($form_data as $key => $value) {
${$key} = $value;
}
}
//var_dump($datum);
if (empty($datum) or !validateDate($datum)) {
$error_msg[] = "Zle zadaný dátum";
$error_data[material] = $material;
}
//if(!is_numeric($vyrobca) OR $vyrobca<0 OR $vyrobca>1000) $error_msg[] = "Zle zadaný údaj Výrobcu";
for ($i = 0; $i < $fieldsets_c; $i++) {
$error_line = 0;
$error_line = $i + 1;
if (empty($material_all[$i]) or !is_numeric($material_all[$i])) {
$error_msg[] = "Materiál je povinný údaj - riadok {$error_line}";
$error_data[material_all] = $material_all[$i] . " na riadku: " . $error_line;
}
if (empty($vyrobca_all[$i]) or !is_numeric($vyrobca_all[$i])) {
$error_msg[] = "Výrobca je povinný údaj - riadok {$error_line}";
$error_data[vyrobca_all] = $vyrobca_all[$i] . " na riadku: " . $error_line;
}
if (empty($dekor_all[$i]) or !is_numeric($dekor_all[$i])) {
$error_msg[] = "Dekor je povinný údaj - riadok {$error_line}";
$error_data[dekor_all] = $dekor_all[$i] . " na riadku: " . $error_line;
}
if (empty($m2_all[$i]) and empty($m3_all[$i])) {
$error_msg[] = "Aspoň jeden údaj ks / m3 musí byť vyplnený - riadok {$error_line}";
}
if (!empty($m2_all[$i]) and !is_numeric($m2_all[$i])) {
$error_msg[] = "ks nie je číselný údaj - riadok {$error_line}";
}
if (!empty($m3_all[$i]) and !is_numeric($m3_all[$i])) {
$error_msg[] = "m3 nie je číselný údaj - riadok {$error_line}";
}
}
return $error_msg;
}
开发者ID:jozefvasko,项目名称:benap-app,代码行数:41,代码来源:fnc_velkoobchod.php
示例18: DateTime
$postOK = false;
} else {
if (validateDate($_POST["startDate"])) {
$startDate = (new DateTime($_POST["startDate"]))->format('d.m.Y');
} else {
$startDateErr = "Bitte gültiges Datum eingeben (tt.mm.yyyy)";
$postOK = false;
$startDate = filterfunktion($_POST["startDate"]);
}
}
//ENDDATE---------------------------------
if (empty($_POST["endDate"])) {
$endDateErr = "Bitte Datum eingeben";
$postOK = false;
} else {
if (validateDate($_POST["endDate"])) {
$endDate = (new DateTime($_POST["endDate"]))->format('d.m.Y');
} else {
$endDateErr = "Bitte gültiges Datum eingeben (tt.mm.yyyy)";
$postOK = false;
$endDate = filterfunktion($_POST["endDate"]);
}
}
//DATECHECK--------------------------------
/*if(strtotime(date('d.m.Y')) > strtotime(date($startDate))){
$startDateErr = "Datum muss heute oder in der Zukunft sein.";
$postOK = false;
}
else */
if (strtotime(date($endDate)) < strtotime(date($startDate))) {
$endDateErr = "Datum muss Startdatum oder danach sein";
开发者ID:HetzelFl,项目名称:helping_supplies,代码行数:31,代码来源:eingabeCheck.php
示例19: editar_usuario
public function editar_usuario()
{
//carregar Model
$this->load->model('Usuarios_model', 'usuarios');
$check = array('nome' => TRUE, 'email' => TRUE, 'data' => TRUE);
$data = array();
$user = $_POST;
/*******************VALIDAÇOES DOS CAMPOS DO FORMULARIO*****************/
//Validar Campo Nome
if ($user['nome'] == '') {
$check['nome'] = FALSE;
$data['msg'][1] = "O campo nome precisa ser preenchido.";
}
//Validar Campo email
$this->load->helper('quick');
$check['email'] = isMail($user['email']);
if ($check['email'] == FALSE || $_POST['email'] == '') {
$check['email'] = FALSE;
$data['msg'][2] = "Email Inválido. Digite um email válido.";
}
//Validar o campo data
if ($user['data_de_nascimento'] == '') {
$check['data'] = FALSE;
$data['msg'][3] = "A data precisa ser preenchida.";
} elseif (!validateDate($user['data_de_nascimento'])) {
$check['data'] = FALSE;
$data['msg'][3] = "A data está no formato incorreto.";
}
//Se tudo deu certo na validação encaminha para o banco
if ($check['nome'] && $check['email'] && $check['data']) {
//Formate a data para armazenar no banco
$user['data_de_nascimento'] = to_mysql_data($user['data_de_nascimento']);
//Resgata id e prepara vetor para editar no banco
$id = $user['idd'];
unset($user['idd']);
$this->usuarios->editar_usuario($user, $id);
$data['mensagem'] = "Edição realizada!";
$data['usuario'] = $this->usuarios->info_do_usuario_pelo_id($id);
$this->template->load('template_view', 'usuario/editar_usuario', $data);
} else {
$data['mensagem'] = "Editar.";
$data['usuario'] = $this->usuarios->info_do_usuario_pelo_id($user['idd']);
$this->template->load('template_view', 'usuario/editar_usuario', $data);
}
}
开发者ID:robstermarinho,项目名称:bleez_app,代码行数:45,代码来源:usuario.php
示例20: array
$publish_status = 'publish';
$publish_type = 'fee';
$msg = '';
if (trim($_POST['fee_name']) === '') {
$hasError = true;
$msg .= '<p>Falta el nombre de la cuota!</p>';
}
if (!is_numeric($_POST['fee_quantity'])) {
$hasError = true;
$msg .= '<p>Falta la cantidad de la cuota!</p>';
}
if (!validateDate($_POST['fee_date_start'])) {
$hasError = true;
$msg .= '<p>Fecha de inicio incorrecta!</p>';
}
if (!validateDate($_POST['fee_date_end'])) {
$hasError = true;
$msg .= '<p>Fecha de finalización incorrecta!</p>';
}
if (!$hasError) {
$post_information = array('post_title' => wp_strip_all_tags($_POST['fee_name']), 'post_content' => 'Ey', 'post_type' => $publish_type, 'post_status' => $publish_status);
$post_id = wp_insert_post($post_information);
update_post_meta($post_id, 'fee_date_start', esc_attr($_POST['fee_date_start']));
update_post_meta($post_id, 'fee_date_end', esc_attr($_POST['fee_date_end']));
update_post_meta($post_id, 'fee_quantity', esc_attr($_POST['fee_quantity']));
$alerts_success .= '<p>Cuota ' . $_POST['fee_name'] . ' creada</p>';
} else {
$alerts_error .= $msg;
}
}
if (esc_attr($_POST['updatesection']) == 'updatefee') {
开发者ID:Saigesp,项目名称:wp-design-community,代码行数:31,代码来源:functions-validation.php
注:本文中的validateDate函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论