本文整理汇总了PHP中set_error函数的典型用法代码示例。如果您正苦于以下问题:PHP set_error函数的具体用法?PHP set_error怎么用?PHP set_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
if (!empty($this->usuario)) {
redirect(base_url('inicio'), 'redirect');
}
//Si esta logueado redirigimos al dashboard
$this->load->helper('form');
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Usuario', 'trim|required|max_length[20]');
$this->form_validation->set_rules('password', 'Clave', 'required|max_length[20]');
if ($this->form_validation->run() == FALSE) {
$val_err = validation_errors();
set_error($val_err, 'login', true);
} else {
$username = set_value('username');
$password = set_value('password');
$result = $this->usuarios_model->get(null, $username);
if ($result != false && strtolower($result->UsuarioNick) == strtolower($username) && $this->usuarios_model->ComprobarClave($result->UsuarioClave, $password)) {
if ($result->UsuarioEstado == 0) {
//Usuario inactivo
set_error('001', 'login');
} elseif ($result->UsuarioEstado == 2) {
set_error('003', 'login');
} else {
$this->usuarios_model->setUltimaConex($result->UsuarioId, $result->UsuarioFecha, $result->UsuarioIp);
$this->session->set_userdata(array('UsuarioId' => $result->UsuarioId));
redirect(base_url('inicio'));
}
} else {
//Usuario o clave incorrectos
set_error('002', 'login');
}
}
$this->vista('login/inicio', null, 'Iniciar Sesión');
}
示例2: query
function query($sql, $debug_message = '')
{
if (class_exists('module_db', false) && is_callable('module_db::query')) {
return module_db::query($sql, $debug_message);
}
//echo ''.$sql.'<br>';
if (_DEBUG_MODE && defined('_DEBUG_SQL') && _DEBUG_SQL) {
static $past_queries = array();
if (!isset($past_queries[$sql])) {
$past_queries[$sql] = 0;
} else {
$past_queries[$sql]++;
}
$sql_debug = $sql;
if (strlen($sql_debug) > 60) {
$sql_debug = htmlspecialchars(substr($sql_debug, 0, 60)) . '<a href="#" onclick="$(this).hide(); $(\'span\',$(this).parent()).show(); return false;">....</a><span style="display:none">' . htmlspecialchars(substr($sql, 60)) . '</span>';
} else {
$sql_debug = htmlspecialchars($sql);
}
if (class_exists('module_debug', false)) {
module_debug::log(array('title' => 'SQL Query', 'file' => 'includes/database.php', 'data' => '(' . ($past_queries[$sql] > 0 ? '<span style="color:#FF0000; font-weight:bold;">' . $past_queries[$sql] . '</span>' : $past_queries[$sql]) . ') ' . $debug_message . $sql_debug, 'important' => $past_queries[$sql] > 0));
}
}
$res = mysql_query($sql);
//or die(mysql_error() . $sql);
if (mysql_errno()) {
set_error(_l('SQL Error: %s', mysql_error() . ' ' . $sql));
set_error(_l('Try clicking the "Run Manual Upgrades" button to resolve SQL Errors.'));
return false;
}
return $res;
}
示例3: setRolGrupo
public function setRolGrupo($Nick)
{
$data['grupo'] = $this->roles_model->getGrupoInfo(null, $Nick);
if (!$data['grupo']) {
//Si el grupo no existe o es superior al tuyo
redirect(base_url('errores/404/'));
} elseif (!$this->compareRangos($data['grupo'])) {
set_error("014", 'grupos');
}
$roles = $this->roles_model->getRoles();
if (!empty($roles)) {
$i = 0;
$c = 0;
$ci = 0;
$Roles = array();
$DRoles = array();
foreach ($roles as $rol) {
$i++;
if (in_array($rol->RolId, $data['grupo']->URoles)) {
//Permisos de grupo
$Roles[$rol->CategoriaNombre][] = $rol;
} else {
//Permisos sin establecer
$DRoles["Otros"][$rol->CategoriaNombre][] = $rol;
}
}
} else {
set_error("018", 'inicio');
}
$data['roles'] = $Roles;
$data['droles'] = $DRoles;
$bread = array(array("bread" => $Nick, "link" => "grupo/" . $Nick), array("bread" => "Permisos de Grupo"));
$this->vista('roles/grupos', $bread, 'Permisos de ' . $Nick, $data, "roles");
}
示例4: show_errors
/**
* Displays the errors in a user friendly box
*/
function show_errors()
{
$errors = set_error();
if (!empty($errors)) {
$errors = implode('<br/>', $errors);
show_view('five-notification-error', array('notification' => $errors));
}
}
示例5: insere
function insere($con, $vol_id)
{
$sql = "INSERT INTO lacres VALUES (NULL";
$sql .= ", " . $con->quote($vol_id);
$sql .= ", " . $con->quote($this->nLacre);
$sql .= ")";
$qry = $con->query($sql);
if (MDB2::isError($qry)) {
set_error('Erro lacres: ' . $qry->getMessage());
return false;
} else {
$lacres_id = $con->lastInsertID("lacres", "lacres_id");
}
}
示例6: insere
function insere($con, $det_id)
{
$sql = "INSERT INTO infAdProd VALUES (NULL";
$sql .= ", " . $con->quote($det_id);
$sql .= ", " . $con->quote($this->infAdProd);
$sql .= ")";
$qry = $con->query($sql);
if (MDB2::isError($qry)) {
set_error('Erro infAdProd: ' . $qry->getMessage());
return false;
} else {
$infAdProd_id = $con->lastInsertID("infAdProd", "infAdProd_id");
}
}
示例7: insere
function insere($con, $infAdic_id)
{
$sql = "INSERT INTO procRef VALUES (NULL";
$sql .= ", " . $con->quote($infAdic_id);
$sql .= ", " . $con->quote($this->nProc);
$sql .= ", " . $con->quote($this->indProc);
$sql .= ")";
$qry = $con->query($sql);
if (MDB2::isError($qry)) {
set_error('Erro procRef: ' . $qry->getMessage());
return false;
} else {
$procRef_id = $con->lastInsertID("procRef", "procRef_id");
}
}
示例8: insere
function insere($con, $infNFe_id)
{
$sql = "INSERT INTO exporta VALUES (NULL";
$sql .= ", " . $con->quote($infNFe_id);
$sql .= ", " . $con->quote($this->UFEmbarq);
$sql .= ", " . $con->quote($this->xLocEmbarq);
$sql .= ")";
$qry = $con->query($sql);
if (MDB2::isError($qry)) {
set_error('Erro exporta: ' . $qry->getMessage());
return false;
} else {
$exporta_id = $con->lastInsertID("exporta", "exporta_id");
}
}
示例9: insere
function insere($con, $infAdic_id)
{
$sql = "INSERT INTO obsCont VALUES (NULL";
$sql .= ", " . $con->quote($infAdic_id);
$sql .= ", " . $con->quote($this->xCampo);
$sql .= ", " . $con->quote($this->xTexto);
$sql .= ")";
$qry = $con->query($sql);
if (MDB2::isError($qry)) {
set_error('Erro obsCont: ' . $qry->getMessage());
return false;
} else {
$obsCont_id = $con->lastInsertID("obsCont", "obsCont_id");
}
}
示例10: insere
function insere($con, $infNFe_id)
{
$sql = "INSERT INTO compra VALUES (NULL";
$sql .= ", " . $con->quote($infNFe_id);
$sql .= ", " . $con->quote($this->xNEmp);
$sql .= ", " . $con->quote($this->xPed);
$sql .= ", " . $con->quote($this->xCont);
$sql .= ")";
$qry = $con->query($sql);
if (MDB2::isError($qry)) {
set_error('Erro compra: ' . $qry->getMessage());
return false;
} else {
$compra_id = $con->lastInsertID("compra", "compra_id");
}
}
示例11: insere
function insere($con, $transp_id)
{
$sql = "INSERT INTO veicTransp VALUES (NULL";
$sql .= ", " . $con->quote($transp_id);
$sql .= ", " . $con->quote($this->placa);
$sql .= ", " . $con->quote($this->UF);
$sql .= ", " . $con->quote($this->RNTC);
$sql .= ")";
$qry = $con->query($sql);
if (MDB2::isError($qry)) {
set_error('Erro veicTransp: ' . $qry->getMessage());
return false;
} else {
$veicTransp_id = $con->lastInsertID("veicTransp", "veicTransp_id");
}
}
示例12: insere
function insere($con, $infNFe_id)
{
$sql = "INSERT INTO total VALUES (NULL";
$sql .= ", " . $con->quote($infNFe_id);
$sql .= ")";
$qry = $con->query($sql);
if (MDB2::isError($qry)) {
set_error('Erro total: ' . $qry->getMessage());
return false;
} else {
$total_id = $con->lastInsertID("total", "total_id");
$this->ICMSTot->insere($con, $total_id);
is_object($this->ISSQNtot) ? $this->ISSQNtot->insere($con, $total_id) : null;
is_object($this->retTrib) ? $this->retTrib->insere($con, $total_id) : null;
}
}
示例13: insere
function insere($con, $cobr_id)
{
$sql = "INSERT INTO dup VALUES (NULL";
$sql .= ", " . $con->quote($cobr_id);
$sql .= ", " . $con->quote($this->nDup);
$sql .= ", " . $con->quote($this->dVenc);
$sql .= ", " . $con->quote($this->vDup);
$sql .= ")";
$qry = $con->query($sql);
if (MDB2::isError($qry)) {
set_error('Erro dup: ' . $qry->getMessage());
return false;
} else {
$dup_id = $con->lastInsertID("dup", "dup_id");
}
}
示例14: insere
function insere($con, $DI_id)
{
$sql = "INSERT INTO adi VALUES (NULL";
$sql .= ", " . $con->quote($DI_id);
$sql .= ", " . $con->quote($this->nAdicao);
$sql .= ", " . $con->quote($this->nSeqAdic);
$sql .= ", " . $con->quote($this->cFabricante);
$sql .= ", " . $con->quote($this->vDescDI);
$sql .= ")";
$qry = $con->query($sql);
if (MDB2::isError($qry)) {
set_error('Erro adi: ' . $qry->getMessage());
return false;
} else {
$adi_id = $con->lastInsertID("adi", "adi_id");
}
}
示例15: insere
function insere($con, $infNFe_id)
{
$sql = "INSERT INTO cobr VALUES (NULL";
$sql .= ", " . $con->quote($infNFe_id);
$sql .= ")";
$qry = $con->query($sql);
if (MDB2::isError($qry)) {
set_error('Erro cobr: ' . $qry->getMessage());
return false;
} else {
$cobr_id = $con->lastInsertID("cobr", "cobr_id");
is_object($this->fat) ? $this->fat->insere($con, $cobr_id) : null;
for ($i = 0; $i < count($this->dup); $i++) {
$this->dup[$i]->insere($con, $cobr_id);
}
}
}