예제 #1
0
function valida_user_dba($user, $pass)
{
    // Crea conexión
    $login = dba::getInstance();
    $consulta = "SELECT * FROM usuarios WHERE usuario='" . $user . "' AND pass='******'";
    $row = $login->consulta_punt($consulta);
    /*
    	$_SESSION["id_documento"]=$row['id_documento'];
    	$_SESSION["usuario"]=$row['usuario'];
    	$_SESSION["nombres"]=$row['nombres'];
    	$_SESSION["apellidos"]=$row['apellidos'];
    	$_SESSION["email"]=$row['email'];
    	$_SESSION["perfiles_id"]=$row['perfiles_id'];*/
    // Si no hay filas afectadas
    if (empty($row)) {
        // datos no concuerdan
        return 1;
    } else {
        if ($row['activa'] != 1) {
            // cuenta no ha sido activada
            return 2;
        } else {
            // Cuenta activa -> No hay error
            $_SESSION = array();
            $_SESSION["user"] = $user;
            $_SESSION["pass"] = $pass;
            $_SESSION["perfiles_id"] = $row['perfiles_id'] != 0 ? true : false;
            return 0;
        }
    }
    $conexion->cerrar();
    //}
}
예제 #2
0
파일: bd.php 프로젝트: cynalro/equipoHV
 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         $c = __CLASS__;
         self::$instance = new $c();
     }
     return self::$instance;
 }
<?php

//Iniciar una nueva sesión o reanudar la existente
session_start();
include "function/bd.php";
include "function/config.php";
//Incluye variables y parámetros de configuración
$id_documento = @$_POST["id_documento"];
$nombres = @$_POST["nombres"];
$apellidos = @$_POST["apellidos"];
$email = @$_POST["email"];
$departamentos_id = @$_POST["destino_a"];
$municipios_id = @$_POST["destino_b"];
$registradurias_id = @$_POST["destino_c"];
// Conexión a base de datos
$conexion = dba::getInstance();
$actualizar = "UPDATE funcionarios SET id_documento='" . $id_documento . "', nombres='" . $nombres . "', apellidos='" . $apellidos . "', email='" . $email . "', departamentos_id='" . $departamentos_id . "', municipios_id='" . $municipios_id . "'  WHERE id_documento='" . $id_documento . "'";
echo $actualizar;
$conexion->actualiza($actualizar);
?>




예제 #4
0
파일: common.php 프로젝트: fvilpoix/badnet
function getLastMatch()
{
    $dba = new dba();
    $dba->dba();
    $pdo = $dba->_db;
    $stmt = $pdo->prepare('SELECT
	  	mtch_num AS num,
		mtch_court as court
		FROM bdnet_matchs
		ORDER BY mtch_begin DESC
		LIMIT 1
	');
    $stmt->execute();
    return $stmt->fetch();
}
예제 #5
0
파일: cron_sync.php 프로젝트: rabuzarus/dir
function msg($message, $fatal = false)
{
    global $verbose;
    if ($verbose || $fatal) {
        echo $message . PHP_EOL;
    }
    logger($message);
    if ($fatal) {
        exit(1);
    }
}
//Config.
require_once ".htconfig.php";
//Connect the DB.
require_once "dba.php";
$db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
//Import syncing functions.
require_once 'sync.php';
//Get work for pulling.
$pull_batch = get_pulling_job($a);
//Get work for pushing.
list($push_targets, $push_batch) = get_pushing_job($a);
//Close the connection for now. Process forking and DB connections are not the best of friends.
$db->getdb()->close();
if (count($pull_batch)) {
    run_pulling_job($a, $pull_batch, $db_host, $db_user, $db_pass, $db_data, $install);
}
//Do our multi-fork job, if we have a batch and targets.
if (count($push_targets) && count($push_batch)) {
    run_pushing_job($push_targets, $push_batch, $db_host, $db_user, $db_pass, $db_data, $install);
}
예제 #6
0
 public function __construct()
 {
     $this->bd = dba::getInstance();
     $this->tk = array();
 }