当前位置: 首页>>代码示例>>PHP>>正文


PHP ValidateInteger函数代码示例

本文整理汇总了PHP中ValidateInteger函数的典型用法代码示例。如果您正苦于以下问题:PHP ValidateInteger函数的具体用法?PHP ValidateInteger怎么用?PHP ValidateInteger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ValidateInteger函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: foreach

        foreach ($check as $item) {
            $retorno = $DAO->DeletarRelacionamento($item);
            if ($retorno != 1) {
                break;
            }
        }
        if ($retorno == 1) {
            echo '<script language= "JavaScript">alert("Registro removido com sucesso");</script>';
            echo '<script language= "JavaScript">location.href="rel_pessoal.php?id=' . $id . '";</script>';
        } else {
            echo '<script language= "JavaScript">alert("Erro ao excluir");</script>';
        }
    }
}
if (!empty($_GET['cmd']) && $_GET['cmd'] == 'del') {
    $item = ValidateInteger(INPUT_GET, 'item');
    $id = $_GET['id'];
    $retorno = $DAO->DeletarRelacionamento($item);
    if ($retorno == 1) {
        echo '<script language= "JavaScript">alert("Registro removido com sucesso");</script>';
        echo '<script language= "JavaScript">location.href="rel_pessoal.php?id=' . $id . '";</script>';
    } else {
        echo '<script language= "JavaScript">alert("Erro ao excluir");</script>';
    }
}
?>

<script>
function marcarTodos(marcar){
    var itens = document.getElementsByName('check[]');
开发者ID:hexti,项目名称:troncal,代码行数:30,代码来源:rel_pessoal.php

示例2: checkUserAuth

<?php

include_once '../../includes.sys/ini.php';
include_once '../../includes.sys/metodos.php';
include_once '../DAO/EquipamentoDAO.php';
checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true');
include_once '../../head.php';
if (!in_array(295, listarAcesso())) {
    echo '<script language= "JavaScript">location.href="index.php";</script>';
}
$DAO = new EquipamentoDAO();
if (!empty($_GET['cmd']) && $_GET['cmd'] == 'del') {
    $id = ValidateInteger(INPUT_GET, 'id');
    $retorno = $DAO->Deletar($id);
    if ($retorno == 1) {
        echo '<script language= "JavaScript">alert("Registro removido com sucesso");</script>';
        echo '<script language= "JavaScript">location.href="index.php";</script>';
    } else {
        echo '<script language= "JavaScript">alert("Erro ao remover o registro");</script>';
    }
}
?>
	<!-- topbar ends -->
		<div class="container-fluid">
		<div class="row-fluid">
				
			<!-- left menu starts -->
			<div class="span2 main-menu-span">
				<?php 
include_once '../menu.php';
?>
开发者ID:hexti,项目名称:troncal,代码行数:31,代码来源:index.php

示例3: _AddEdit

 protected function _AddEdit($Sender, $PocketID = FALSE)
 {
     $Form = new Gdn_Form();
     $PocketModel = new Gdn_Model('Pocket');
     $Form->SetModel($PocketModel);
     $Sender->ConditionModule = new ConditionModule($Sender);
     $Sender->Form = $Form;
     if ($Form->AuthenticatedPostBack()) {
         // Save the pocket.
         if ($PocketID !== FALSE) {
             $Form->SetFormValue('PocketID', $PocketID);
         }
         // Convert the form data into a format digestable by the database.
         $Repeat = $Form->GetFormValue('RepeatType');
         switch ($Repeat) {
             case Pocket::REPEAT_EVERY:
                 $PocketModel->Validation->ApplyRule('EveryFrequency', 'Integer');
                 $PocketModel->Validation->ApplyRule('EveryBegin', 'Integer');
                 $Frequency = $Form->GetFormValue('EveryFrequency', 1);
                 if (!$Frequency || !ValidateInteger($Frequency) || $Frequency < 1) {
                     $Frequency = 1;
                 }
                 $Repeat .= ' ' . $Frequency;
                 if ($Form->GetFormValue('EveryBegin', 1) > 1) {
                     $Repeat .= ',' . $Form->GetFormValue('EveryBegin');
                 }
                 break;
             case Pocket::REPEAT_INDEX:
                 $PocketModel->Validation->AddRule('IntegerArray', 'function:ValidateIntegerArray');
                 $PocketModel->Validation->ApplyRule('Indexes', 'IntegerArray');
                 $Indexes = explode(',', $Form->GetFormValue('Indexes', ''));
                 $Indexes = array_map('trim', $Indexes);
                 $Repeat .= ' ' . implode(',', $Indexes);
                 break;
             default:
                 break;
         }
         $Form->SetFormValue('Repeat', $Repeat);
         $Form->SetFormValue('Sort', 0);
         $Form->SetFormValue('Format', 'Raw');
         $Condition = Gdn_Condition::ToString($Sender->ConditionModule->Conditions(TRUE));
         $Form->SetFormValue('Condition', $Condition);
         if ($Form->GetFormValue('Ad', 0)) {
             $Form->SetFormValue('Type', Pocket::TYPE_AD);
         } else {
             $Form->SetFormValue('Type', Pocket::TYPE_DEFAULT);
         }
         $Saved = $Form->Save();
         if ($Saved) {
             $Sender->StatusMessage = T('Your changes have been saved.');
             $Sender->RedirectUrl = Url('settings/pockets');
         }
     } else {
         if ($PocketID !== FALSE) {
             // Load the pocket.
             $Pocket = $PocketModel->GetWhere(array('PocketID' => $PocketID))->FirstRow(DATASET_TYPE_ARRAY);
             if (!$Pocket) {
                 return Gdn::Dispatcher()->Dispatch('Default404');
             }
             // Convert some of the pocket data into a format digestable by the form.
             list($RepeatType, $RepeatFrequency) = Pocket::ParseRepeat($Pocket['Repeat']);
             $Pocket['RepeatType'] = $RepeatType;
             $Pocket['EveryFrequency'] = GetValue(0, $RepeatFrequency, 1);
             $Pocket['EveryBegin'] = GetValue(1, $RepeatFrequency, 1);
             $Pocket['Indexes'] = implode(',', $RepeatFrequency);
             $Pocket['Ad'] = $Pocket['Type'] == Pocket::TYPE_AD;
             $Sender->ConditionModule->Conditions(Gdn_Condition::FromString($Pocket['Condition']));
             $Form->SetData($Pocket);
         } else {
             // Default the repeat.
             $Form->SetFormValue('RepeatType', Pocket::REPEAT_ONCE);
         }
     }
     $Sender->Form = $Form;
     $Sender->SetData('Locations', $this->Locations);
     $Sender->SetData('LocationsArray', $this->GetLocationsArray());
     $Sender->SetData('Pages', array('' => '(' . T('All') . ')', 'activity' => 'activity', 'comments' => 'comments', 'dashboard' => 'dashboard', 'discussions' => 'discussions', 'inbox' => 'inbox', 'profile' => 'profile'));
     return $Sender->Render('AddEdit', '', 'plugins/Pockets');
 }
开发者ID:supercosh,项目名称:addons,代码行数:79,代码来源:class.pockets.plugin.php


注:本文中的ValidateInteger函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。