本文整理汇总了PHP中validation::add_fields方法的典型用法代码示例。如果您正苦于以下问题:PHP validation::add_fields方法的具体用法?PHP validation::add_fields怎么用?PHP validation::add_fields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类validation
的用法示例。
在下文中一共展示了validation::add_fields方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: common
<?php
/*************************************************************************************************************
#Coder : Kapil Verma
#Description : This Code is used to Manage Pages
*************************************************************************************************************/
extract($_GET);
extract($_POST);
$obj_setting = new common();
$obj = new validation();
/* Get Current Date Time Stamp */
$currentTimestamp = getCurrentTimestamp();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$error = '';
$obj->add_fields($name, 'req', 'Please Enter Page Title');
$obj->add_fields($desc, 'req', 'Please Enter Description');
$error = $obj->validate();
if ($error) {
$errorMsg = "<font color='#FF0000' family='verdana' size=2>Please fill all required fields.</font>";
} else {
if (trim($slug)) {
$slug = makeAlias($slug);
} else {
$slug = makeAlias($name);
}
if (trim($metatitle)) {
$metatitle = $metatitle;
} else {
$metatitle = $name;
}
$_SESSION['success_msg'] = 'New page has been saved successfully.';
示例2: redirect
{
$page=1;
}
else
{
$page = $_GET['page'];
}*/
$perpage = 10;
require_once "pagination.php";
if ($_SESSION["admin_user"] == "" || $_SESSION["admin_role"] == 1) {
redirect(SITE_ADM . "login.php");
}
if (isset($_POST['action'])) {
extract($_POST);
$obj = new validation();
$obj->add_fields($project_title, 'req', 'Please enter Project Title');
$obj->add_fields($project_title, 'min=4', 'Project Title should be atleast 4 characters long');
$obj->add_fields($project_title, 'max=25', 'Project Title should not be more than 25 characters long');
$obj->add_fields($short_blurb, 'req', 'Name should not be more than 25 characters long');
$obj->add_fields($short_blurb, 'min=4', 'Short Blurb should be atleast 4 characters long');
$obj->add_fields($short_blurb, 'max=50', 'Short Blurb should not be more than 25 characters long');
$obj->add_fields($project_location, 'req', 'Please enter Location');
$obj->add_fields($project_description, 'req', 'Please Enter Project Description');
$obj->add_fields($project_description, 'min=4', 'Project Description should be atleast 4 characters long');
$obj->add_fields($project_description, 'max=250', 'Project Description should not be more than 25 characters long');
$error = $obj->validate();
}
if (isset($_POST['action']) && $_POST['action'] == 'edit') {
extract($_POST);
if ($description == '') {
redirect(SITE_ADM . "project_update.php?msg=EDITEMPTY");
示例3: common
#Description : This Code is used to Manage Pages
*************************************************************************************************************/
extract($_GET);
extract($_POST);
$obj_setting = new common();
$obj = new validation();
$path = LIST_ROOT . '/images/home/banner/';
#Code to Fetch page category data
#END
$publish = 1;
/* Get Current Date Time Stamp */
$currentTimestamp = getCurrentTimestamp();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$error = '';
/*validate required fields*/
$obj->add_fields($tabtitle, 'req', 'Please Enter Tab Title');
if ($id == "") {
$obj->add_fields($tabtitle, 'uniquevalue', 'Please Enter Unique Tab Title', array('content_page', "tab_title='" . mysql_real_escape_string($tabtitle) . "' and page_name= 'Logistique'"));
} else {
$obj->add_fields($tabtitle, 'uniquevalue', 'Please Enter Unique Tab Title', array('content_page', "tab_title='" . mysql_real_escape_string($tabtitle) . "' and page_name= 'Logistique' and id!=" . $id));
}
$obj->add_fields($content, 'req', 'Please Enter Content');
if (!isset($_GET['id'])) {
$obj->add_fields($_FILES['file']['name'], 'req', 'Please Upload Banner Image');
}
$obj->add_fields($_FILES['file'], 'ftype=jpg,gif,png', 'Please Upload Valid Banner Image');
if ($_FILES['file']['name'] != "") {
$obj->add_fields($_FILES['file'], "imgwh=251,207", "Please Upload Valid Banner Image(251pxX207px)");
}
$error = $obj->validate();
if ($error) {
示例4: validation
<?php
/*************************************************************************************************************
#Coder : Kapil Verma
*************************************************************************************************************/
extract($_GET);
extract($_POST);
$obj = new validation();
if (isset($submit) && $submit != "" && $_SERVER['REQUEST_METHOD'] == 'POST') {
$error = '';
$obj->add_fields($name, 'req', 'Please Enter Name');
$obj->add_fields($position, 'req', 'Please Enter Status Number');
$obj->add_fields($short, 'req', 'Please Enter Short Description');
$obj->add_fields($desc, 'req', 'Please Enter Description');
$error = $obj->validate();
$devicesInfo = $objCommon->read('status', "name='{$name}' and id != '{$id}'");
if (mysql_num_rows($devicesInfo)) {
$error .= "Name already exists";
}
$devicesInfo = $objCommon->read('status', "position='{$position}' and id != '{$id}'");
if (mysql_num_rows($devicesInfo)) {
$error .= "<br/>Status Number already defined";
}
if ($error) {
$errorMsg = "<font color='#FF0000' family='verdana' size=2>" . $error . "</font>";
} else {
$dataArr = array('name' => ucfirst($name), 'active' => $active, 'short_description' => $short, 'long_description' => $desc, 'position' => $position);
$update_Article = $objCommon->update("status", $dataArr, "id = '{$id}'");
unset($objCommon);
示例5: header
$target_file = "standardlimit";
if (!isset($_GET) || !isset($_GET['page']) || $_GET['page'] < 1) {
$_GET['page'] = 1;
}
require_once "pagination.php";
if ($_SESSION["admin_user"] == "") {
header('location: login.php');
}
if ($_SESSION["admin_role"] == 1) {
header('location: home.php');
}
if (isset($_POST['action'])) {
extract($_POST);
$obj = new validation();
//$obj->add_fields($standardaffiliated, 'req', 'This field is required.');
$obj->add_fields($standardcommission, 'req', 'This field is required.');
//$obj->add_fields($standardwithdrawl, 'req', 'This field is required.');
//$obj->add_fields($standardaffiliated, 'num,max=6', 'Please Enter only number');
$obj->add_fields($standardcommission, 'num,max=6', 'Please Enter only number');
//$obj->add_fields($standardwithdrawl, 'num,max=6', 'Please Enter only number');
//$obj->add_fields($wlimit, 'lte=1', 'Please Enter valid number');
$error = $obj->validate();
}
if (isset($_GET) && isset($_GET['action']) && $_GET['action'] == 'edit') {
$std_edit_qry = mysql_fetch_assoc($con->recordselect("SELECT * FROM smallprojectamount"));
}
// Form Post code start
if (isset($_POST['action']) && ($_POST['action'] == 'add' || $_POST['action'] == 'edit')) {
extract($_POST);
//$standardaffiliated = addslashes($standardaffiliated);
$standardcommission = addslashes($standardcommission);
示例6: common
#Coder : Kapil Verma
*************************************************************************************************************/
extract($_GET);
extract($_POST);
$obj_product = new common();
$obj = new validation();
$obj_handle = new Handle();
/* Get Current Date Time Stamp */
$currentTimestamp = getCurrentTimestamp();
if (isset($submit) && $submit != "" && $_SERVER['REQUEST_METHOD'] == 'POST') {
$error = '';
//$obj->add_fields($name, 'req', 'Please Enter Product-Name');
if ($name == '') {
$obj->add_fields($name, 'req', 'Please Enter Sub Category Name');
} else {
$result = $obj_product->numberOfRows(TBL_MEMBER, 'name = "' . $name . '" AND cat_id=' . $cat_id . ' AND sub_cat_id =' . $sub_cat_id);
}
$obj->add_fields($cat_id, 'req', 'Please Select Product Category');
$obj->add_fields($sub_cat_id, 'req', 'Please Select Product Sub Category');
$error = $obj->validate();
if ($error || $result > 0) {
if ($result > 0) {
$error .= "Product already Exist in selected Category.";
}
$errorMsg = "<font color='#FF0000' family='verdana' size=2>" . $error . "</font>";
} else {
if ($_FILES['logo']['name']) {
$logo = $currentTimestamp . '_' . $_FILES['logo']['name'];
move_uploaded_file($_FILES['logo']['tmp_name'], LIST_ROOT_ADMIN . "/products_manager/upload/" . $logo);
示例7: array
<?php
require_once "../../includes/config.php";
$title = "Reset Password";
$meta = array("description" => "Reset Password", "keywords" => "Reset Password");
if ($_GET["email"] && $_GET["actCode"] != "") {
if (isset($_POST["submitResetpass"])) {
extract($_POST);
$obj = new validation();
$obj->add_fields($newpass, 'req', ER_PSW);
$obj->add_fields($newpass, 'min=6', 'Enter Password atleast 6. characters long');
$obj->add_fields($newpass, 'max=25', 'Password should not be more than 25 characters long');
$obj->add_fields($newpass, 'alphanumUD', "Passord" . ER_ALPHANUM);
$obj->add_fields($cnewpass, 'req', ER_CPSW);
$obj->add_fields($cnewpass, 'alphanumUD', "Confirmed passord" . ER_ALPHANUM);
$error = $obj->validate();
$passwd = '';
/*if( preg_match('`[A-Z]`',$passwd) // at least one upper case
&& preg_match('`[a-z]`',$passwd) // at least one lower case
&& preg_match('`[0-9]`',$passwd) // at least one digit
)
{
echo "hi";
}
else
{
$_SESSION['msgType'] = array('from'=>'user', 'type'=>'error', 'var'=>"multiple",'val'=>"The password must contain a minimum of one lower case character. one upper case character, one digit.");
} */
if ($newpass != $cnewpass) {
$_SESSION['msgType'] = array('from' => 'user', 'type' => 'error', 'var' => "multiple", 'val' => ER_SAMEPSW);
示例8: common
#Description : This Code is used to Manage Pages
*************************************************************************************************************/
extract($_GET);
extract($_POST);
$obj_setting = new common();
$obj = new validation();
$path = LIST_ROOT . '/images/home/banner/';
#Code to Fetch page category data
#END
$publish = 1;
/* Get Current Date Time Stamp */
$currentTimestamp = getCurrentTimestamp();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$error = '';
/*validate required fields*/
$obj->add_fields($category_id, 'req', 'Please Select Category');
$obj->add_fields($title, 'req', 'Please Enter Title Name');
$obj->add_fields($content, 'req', 'Please Enter Content');
$error = $obj->validate();
if ($error) {
$errorMsg = "<font color='#FF0000' family='verdana' size=2>" . $error . "</font>";
} else {
/*save category*/
$slug = str_replace(' ', '_', strtolower($title));
$dataArr = array('category_id' => $category_id, 'title' => $title, 'content' => $content, 'slug' => $slug);
if ($id == "") {
$categoryInsert = $obj_setting->save('news_articles', $dataArr);
} else {
$categoryInsert = $obj_setting->update('news_articles', $dataArr, "id=" . $id);
}
$_SESSION['success_msg'] = 'Successfully Saved';
示例9: validation
$obj = new validation();
$currentTimestamp = getCurrentTimestamp();
#Code to Fetch seleted ID's data
$fetchSetting = $obj_setting->read('template', ' id = 1');
$getSetting = $db->fetchNextObject($fetchSetting);
$email = $getSetting->email;
$subject = $getSetting->subject;
$template = $getSetting->template;
$next_date = $getSetting->next_date;
extract($_POST);
/* Get Current Date Time Stamp */
$currentTimestamp = getCurrentTimestamp();
#saving data in database after validation
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$error = '';
$obj->add_fields($email, 'req', 'Please Enter Email');
$obj->add_fields($email, 'email', 'Please Enter A Valid Email');
$obj->add_fields($subject, 'req', 'Please Enter Subject');
$obj->add_fields($template, 'req', 'Please Enter Template');
$error = $obj->validate();
if ($error) {
$errorMsg = "<font color='#FF0000' family='verdana' size=2>" . $error . "</font>";
} else {
$_SESSION['success_msg'] = 'Template has been edited successfully.';
$dataArr = array('email' => $email, 'subject' => $subject, 'template' => $template, 'next_date' => $next_date, 'mail_date' => $currentTimestamp);
$update_site = $obj_setting->update('template', $dataArr, ' id=1');
echo '<script>location.href="' . DEFAULT_ADMIN_URL . '/template/reminder/index.php' . $addToUrl . '";</script>';
exit;
}
}
unset($obj_setting);
示例10: validation
<?php
/*************************************************************************************************************
#Coder : Kapil Verma
*************************************************************************************************************/
extract($_GET);
extract($_POST);
$obj = new validation();
if (isset($submit) && $submit != "" && $_SERVER['REQUEST_METHOD'] == 'POST') {
$error = '';
$obj->add_fields($car_name, 'req', 'Please Enter Car Name');
$obj->add_fields($_FILES['image']['name'], 'req', "Please upload file.");
if ($_FILES['image']['name']) {
$obj->add_fields($_FILES['image'], 'ftype=png,jpg,gif', "Please upload png,jpg,gif file.");
$obj->add_fields($_FILES['image'], 'imgwh=667,327', "Please upload Image with dimension 667px X 327px.");
$obj->add_fields($_FILES['image'], 'fsize=1048576', 'Please Upload Image of size less than 1mb ');
}
$error = $obj->validate();
$devicesInfo = $objCommon->read('car_gallery', "car_name='{$car_name}'");
if (mysql_num_rows($devicesInfo)) {
$error .= "Car Name already exists";
}
if ($error) {
$errorMsg = "<font color='#FF0000' family='verdana' size=2>" . $error . "</font>";
} else {
$filename = time() . $_FILES['image']['name'];
$dataArr = array('car_name' => ucfirst($car_name), 'status' => $status, 'image_name' => $filename);
set_time_limit(0);
$docDestination = LIST_ROOT . '/gallery/' . $filename;
示例11: extract
}
// Delete Image code start
if (isset($_GET['action']) && $_GET['action'] == 'delete') {
/*$qry="UPDATE image SET status=0 WHERE id='".$_GET['id']."'";
$con->update($qry);
redirectPage(SITE_ADM."image.php?msg=DEL"); */
}
// Delete Image code end
// Form Post code start
if (isset($_POST['action'])) {
print_r($_POST);
exit;
extract($_POST);
$obj = new validation();
if ($action == 'add') {
$obj->add_fields($con_key, 'req', ER_KEY);
}
$obj->add_fields($con_value, 'req', ER_VALUE);
$error = $obj->validate();
if ($error == '') {
if ($action == 'add') {
$insert = "INSERT INTO image (con_key,con_value,status,created) VALUES('" . $con_key . "','" . $con_value . "','" . $status . "','" . date("Y-m-d H:i:s") . "')";
$con->insert($insert);
$msg = 'ADD';
} else {
if ($action == 'edit') {
$update = "UPDATE image SET con_value='" . $con_value . "', status='" . $status . "' WHERE id='" . $id . "'";
$con->update($update);
$msg = 'EDIT';
}
}
示例12: validation
<?php
/*************************************************************************************************************
#Coder : Kapil Verma
*************************************************************************************************************/
extract($_GET);
extract($_POST);
$obj = new validation();
$stats = $objCommon->read('status', '', 'position ASC');
if (isset($submit) && $submit != "" && $_SERVER['REQUEST_METHOD'] == 'POST') {
$error = '';
$obj->add_fields($title, 'req', 'Please Enter Title');
$obj->add_fields($fees, 'req', 'Please Enter Amount');
$obj->add_fields($fees, 'currency', 'Please Enter a valid Amount');
$obj->add_fields($status_id, 'req', 'Please Select Associated Status');
$obj->add_fields($desc, 'req', 'Please Enter Description');
$error = $obj->validate();
$devicesInfo = $objCommon->read('upsell', "title='{$title}' and id != '{$id}' ");
if (mysql_num_rows($devicesInfo)) {
$error .= "Title already exists";
}
if ($error) {
$errorMsg = "<font color='#FF0000' family='verdana' size=2>" . $error . "</font>";
} else {
$dataArr = array('title' => ucfirst($title), 'status' => $status, 'fees' => number_format($fees, 2), 'status_id' => $status_id, 'desc' => $desc);
$update_Article = $objCommon->update("upsell", $dataArr, "id = {$id}");
unset($objCommon);
$_SESSION['msg'] = 'Successfully Updated';
echo '<script>location.href="' . DEFAULT_URL . '/admin/upsell/index.php";</script>';
示例13: header
<?php
require_once "../includes/config.php";
$pagetitle = "Small Project Amount";
require_once DIR_FUN . 'validation.class.php';
if ($_SESSION["admin_user"] == "") {
header('location: login.php');
}
if ($_SESSION["admin_role"] == 1) {
header('location: home.php');
}
if (isset($_POST['action'])) {
extract($_POST);
$obj = new validation();
$obj->add_fields($amount, 'req', 'Please Enter Small Project Amount');
$obj->add_fields($amount, 'num,max=6', 'Please Enter only number');
$error = $obj->validate();
}
// Form Post code start
if (isset($_POST['action']) && $_POST['action'] == 'edit') {
extract($_POST);
$amount = is_numeric($amount) ? $amount : 0;
if ($_POST['action'] == 'edit' && $error == '') {
$con->update("UPDATE smallprojectamount SET amount='{$amount}' WHERE id=1");
header('location: small_project.php?msg=RECSUC');
}
}
// Form Post code end
//select query code start
$sel_small_project_amount = mysql_fetch_array($con->recordselect("SELECT * FROM smallprojectamount WHERE id=1"));
//select query code end
示例14: common
<?php
/*************************************************************************************************************
#Description : This Code is used to Manage Pages
*************************************************************************************************************/
extract($_GET);
extract($_POST);
$obj_setting = new common();
$commonFunction = new commonFunction();
$obj = new validation();
#Code to Fetch page category data
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$error = '';
/*validate required fields*/
$obj->add_fields($category_name, 'req', 'Please Enter Category Name');
if ($id == "") {
$obj->add_fields($category_name, 'uniquevalue', 'Please Enter Unique Category Name', array('news_category', "category_name='" . mysql_real_escape_string($category_name) . "'"));
} else {
$obj->add_fields($category_name, 'uniquevalue', 'Please Enter Unique Category Name', array('news_category', "category_name='" . mysql_real_escape_string($category_name) . "' and id!=" . $id));
}
$error = $obj->validate();
if ($error) {
$errorMsg = "<font color='#FF0000' family='verdana' size=2>" . $error . "</font>";
} else {
/*save category*/
$slug = $commonFunction->url_slug(strtolower($category_name));
$dataArr = array('category_name' => htmlentities($category_name), 'slug' => $slug);
if ($id == "") {
$categoryInsert = $obj_setting->save('news_category', $dataArr);
} else {
$categoryInsert = $obj_setting->update('news_category', $dataArr, "id=" . $id);
示例15: common
#Coder : Kapil Verma
#Description : This Code is used to Manage Pages
*************************************************************************************************************/
extract($_GET);
extract($_POST);
$obj_setting = new common();
$obj = new validation();
#Code to Fetch page category data
#END
$publish = 1;
/* Get Current Date Time Stamp */
$currentTimestamp = getCurrentTimestamp();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$error = '';
/*validate required fields*/
$obj->add_fields($_FILES['topbanner'], 'ftype=jpg,gif,png', 'Please Upload Valid Top Banner');
$obj->add_fields($_FILES['topbanner'], "imgwh=1250,300", "Please Upload Valid Top Banner(1250pxX00px)");
$obj->add_fields($_FILES['sidebanner'], 'ftype=jpg,gif,png', 'Please Upload Valid Side Banner');
$obj->add_fields($_FILES['sidebanner'], "imgwh=145,350", "Please Upload Valid Side Banner(145pxX350px)");
$error = $obj->validate();
if ($error) {
$errorMsg = "<font color='#FF0000' family='verdana' size=2>{$error}</font>";
} else {
/*save real facts section content*/
if ($_FILES['topbanner']['name'] != "") {
$image_name = time() . $_FILES['topbanner']['name'];
$path = LIST_ROOT . '/images/presentation/';
move_uploaded_file($_FILES["topbanner"]["tmp_name"], $path . $image_name);
} else {
$image_name = $oldtopimage;
}