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


PHP Connect类代码示例

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


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

示例1: usersReport

 public static function usersReport()
 {
     $conn = new Connect();
     $query = 'SELECT * FROM ' . self::DB_TBL_USUARIOS;
     $consult = $conn->prepare($query);
     $consult->execute();
     if ($consult->rowCount() > 0) {
         header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
         header('Content-Disposition: attachment;filename="Reporte de usuarios.xlsx"');
         header('Cache-Control: max-age=0');
         $reportName = "Reporte de usuarios";
         $reportNameTitles = array("Id", "Cédula", "Nombres", "Apellidos", "Email", "Teléfono", "Extensión", "Usuario", "Contrasena", "Rol");
         $styleColumnsTitle = array('font' => array('name' => 'Arial', 'bold' => true));
         $generarReporteXLSX = new PHPExcel();
         $generarReporteXLSX->getProperties()->setCreator("VideoConferencias UTPL")->setLastModifiedBy("VideoConferencias UTPL")->setTitle("Reporte de usuarios")->setSubject("Reporte de usuarios")->setDescription("Reporte de usuarios")->setKeywords("Reporte de usuarios")->setCategory("Reportes");
         $generarReporteXLSX->setActiveSheetIndex(0)->mergeCells('A1:J1');
         $generarReporteXLSX->setActiveSheetIndex(0)->setCellValue('A1', $reportName)->setCellValue('A3', $reportNameTitles[0])->setCellValue('B3', $reportNameTitles[1])->setCellValue('C3', $reportNameTitles[2])->setCellValue('D3', $reportNameTitles[3])->setCellValue('E3', $reportNameTitles[4])->setCellValue('F3', $reportNameTitles[5])->setCellValue('G3', $reportNameTitles[6])->setCellValue('H3', $reportNameTitles[7])->setCellValue('I3', $reportNameTitles[8])->setCellValue('J3', $reportNameTitles[9]);
         $i = 4;
         while ($row = $consult->fetch()) {
             $generarReporteXLSX->setActiveSheetIndex(0)->setCellValue('A' . $i, $row['id'])->setCellValue('B' . $i, $row['cedula'])->setCellValue('C' . $i, $row['nombres'])->setCellValue('D' . $i, $row['apellidos'])->setCellValue('E' . $i, $row['email'])->setCellValue('F' . $i, $row['telefono'])->setCellValue('G' . $i, $row['telefono_ext'])->setCellValue('H' . $i, $row['usuario'])->setCellValue('I' . $i, $row['contrasena'])->setCellValue('J' . $i, $row['id_rol']);
             $i++;
         }
         $generarReporteXLSX->getActiveSheet()->getStyle('A3:J3')->applyFromArray($styleColumnsTitle);
         $generarReporteXLSX->getActiveSheet()->setTitle('Usuarios');
         $generarReporteXLSX->setActiveSheetIndex(0);
         $generarReporteXLSX->getActiveSheet(0)->freezePaneByColumnAndRow(0, 4);
         $objWriter = PHPExcel_IOFactory::createWriter($generarReporteXLSX, 'Excel2007');
         $objWriter->save('php://output');
         exit;
     }
 }
开发者ID:racorrea,项目名称:ReservaVideoconferencias,代码行数:31,代码来源:ModReportsFunctions.php

示例2: login

 public static function login($usu_usuario, $usu_contrasena)
 {
     $conn = new Connect();
     $u = new Utils();
     $query = 'SELECT * FROM ' . self::DB_TBL_USUARIO . ' WHERE usu_usuario = :usu_usuario';
     $consult = $conn->prepare($query);
     $consult->bindParam(':usu_usuario', $usu_usuario);
     $consult->execute();
     $row = $consult->fetch();
     if ($consult->rowCount() > 0) {
         $passValidate = $u->passValidate($usu_contrasena, $row['usu_contrasena']);
         if ($passValidate == true) {
             if ($row['usu_id_rol'] == 1) {
                 session_start();
                 $_SESSION['session'] = $row['usu_usuario'];
                 echo "<script>location.href='../../mod_admin/vista/administrador.php'</script>";
             } else {
                 session_start();
                 $_SESSION['session'] = $row['usu_usuario'];
                 echo "<script>location.href='../../mod_admin/vista/tecnico.php'</script>";
             }
         } else {
             echo "<script>alert('Error de autenticación. Por favor verifique sus credenciales de acceso.')</script>";
             echo "<script>location.href = '../vista/form_login.php' </script>";
             return false;
         }
     } else {
         echo "<script>alert('Error de autenticación.')</script>";
         echo "<script>location.href = '../vista/form_login.php' </script>";
         return false;
     }
 }
