public function insNuevoSoporte($datos)
 {
     $id_soporte = $this->_query->insert($datos);
     if ($id_soporte) {
         return $id_soporte;
     } else {
         return null;
     }
 }
Example #2
0
 /**
  * inserts the user details into the database
  */
 public function insertUser()
 {
     $user_table = "user_details";
     $add['user_name'] = $_POST['username'];
     $add['first_name'] = $_POST['firstname'];
     $add['last_name'] = $_POST['lastname'];
     $add['age'] = date('Y') - $_POST['year'];
     $add['gender'] = $_POST['gender'];
     $add['password'] = md5($_POST['password']);
     $add['blood_group'] = $_POST['bloodGroup'];
     $add['email'] = $_POST['email'];
     $add['mobile'] = $_POST['mobile'];
     $interest = $_POST['interest'];
     $qualification = $_POST['qualifications'];
     $conn = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
     $que = parent::insert($user_table, $add);
     $interest_query = "update interest SET interest='{$interest}'";
     $qua_query = "update qualifications SET qualification='{$qualification}'";
     $result1 = mysqli_query($conn, $que) or die(mysql_error($conn));
     $result2 = mysqli_query($conn, $interest_query) or die(mysqli_error($conn));
     $result3 = mysqli_query($conn, $qua_query) or die(mysqli_error($conn));
     if ($result1 && $result2 && $result3) {
         return true;
     } else {
         return false;
     }
 }
Example #3
0
 public function enroll($post)
 {
     $q3 = new Query();
     /*
             if($post['payment_structure']==='F'){
        $q3->table = 'enroll_full';
        $q3->insertarray = array(
            'enf_code'=>  rand(100000, 999999),
            'enf_tour_id'=>$post['tour_id'],
            'enf_user_id'=>$uid,
            'enf_amount'=>$post['tour_full_pay'],
            'enf_occ'=>$post['tour_occupancy'],
            'enf_hfr'=>$post['tour_hfr']
        );
        $q3->insert();
             }else{
        
             }
     */
     $q3->table = 'enroll_full';
     $q3->insertarray = array('enf_code' => rand(100000, 999999), 'enf_tour_id' => $post['tour_id'], 'enf_user_id' => $post['user_id'], 'enf_amount' => $post['tour_full_pay'], 'enf_occ' => $post['tour_occupancy'], 'enf_hfr' => $post['tour_hfr']);
     $q3->insert();
     $last = $q3->lastInsertId();
     return $last;
 }
Example #4
0
function inserting($table, $insertarray)
{
    $q = new Query();
    $q->table = $table;
    $q->insertarray = $insertarray;
    $q->insert();
    return $q->lastInsertId();
}
Example #5
0
 public function insertUserMobile()
 {
     $add['mobile_no'] = $_POST['mobile'];
     $conn = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
     $table_name = "mobile";
     $db_queries = new Query();
     $query = $db_queries->insert($table_name, $add);
     $result1 = mysqli_query($conn, $query);
     if ($result1) {
         return true;
     } else {
         return false;
     }
 }
 protected function addRelation($object)
 {
     if (!isset($this->owner)) {
         return false;
     }
     // can't add without
     $owner = $this->owner;
     $joint = static::tableJoin($owner->tableName, $object->tableName);
     // get the joint table
     $query = new Query($joint);
     $query->insert($joint, [$owner->tableName => $owner->primaryKey, $object->tableName => $object->primaryKey]);
     $key = static::query($query, $query->params);
     $this->collection[] = $object;
     // append to the array...
     return $key;
 }