开发者ID:racorrea,项目名称:ReservaVideoconferencias,代码行数:32,代码来源:AuthModel.php

示例3: __construct

 function __construct()
 {
     $variables = new Variables();
     $connect = new Connect($variables->dbHost, $variables->dbUser, $variables->dbPassword, $variables->dbName);
     $result;
     //receinving and striping the variables
     $this->userMatricula = $connect->antiInjection(isset($_POST["tfMatricula"]) ? $_POST["tfMatricula"] : NULL);
     $this->password = $connect->antiInjection(isset($_POST["tfPassword"]) ? $_POST["tfPassword"] : NULL);
     $this->select = $connect->antiInjection(isset($_POST["slSelect"]) ? $_POST["slSelect"] : NULL);
     if (!$connect->start()) {
         echo "Impossible to start connection in Sigin.";
     }
     //encoding to md5 hash
     $this->password = base64_encode($this->password);
     if (!($result = $connect->execute("SELECT * FROM Cadastros c INNER JOIN Folhas f ON c.codigo_fol = f.codigo_fol WHERE c.matricula = '{$this->userMatricula}' AND c.senha = '{$this->password}' AND f.codigo_fol = '{$this->select}'"))) {
         echo "Impossible to execute MySQL query.";
     }
     if ($connect->counterResult($result) > 0) {
         $result = $connect->execute("SELECT * FROM Pessoal WHERE matricula = '{$this->userMatricula}'");
         $row = mysql_fetch_assoc($result);
         $_SESSION["user"] = $this->userMatricula;
         $_SESSION["userPass"] = $this->password;
         $_SESSION["nome"] = $row["nome"];
         $connect->close();
         header("Location: ../index.php?ok=true");
         die;
     }
     $connect->close();
     header("Location: ../index.php?ok=false");
     die;
 }
开发者ID:GolfinhoPvP,项目名称:lokorez,代码行数:31,代码来源:UserLogin.class.php

示例4: PasstoParse

function PasstoParse($targetid, $notification)
{
    $connection = new Connect();
    $connectinfo = $connection->GetConnection();
    $name = $connection->GetNamebyId($connectinfo, $targetid, 0);
    //echo '<p>Directed to: '.$name.' - '. $notification . '</p>';
}
开发者ID:96imranahmed,项目名称:Eventory,代码行数:7,代码来源:notification_create.php

示例5: __construct

 function __construct()
 {
     foreach ($_POST as $fieldName => $value) {
         $comand = "\$" . $fieldName . "='" . $value . "';";
         eval($comand);
     }
     $DB;
     //seting up the matrix of datas
     for ($x = 0; $x < $numRows; $x++) {
         for ($y = 0; $y < $numFields; $y++) {
             $str = "tf{$x}{$y}";
             eval("\$aux = \"\${$str}\";");
             $DB[$x][$y] = $aux;
         }
     }
     //by security, it conts the amount of rows to update
     $loopForUpdate = 0;
     for ($x = 0; $x < $numRows; $x++) {
         if ($DB[$x][0] == NULL) {
             continue;
         }
         $loopForUpdate++;
     }
     //starting the data base
     $variables = new Variables();
     $MySQLconnect = new Connect($variables->dbHost, $variables->dbUser, $variables->dbPassword, $variables->dbName);
     //it conts the amount of rows it was updated
     $uptCont = 0;
     if (!$MySQLconnect->start()) {
         echo "Impossible to star connection in Handler.";
     }
     for ($x = 0; $x < $numRows; $x++) {
         if ($DB[$x][0] == NULL) {
             continue;
         }
         switch ($tableId) {
             case "dcr":
                 $aux = "UPDATE Cargos SET descricao_cargo = '" . $DB[$x][1] . "', tipo='" . $DB[$x][2] . "', vencimento=" . $DB[$x][3] . " WHERE cargo='" . $DB[$x][0] . "'";
                 break;
             case "dlt":
                 $aux = "UPDATE Lotacoes SET descricao_lotacao = '" . $this->DB[$x][1] . "', secretaria = '" . $this->DB[$x][2] . "' WHERE lotacao='" . $this->DB[$x][0] . "'";
                 break;
             case "especial":
                 $aux = "UPDATE Especialidades SET descricao_especialidade = '" . $this->DB[$x][1] . "', cargo = '" . $this->DB[$x][2] . "' WHERE codigo_esp='" . $this->DB[$x][0] . "'";
                 break;
             case "eventos":
                 $aux = "UPDATE Eventos SET descricao_evento='" . $this->DB[$x][1] . "', IRRF='" . $this->DB[$x][2] . "', IPMT='" . $this->DB[$x][3] . "', FAL='" . $this->DB[$x][4] . "', FIXO='" . $this->DB[$x][5] . "', TEMP='" . $this->DB[$x][6] . "', valor_eve=" . $this->DB[$x][7] . ", GRAT='" . $this->DB[$x][8] . "', FGTS='" . $this->DB[$x][9] . "', desconto=" . $this->DB[$x][10] . ", nivel_eve='" . $this->DB[$x][11] . "', INSS='" . $this->DB[$x][12] . "' WHERE codigo_eve='" . $this->DB[$x][0] . "'";
                 break;
         }
         if ($MySQLconnect->execute($aux)) {
             $uptCont++;
         }
     }
     $MySQLconnect->close();
     if ($uptCont == $loopForUpdate) {
         header("Location: ../importDocuments.php?upl=true&tab={$tableId}");
     } else {
         header("Location: ../importDocuments.php?upl=false&tab={$tableId}");
     }
 }