Example #7
0
 /**
  * Создание пользователя
  * @return int userId - код нового пользователя
  */
 public final function createUser(RegFormData $data)
 {
     $email = PsCheck::email($data->getUserMail());
     //Проверим, что пользователь с таким email ещё не заведён
     check_condition(!$this->hasMail($email), "Пользователь с почтой [{$email}] уже зарегистрирован");
     //Подготовим поля для вставки
     $params[self::FIELD_NAME] = $data->getUserName();
     $params[self::FIELD_SEX] = $data->getSex();
     $params[self::FIELD_EMAIL] = $email;
     $params[self::FIELD_PASSWD] = self::hashPassword($data->getPassword());
     $params[self::FIELD_B_ADMIN] = 0;
     $params[self::FIELD_B_CAN_LOGIN] = 1;
     $params[] = Query::assocParam(self::FIELD_DT_REG, 'UNIX_TIMESTAMP()', false);
     //Выполняем вставку
     $userId = $this->register($this->insert(Query::insert('users', $params)));
     //Сохраним данные пользователя в аудит
     UserAudit::inst()->afterRegistered($userId, array_filter_keys($this->getUserDataById($userId), self::$SKIP_AUDIT_ON_CREATE_FIELDS));
     //Возвращаем код пользователя
     return $userId;
 }
Example #8
0
File: DB.php Project: clancats/core
 /**
  * Create an insert query object
  *
  * @param string		$table
  * @param array		$data
  * @return mixed
  */
 public static function insert($table, $values = array(), $handler = null)
 {
     return Query::insert($table, $values, $handler);
 }
Example #9
0
<?php

include 'Query.inc';
$query = new Query();
$ruta = "fondos";
$archivo = $_FILES['imagen']['tmp_name'];
$nombreArchivo = $_FILES['imagen']['name'];
move_uploaded_file($archivo, $ruta . "/" . $nombreArchivo);
$ruta = $ruta . "/" . $nombreArchivo;
$admin = $query->insert("libro", "folio,nombre,autor,editorial,edicion,existencias,imagen\n\t\t\t", "'" . $_POST['folio'] . "','" . $_POST['nombre'] . "','" . $_POST['autor'] . "','" . $_POST['editorial'] . "','" . $_POST['edicion'] . "','" . $_POST['existencias'] . "','" . $ruta . "'");
if ($admin) {
    $regresar = false;
    echo ' <script language="javascript">alert("Registro Realizado Exitoxamente");</script> ';
    $regresar = true;
    if ($regresar) {
        header("location:libro.php");
    }
} else {
    echo ' <script language="javascript">alert("Error al registrar alumno");</script> ';
}
Example #10
0
<?php

include "sources/funciones.php";
if ($_SESSION["Activa"] and $_SESSION["Tipo_usuario"] == "administrador" and $_POST) {
    $propietario = __($_POST["propietario"]);
    $texto = __($_POST["texto"]);
    require "sources/Query.inc";
    $query = new Query();
    if ($query->insert("redaccion", "propietario, texto", "'{$propietario}', '{$texto}'")) {
        $respuesta = '
                    <img src="images/ok.png" width="100">
                    <h4>
                        Saludo registrado correctamente.
                    </h4>
                    ';
    } else {
        $respuesta = '
                    <img src="images/error.png" width="100">
                    <h4>
                        Ha ocurrido un error.
                    </h4>
                    ';
    }
    ?>
    <!DOCTYPE html>
    <html>
        <head>
    <?php 
    include 'sources/template/head.php';
    ?>
            <meta http-equiv="Refresh" content="2;url=consultarRedaccion.php" />
<?php

include 'Query.inc';
$query = new Query();
$admin = $query->insert("materia", "clave,nombre,semestre", "'" . $_POST['clave'] . "','" . $_POST['nombre'] . "','" . $_POST['semestre'] . "'");
if ($admin) {
    $regresar = false;
    echo ' <script language="javascript">alert("Registro Realizado Exitoxamente");</script> ';
    $regresar = true;
    if ($regresar) {
        header("location:materia.php");
    }
} else {
    echo ' <script language="javascript">alert("Error al registrar alumno");</script> ';
}
<?php

include 'Query.inc';
$query = new Query();
$admin = $query->insert("profesor", "rfc,nombre,apellidop,apellidom,telefono,password", "'" . $_POST['rfc'] . "','" . $_POST['nombre'] . "','" . $_POST['apellidop'] . "','" . $_POST['apellidom'] . "','" . $_POST['telefono'] . "','" . $_POST['password'] . "'");
if ($admin) {
    $regresar = false;
    echo ' <script language="javascript">alert("Registro Realizado Exitoxamente");</script> ';
    $regresar = true;
    if ($regresar) {
        header("location:profesor.php");
    }
} else {
    echo ' <script language="javascript">alert("Error al registrar alumno");</script> ';
}
Example #13
0
 function insert($data)
 {
     $instance = new Query($this);
     $instance->insert($data);
     return $instance;
 }
Example #14
0
function insert($objectname, $data)
{
    $query = new Query();
    return $query->insert($objectname, $data);
}
         }
         $res = $res . '</div>';
         $miArray = array("respuesta" => $res);
         echo json_encode($miArray);
     } else {
         $miArray = array("error" => "No existen transacciones en este momento.");
         echo json_encode($miArray);
     }
 } else {
     if ($_POST["saveNewUser"]) {
         $usu_pass = $_POST["usu_pass"];
         $employee_select = $_POST["employee_select"];
         $usu_email = $_POST["usu_email"];
         $usu_pass = $usu_pass . "#dolancy100291#";
         $query = new Query();
         if ($query->insert("user_credentials", "email, password, employeeid, status", "'" . sha1(limpiaEmail($usu_email)) . "', '" . sha1(__($usu_pass)) . "', {$employee_select}, 0", "")) {
             $employee = $query->select("concat(firstname,' ',lastname) as name, email, phone, address, type_employee", "employee", "employeeid = {$employee_select}", "", "obj");
             if (count($employee) == 1) {
                 foreach ($employee as $e) {
                     $tipo = "";
                     if ($em->type_employee == 0) {
                         $tipo = "Vendedor";
                     } else {
                         if ($em->type_employee == 1) {
                             $tipo = "Gerente";
                         } else {
                             if ($em->type_employee == 2) {
                                 $tipo = "Director";
                             }
                         }
                     }
Example #16
0
 function &save()
 {
     // This version creates the query on a per-call basis.
     // This is useful if some entries of an object to "update" haven't been loaded.
     // TODO:  Implement a version that caches the prepared statement in other cases.
     $update = false;
     $sql = "";
     $types = '';
     $params = array();
     /* Build up sql prepared statement and type string in parallel */
     foreach ($this->columns() as $column) {
         $name = $column->name();
         $value =& $this->values[$name];
         if ($value === null) {
             continue;
         }
         if ($column->ignored()) {
             continue;
         }
         if ($name == 'id') {
             $update = $value ? $value : false;
         } else {
             $params[] =& $column->toDB($value);
             $sql .= " `{$name}`=?,";
             $types .= $column->prepareCode();
         }
     }
     $sql = trim($sql, ',');
     $table = $this->table()->name();
     if (!$sql && $update !== false) {
         trigger_error("NO DATA IN DBRow update, table={$table},", E_USER_NOTICE);
         return;
     }
     if ($sql) {
         $sql = "set {$sql}";
     } else {
         $sql = "() values()";
     }
     if ($update === false) {
         $sql = "insert into `{$table}` {$sql}";
         $query = new Query($sql, $types);
         $id = $query->insert($params);
         $this->values['id'] = $id;
         return $id;
     } else {
         $sql = "update `{$table}` {$sql} where id=?";
         $params[] = $update;
         $types .= 'i';
         $query = new Query($sql, $types);
         $query->query($params);
     }
     return $this;
 }
Example #17
0
<?php

include "sources/funciones.php";
if ($_SESSION["Activa"] and $_SESSION["Tipo_usuario"] == "administrador" and $_POST) {
    $nombre = __($_POST["nombre"]);
    $mail = __($_POST['mail']);
    require "sources/Query.inc";
    $query = new Query();
    if ($query->insert("revisor", "nombre, correo", "'{$nombre}', '{$mail}'")) {
        $respuesta = '
                    <img src="images/ok.png" width="100">
                    <h4>
                        Revisor registrado correctamente.
                    </h4>
                    ';
    } else {
        $respuesta = '
                    <img src="images/error.png" width="100">
                    <h4>
                        Ha ocurrido un error.
                    </h4>
                    ';
    }
    ?>
    <!DOCTYPE html>
    <html>
        <head>
    <?php 
    include 'sources/template/head.php';
    ?>
            <meta http-equiv="Refresh" content="2;url=consultarRevisor.php" />
Example #18
0
function insertaRegistro()
{
    $nombre = __($_POST["nombre"]);
    $ap_pat = __($_POST["ap_pat"]);
    $ap_mat = __($_POST["ap_mat"]);
    $edad = $_POST["edad"];
    $telefono_casa = $_POST["telefono"];
    $idMunicipio = $_POST["municipio"];
    $sexo = $_POST["sexo"];
    $email = limpiaEmail($_POST["email"]);
    $idKoinonia = $_POST["koinonia"];
    if (empty($nombre)) {
        exit("<p>UPSS!!!. El campo <code><b>Nombre</b></code> est&aacute; vacio. Verif&iacute;calo</p>\n\t\t\t<br/>\n\t\t\t<b><a href='inscribir.php'>Regresar</a></b>");
    } else {
        if (empty($ap_pat)) {
            exit("<p>UPSS!!!. El campo <code><b>Apellido Paterno</b></code> est&aacute; vacio. Verif&iacute;calo</p>\n\t\t\t<br/>\n\t\t\t<b><a href='inscribir.php'>Regresar</a></b>");
        } else {
            if (empty($ap_mat)) {
                exit("<p>UPSS!!!. El campo <code><b>Apellido Materno</b></code> est&aacute; vacio. Verif&iacute;calo</p>\n\t\t\t<br/>\n\t\t\t<b><a href='inscribir.php'>Regresar</a></b>");
            } else {
                if (!esEmail($email)) {
                    exit("<p>UPSS!!!. El campo <code><b>E-Mail</b></code> debe ser v&aacute;lido. Verif&iacute;calo</p>\n\t\t\t<br/>\n\t\t\t<b><a href='inscribir.php'>Regresar</a></b>");
                } else {
                    if (empty($telefono_casa)) {
                        exit("<p>UPSS!!!. El campo <code><b>Tel&eacute;fono</b></code> est&aacute; vacio. Verif&iacute;calo</p>\n\t\t\t<br/>\n\t\t\t<b><a href='inscribir.php'>Regresar</a></b>");
                    } else {
                        if (empty($edad)) {
                            exit("<p>UPSS!!!. El campo <code><b>Edad</b></code> est&aacute; vacio. Verif&iacute;calo</p>\n\t\t\t<br/>\n\t\t\t<b><a href='inscribir.php'>Regresar</a></b>");
                        } else {
                            if (siExiste("email", "asistente", "email='{$email}'")) {
                                exit("<p>UPSS!!!. El campo <code><b>Email</b></code> ya est&aacute; registrado. Verif&iacute;calo</p>\n\t\t\t<br/>\n\t\t\t<b><a href='inscribir.php'>Regresar</a></b>");
                            } else {
                                if (empty($idKoinonia)) {
                                    exit("<p>UPSS!!!. El campo <code><b>Koinonia</b></code> est&aacute; vacio. Verif&iacute;calo</p>\n\t\t\t<br/>\n\t\t\t<b><a href='inscribir.php'>Regresar</a></b>");
                                } else {
                                    if (empty($idMunicipio)) {
                                        exit("<p>UPSS!!!. El campo <code><b>Municipio</b></code> est&aacute; vacio. Verif&iacute;calo</p>\n\t\t\t<br/>\n\t\t\t<b><a href='inscribir.php'>Regresar</a></b>");
                                    } else {
                                        //require ("Query.inc");  //Ya no lo necesita se agrego en la funcion siExiste||
                                        $query = new Query();
                                        if ($query->insert("asistente", "nombre, ap_pat, ap_mat, telefono_casa, idMunicipio, edad, email, sexo, idKoinonia", "'{$nombre}','{$ap_pat}','{$ap_mat}','{$telefono_casa}','{$idMunicipio}','{$edad}','{$email}','{$sexo}','{$idKoinonia}'")) {
                                            if (!$query->update("koinonia", "lugares_disponibles=(lugares_disponibles-1)", "id={$idKoinonia}")) {
                                                echo "<p>Error al asignar Koinon�a</p>";
                                            }
                                            echo "<h2>Datos insertados correctamente</h2>\n\t\t\t\t<br/>\n\t\t\t\t<br/>\n\t\t\t\t<h2>Gracias por inscribirte {$nombre}!</h2>\n\t\t\t\t<br/>\n\t\t\t\t<br/>\n\t\t\t\t<p><a href='paginaInscritos.php'>Ver todos los Inscritos</a></p>\n\t\t\t\t<br/>\n\t\t\t\t<h2><a href='inscribir.php'>Seguir Inscribiendo</a></h2>";
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
 protected function insert($sync = true)
 {
     $tname = static::tableName();
     $properties = $this->toArray();
     if (count($properties) < 1) {
         $properties[static::$primaryKey] = null;
     }
     $query = new Query($tname);
     $query->insert($tname, $properties);
     $pk = static::query($query, $query->params);
     // could return error;
     $this->id = $pk;
     if ($sync) {
         $this->sync();
     }
     return true;
 }
Example #20
0
<?php

include 'Query.inc';
$query = new Query();
$admin = $query->insert("alumno", "curp,nombre,apellidop,apellidom,telefono,password,direccion,turno", "'" . $_POST['curp'] . "','" . $_POST['nombre'] . "','" . $_POST['apellidop'] . "','" . $_POST['apellidom'] . "','" . $_POST['telefono'] . "','" . $_POST['password'] . "','" . $_POST['direccion'] . "','" . $_POST['turno'] . "'");
if ($admin) {
    $regresar = false;
    echo ' <script language="javascript">alert("Registro Realizado Exitoxamente");</script> ';
    $regresar = true;
    if ($regresar) {
        header("location:Registrousuarios.php");
    }
} else {
    echo ' <script language="javascript">alert("Error al registrar alumno");</script> ';
}
Example #21
0
<?php

include "sources/funciones.php";
if ($_SESSION["Activa"] and $_SESSION["Tipo_usuario"] == "administrador" and $_POST) {
    $usu = __(strtolower($_POST["usu"]));
    $pass = __($_POST["pass"]);
    $passEncriptado = sha1($pass);
    require "sources/Query.inc";
    $query = new Query();
    if ($query->insert("login", "usuario, password, tipoUsu", "'{$usu}', '{$passEncriptado}', 2")) {
        $respuesta = '
                    <img src="images/ok.png" width="100">
                    <h4>
                        Usuario registrado correctamente.
                    </h4>
                    ';
    } else {
        $respuesta = '
                    <img src="images/error.png" width="100">
                    <h4>
                        Ha ocurrido un error.
                    </h4>
                    ';
    }
    ?>
    <!DOCTYPE html>
    <html>
        <head>
    <?php 
    include 'sources/template/head.php';
    ?>
Example #22
0
    $fecha = __($_POST["fecha"]);
    $ciudadano = __($_POST["ciudadano"]);
    $asunto = __($_POST["asunto"]);
    $referencia = __($_POST["referencia"]);
    $folio = __($_POST["folio"]);
    $mailCiudadano = strtolower(__($_POST["mailCiudadano"]));
    $telCiudadano = __($_POST["telCiudadano"]);
    $conFirma = __($_POST["conFirma"]);
    $destinatario = __($_POST["destinatario"]);
    $redaccion = __($_POST["redaccion"]);
    $datosDestinatario = getDatosDestinatario($destinatario);
    $datosRedaccion = getDatosRedaccion($redaccion);
    $meses = array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre");
    require_once "sources/Query.inc";
    $query = new Query();
    if ($query->insert("oficio", "noOficio, anio, fecha, ciudadano, asunto, referencia, folio, mailCiudadano, telCiudadano, status", "'{$noOficio}', '{$anio}', '{$fecha}','{$ciudadano}', '{$asunto}','{$referencia}', '{$folio}','{$mailCiudadano}', '{$telCiudadano}', 2")) {
        $respuesta = "<center><h1><span>Agregado correctamente</span></h1></center>";
        $html = '
<style>
    td { 
        vertical-align: top; 
    }
    .tabla {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 15px;
        text-align: justify;
    }
    .tabla td {
        border-left: 0.1mm solid #000000;
        border-right: 0.1mm solid #000000;
        margin: 5px;
Example #23
0
 $v_redaccion = __($_POST['redaccion']);
 $cuerpoMail = '<p style="font-size: large;">
                 ' . $notificacionRespuesta['redaccionRespuestas'] . '
                 <br>
                 ' . $v_redaccion . '
             </p>
             <p style="text-align: center; font-weight: bold;">
                 <font style="font-size: larger;">Coordinación General de Atención Ciudadana</font><br>
                 Delegación SEP Estado de México
             </p>';
 $nom = "respuesta";
 $query2 = new Query();
 if ($mailOpcional != '') {
     $_FILES["imagen"]["name"];
     $archivoAdjunto = guardaArchivo("Respuestas", $nom);
     if ($query2->insert("respuesta", "fecha, asunto, redaccion, archivoAdjunto, oficio_idOficio", "now(), '{$v_asunto}', '{$v_redaccion}','{$archivoAdjunto}', {$vR_id}")) {
         require_once 'sources/AttachMailer.php';
         $mailer = new AttachMailer("*****@*****.**", "{$mail},{$mailOpcional}", "{$v_asunto}", "{$cuerpoMail}");
         $mailer->attachFile($archivoAdjunto);
         $res = $mailer->send() ? "OK" : "error";
         if ($res == "OK") {
             $query->update("oficio", "status=3", "idOficio={$vR_id}");
             $respuesta = '
                         <img src="images/ok.png" width="100">
                         <h4>
                           Respuesta enviada correctamente
                         </h4>
                         ';
         } else {
             $respuesta = '
                         <img src="images/error.png" width="100">
Example #24
0
<?php

include "sources/funciones.php";
if ($_SESSION["Activa"] and $_SESSION["Tipo_usuario"] == "administrador" and $_POST) {
    $Rn1 = __($_POST["Rn1"]);
    $Rn2 = __($_POST["Rn2"]);
    $Rn3 = __($_POST["Rn3"]);
    $Rn4 = __($_POST["Rn4"]);
    $Rn5 = __($_POST["Rn5"]);
    $mail = __($_POST["mail"]);
    require "sources/Query.inc";
    $query = new Query();
    if ($query->insert("dependencia", "titulo, nombre, puestoRn1, puestoRn2, rnPresente, correo", "'{$Rn1}', '{$Rn2}', '{$Rn3}', '{$Rn4}', '{$Rn5}', '{$mail}'")) {
        $respuesta = '
                    <img src="images/ok.png" width="100">
                    <h4>
                        Dependencia registrada correctamente.
                    </h4>
                    ';
    } else {
        $respuesta = '
                    <img src="images/error.png" width="100">
                    <h4>
                        Ha ocurrido un error.
                    </h4>
                    ';
    }
    ?>
    <!DOCTYPE html>
    <html>
        <head>
 /**
  * @param array $vales An associative array having [fieldName => value] pairs 
  * @param string $tableName Optional target table. If not given $this->tableName is used instead.
  *
  * @return bool The result
  */
 public function insert(array $values, $tableName = null)
 {
     if (!isset($tableName) && !isset($this->tableName)) {
         throw new \Exception("Table name is required.");
     } elseif (!isset($tableName)) {
         $tableName = $this->tableName;
     }
     $qry = Query::insert($tableName);
     // Try to use the module's metadata whenever available
     $fields = null;
     if (isset($this->metadata) && isset($this->metadata['fields']) && count($this->metadata['fields'])) {
         $fields = $this->metadata['fields'];
     }
     // Set values
     foreach (array_keys($values) as $key) {
         // Only pass fields that exist in the metadata.
         if (!isset($fields) || isset($fields) && isset($fields[$key])) {
             $qry->set($key, ":{$key}");
         }
     }
     $qst = $qry->toSql();
     if ($this->execute($qst, $values) === false) {
         return false;
     }
     return $this;
 }