开发者ID:GolfinhoPvP,项目名称:lokorez,代码行数:60,代码来源:Updater.class.php

示例6: sendGCMMessage

 public static function sendGCMMessage($title, $msg, $eventoId, $disciplina)
 {
     include "../webservice/connection/Connect.php";
     $db = new Connect();
     $connection = $db->connect();
     //$acao = $_POST['acao'];
     // if ($acao == "enviar") {
     $jsonArray = array();
     $sql = $connection->prepare("SELECT app_dispositivo.registration_id FROM henriqueweb.app_dispositivo");
     $sql->execute();
     if ($sql->rowCount() > 0) {
         while ($tmp = $sql->fetch()) {
             $jsonArray[] = $tmp["registration_id"];
         }
     }
     //$mensagem = $_POST["mensagem"];
     //$eventoId = $_POST["eventoId"];
     $url = "https://gcm-http.googleapis.com/gcm/send";
     $apiKey = "AIzaSyD4-EStQ8w7G8FP2plyIkIOJ10LljchUpw";
     $ch = curl_init($url);
     $jsonData = array("registration_ids" => $jsonArray, "data" => array("type" => "evento", "title" => $title, "disciplina" => $disciplina, "eventoId" => $eventoId, "mensagem" => $msg));
     $jsonDataEncoded = json_encode($jsonData);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: key=" . $apiKey));
     $result = curl_exec($ch);
     //}
 }
开发者ID:luizhsda10,项目名称:UFMSApp,代码行数:28,代码来源:GCMHandler.php

示例7: accept

 public function accept()
 {
     $add = 'INSERT INTO const(name,value)VALUES("' . $_POST['name'] . '","' . $_POST['value'] . '");';
     $con = new Connect('localhost', 'mysql', 'mysql');
     $con->qur('use proto01;');
     $con->ins($add);
     header('Location: http://localhost/admin/sittings');
 }
开发者ID:raa07,项目名称:engine,代码行数:8,代码来源:model.php

示例8: getAllConfirmReserves

 public static function getAllConfirmReserves()
 {
     $conn = new Connect();
     $query = 'SELECT * ' . 'FROM reserva RE, res_fecha FE, confirmacion_reserva CON, con_imagen IMA, con_canal CAN ' . 'WHERE RE.res_estado = 1 ' . 'AND FE.fe_id_reserva = RE.res_id ' . 'AND con.con_id_reserva = RE.res_id ' . 'AND IMA.con_id = CON.con_id_imagen ' . 'AND CAN.can_id = CON.con_id_canal ' . 'ORDER BY FE.start ASC ' . 'LIMIT 4';
     $consult = $conn->prepare($query);
     $consult->execute();
     $row = $consult->fetchAll(PDO::FETCH_ASSOC);
     return json_encode($row, JSON_UNESCAPED_UNICODE);
 }
开发者ID:racorrea,项目名称:ReservaVideoconferencias,代码行数:9,代码来源:ws_functions.php

示例9: insert

 public function insert($dataBase, $table, $insertArray)
 {
     $db = new Connect($dataBase, $table);
     $connectInsert = $db->implodeInsertedData($insertArray);
     $keyParam = $connectInsert[0];
     $valueParam = $connectInsert[1];
     $connect = $db->connect->prepare("INSERT INTO\n                                          {$table}" . " (" . $keyParam . ")\n\t\t\t\t\t\t\t\t\t\t  VALUES(" . $valueParam . ")");
     $connect->execute($insertArray);
 }
开发者ID:HristoGeorgiev12,项目名称:OnlineChat,代码行数:9,代码来源:Template.class.php

示例10: getAllUsersById

 public static function getAllUsersById($id)
 {
     $conn = new Connect();
     $query = 'SELECT * FROM usuarios WHERE id=:id';
     $consult = $conn->prepare($query);
     $consult->bindParam(":id", $id);
     $consult->execute();
     $row = $consult->fetchAll(PDO::FETCH_ASSOC);
     return json_encode($row, JSON_UNESCAPED_UNICODE);
 }
开发者ID:racorrea,项目名称:WS-PHP,代码行数:10,代码来源:ws_functions.php

示例11: drop

 public function drop()
 {
     $con = new Connect('localhost', 'mysql', 'mysql');
     $con->qur('drop database proto01;');
     if ($con) {
         $this->res = 'droped';
     } else {
         $this->res = 'error drop';
     }
 }
开发者ID:raa07,项目名称:engine,代码行数:10,代码来源:model.php

示例12: getDataSP

 public function getDataSP($flag, $criterio = '', $page = 1, $regxpag = 10)
 {
     $DB = new Connect();
     $sql = "CALL dataGrid('" . $flag . "','" . $criterio . "','" . $page . "','" . $regxpag . "')";
     // ejecutamos
     $data = $DB->query($sql);
     $result = $data->fetchAll(PDO::FETCH_ASSOC);
     // que sea un array asociativo
     return $result;
 }
开发者ID:pablotebb,项目名称:RDDatagrid,代码行数:10,代码来源:ConsultarData.php

示例13: __construct

 public function __construct()
 {
     $db = new Connect();
     $act = $db->query("SELECT ultima_act FROM generales LIMIT 1;");
     $actualizacion = $db->recorrer($act);
     if (time() >= $actualizacion[0]) {
         $tops = $db->query("SELECT id,puntos FROM usuarios ORDER by puntos DESC;");
         $tope = 1;
         $psql = "UPDATE usuarios SET top = ? WHERE id = ? LIMIT 1;";
         $prepare_query = $db->prepare($psql);
         $prepare_query->bind_param('ii', $nuevo_top, $id_user);
         while ($top = $db->recorrer($tops)) {
             $nuevo_top = $tope++;
             $id_user = $top['id'];
             $prepare_query->execute();
         }
         $timer = time() + 30;
         $query = $db->query("UPDATE generales SET ultima_act='{$timer}' LIMIT 1;");
         $prepare_query->close();
         unset($actualizar, $tops, $timer, $tope, $query);
     } else {
         unset($actualizacion);
     }
     $db->liberar($act);
     $db->close();
 }
开发者ID:Nykus,项目名称:xnova,代码行数:26,代码来源:class.UpdateStats.php

示例14: __construct

 function __construct()
 {
     $variables = new Variables();
     $connect = new Connect($variables->dbHost, $variables->dbUser, $variables->dbPassword, $variables->dbName);
     //receinving and striping the variables
     $this->nivel = $connect->antiInjection(isset($_POST["slNivel"]) ? $_POST["slNivel"] : NULL);
     $this->userName = $connect->antiInjection(isset($_POST["tfUserName"]) ? $_POST["tfUserName"] : NULL);
     $this->password = $connect->antiInjection(isset($_POST["tfPassword"]) ? $_POST["tfPassword"] : NULL);
     $this->password2 = $connect->antiInjection(isset($_POST["tfPassword2"]) ? $_POST["tfPassword2"] : NULL);
     if ($this->password != $this->password2) {
         header("Location: ../importDocuments.php?sigin=false");
         die;
     }
     if (!$connect->start()) {
         echo "Impossible to star connection in Sigin.";
     }
     //encoding to md5 hash
     $this->password = md5($this->password);
     if (!$connect->execute("INSERT INTO Administradores (id_nivel, usuario, senha) VALUES ({$this->nivel}, '{$this->userName}', '{$this->password}')")) {
         echo "Impossible to execute MySQL query.";
     }
     if ($connect->counterAffected() > 0) {
         header("Location: ../importDocuments.php?sigin=true");
     } else {
         header("Location: ../importDocuments.php?sigin=false");
     }
     $connect->close();
     die;
 }
开发者ID:GolfinhoPvP,项目名称:lokorez,代码行数:29,代码来源:Sigin.class.php

示例15: run

 public static function run()
 {
     $select = 'SELECT * FROM const ORDER BY id DESC;';
     $con = new Connect('localhost', 'mysql', 'mysql');
     $con->qur('use proto01;');
     $con = $con->prepare($select);
     $con->execute();
     foreach ($con->fetchAll(PDO::FETCH_ASSOC) as $res) {
         define($res['name'], $res["value"]);
     }
 }
开发者ID:raa07,项目名称:engine,代码行数:11,代码来源:def.php


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