Beispiel #1
0
 function attach_Image($fileDirectory)
 {
     $Mysql = new Mysql();
     $uploadCheck = 1;
     $imageFileType = pathinfo($fileDirectory, PATHINFO_EXTENSION);
     //checks if image
     if (isset($_POST["submit"])) {
         $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
         if ($check !== false) {
             $uploadCheck = 1;
         } else {
             return "File is not an image.";
             $uploadCheck = 0;
         }
         //check if image already exisits
         if (file_exists($fileDirectory)) {
             return "Sorry, file already exists.";
             $uploadCheck = 0;
         }
     }
     //check
     if ($uploadCheck == 0) {
         return "There was a problem uploading your file.";
     } else {
         if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $fileDirectory)) {
             $Mysql->attach_Image_To_Account("/userImages/" . basename($_FILES["fileToUpload"]["name"]));
             return "The file " . basename($_FILES["fileToUpload"]["name"]) . " has been uploaded.";
         } else {
             return "Sorry, there was an error uploading your file.";
         }
     }
 }
Beispiel #2
0
 public function testGetConnectionInactive()
 {
     $config = ['host' => 'localhost', 'active' => false];
     $object = new Mysql($this->string, $this->dateTime, $config);
     $logger = $this->getMockForAbstractClass('Magento\\Framework\\DB\\LoggerInterface');
     $this->assertNull($object->getConnection($logger));
 }
Beispiel #3
0
function buildPage()
{
    global $mysql;
    $MySQLConnection = new Mysql($mysql['host'], $mysql['port'], $mysql['user'], $mysql['password'], $mysql['database']);
    $MySQLConnection->connect();
    if ($result = $MySQLConnection->getQuery('SELECT x.matchID AS matchID, x.matchDate AS matchDate, y.teamName AS matchHomeTeam, y.teamLogo AS matchHomeTeamLogo, z.teamName AS matchForeignTeam, z.teamLogo AS matchForeignTeamLogo FROM matches AS x JOIN teams AS y ON y.teamID = matchHomeTeam JOIN teams AS z ON z.teamID = matchForeignTeam;')) {
        while ($row = mysqli_fetch_assoc($result)) {
            $userTips = getUserTips($MySQLConnection, $row["matchID"]);
            echo '
						<div class="panel panel-default">
							<form id="match_' . $row["matchID"] . '" method="POST">
								<div class="panel-body">
									<div class="panel-heading">' . $row["matchHomeTeam"] . ' vs. ' . $row["matchForeignTeam"] . '</div>
									<div class="input-group">
									 	<label>' . $row["matchHomeTeam"] . '</label>
									 	<input type="number"min="0"value="' . $userTips["tipScoreHome"] . '" name="ScoreHome" id="ScoreHome"  required/>
									 </div>
									<div class="input-group">
									 	<label>' . $row["matchForeignTeam"] . '</label>
									 	<input type="number"min="0" value="' . $userTips["tipScoreForeign"] . '" name="ScoreForeign" id="ScoreForeign" required/>
									 	<input type="button" value="Place Tip" onclick="placeTip(' . $row["matchID"] . ');"/>
									</div>
								</div>
							</form>
						</div>
					';
        }
    }
}
Beispiel #4
0
 public static function mantenimientoDirectorio(EntidadDirectorio $objDirectorioEntidad, array $param)
 {
     $query = NULL;
     $query2 = NULL;
     $error = NULL;
     $objMysql = new Mysql();
     $objMysql1 = new Mysql();
     if ($param[0] == 'DEL') {
         $query2 = "select count(*) as 'cantidad' from cms_directorio where idcontenedor='" . $objDirectorioEntidad->getIdDirectorio() . "'";
         $res_verificar = $objMysql1->ejecutar($query2);
         $reg = $res_verificar->fetch(PDO::FETCH_ASSOC);
         if ($reg['cantidad'] != 0) {
             $error = 2;
         } else {
             $objMysql = new Mysql();
             try {
                 $query = "CALL sp_mnt_directorio('" . $param[0] . "','" . $objDirectorioEntidad->getIdDirectorio() . "','" . $objDirectorioEntidad->getNombre() . "','" . $objDirectorioEntidad->getNivel() . "','" . $objDirectorioEntidad->getPosicion() . "','" . $objDirectorioEntidad->getContenido() . "','" . $objDirectorioEntidad->getIdpagina() . "','" . $objDirectorioEntidad->getRuta() . "','" . $objDirectorioEntidad->getIdcontenedor() . "','" . $objDirectorioEntidad->getAbrir() . "','" . $objDirectorioEntidad->getMostrar() . "','" . $objDirectorioEntidad->getEliminado() . "');";
                 $rs = $objMysql->ejecutar($query);
                 $error = 1;
             } catch (PDOException $exc) {
                 $error = 0;
             }
         }
     } else {
         try {
             $query = "CALL sp_mnt_directorio('" . $param[0] . "','" . $objDirectorioEntidad->getIdDirectorio() . "','" . $objDirectorioEntidad->getNombre() . "','" . $objDirectorioEntidad->getNivel() . "','" . $objDirectorioEntidad->getPosicion() . "','" . $objDirectorioEntidad->getContenido() . "','" . $objDirectorioEntidad->getIdpagina() . "','" . $objDirectorioEntidad->getRuta() . "','" . $objDirectorioEntidad->getIdcontenedor() . "','" . $objDirectorioEntidad->getAbrir() . "','" . $objDirectorioEntidad->getMostrar() . "','" . $objDirectorioEntidad->getEliminado() . "');";
             $rs = $objMysql->ejecutar($query);
             $error = 1;
         } catch (PDOException $exc) {
             $error = 0;
         }
     }
     return $error;
 }
Beispiel #5
0
 public static function removeProduct($barcode, $expiration)
 {
     $mysql = new Mysql();
     $update = $mysql->update("delete from product where barcode='{$barcode}' and expiration='{$expiration}'");
     $mysql->closeConnection();
     return $update;
 }
 function login()
 {
     require 'Conn/Redirect.php';
     $redirect = new Redirect();
     if (isset($_POST["name"]) && isset($_POST["pwd"])) {
         $name = $_POST["name"];
         $pwd = md5($_POST["pwd"]);
         require_once 'Conn/Mysql.php';
         $mysql = new Mysql();
         $mysql->query("select * from users where name ='{$name}';");
         $row = $mysql->get_object();
         if (isset($row)) {
             if ($row->pwd == $pwd) {
                 session_start();
                 $_SESSION['user'] = $name;
                 $redirect->go('index.php');
             } else {
                 $error = "密码错误!";
                 $redirect->go('index.php?page=login');
             }
         } else {
             $error = "用户名不存在!";
             $redirect->go('index.php?page=login');
         }
     } else {
         $error = "用户名或密码不能为空!";
         $redirect->go('index.php?page=login');
     }
 }
Beispiel #7
0
function buildPage()
{
    global $mysql;
    $MySQLConnection = new Mysql($mysql['host'], $mysql['port'], $mysql['user'], $mysql['password'], $mysql['database']);
    $MySQLConnection->connect();
    if ($result = $MySQLConnection->getQuery('SELECT * FROM users JOIN countries ON	userCountry = iso3166 WHERE userID = ' . $_GET["userID"] . ';')) {
        while ($row = mysqli_fetch_assoc($result)) {
            echo '
				 	<div class="col-md-2">
					 	<div class="panel panel-default">
							<div class="panel-heading">' . $row["userLogin"] . '</div>
							<div class="panel-body">
								<div class="media">
									<div class="media-left">
										<a href="img/avatar/' . $row["userAvatar"] . '">
											<img class="media-object" src="img/avatar/' . $row["userAvatar"] . '" />
										</a>
									</div>
								</div>
								<p><b>First Name: </b>' . $row["userFirstName"] . '</p>
								<p><b>Last Name: </b>' . $row["userLastName"] . '</p>
							</div>
						</div>
					</div>
				 ';
        }
    }
}
Beispiel #8
0
 public function getList($search)
 {
     $mysql = new Mysql();
     $PageSize = intval($search->PageSize);
     $FirstRow = intval($search->PageIndex - 1) * $PageSize;
     $sqlList = "select Subject,Url from project where (Status=6 or Status=7) and Type=" . intval($this->Type) . " order by Pv desc LIMIT {$FirstRow}, {$PageSize};";
     $sqlCount = "select count(Id) from project where (Status=6 or Status=7) and Type=" . intval($this->Type);
     $res = array();
     if ($search->NeedCount) {
         // 查找 count 和 数据
         $totalCount = $mysql->getVar($sqlCount);
         if (empty($totalCount)) {
             $res["Success"] = true;
             $res["Data"] = null;
             $res["Count"] = 0;
         } else {
             $res["Success"] = true;
             $res["Data"] = $mysql->getData($sqlList);
             $res["Count"] = $totalCount;
         }
     } else {
         // 只查找数据
         $res["Success"] = true;
         $res["Data"] = $mysql->getData($sqlList);
     }
     $mysql->closeDb();
     return $res;
 }
Beispiel #9
0
function buildPage()
{
    global $mysql;
    $MySQLConnection = new Mysql($mysql['host'], $mysql['port'], $mysql['user'], $mysql['password'], $mysql['database']);
    $MySQLConnection->connect();
    if ($result = $MySQLConnection->getQuery('SELECT messageID, messageRecipient, messageSender, messageTime, messageSubject, messageBody, userLogin, userID FROM messages JOIN users ON  messageSender = userID WHERE messageRecipient = ' . $_SESSION["userID"] . ' LIMIT 0,25;')) {
        echo '
					<div class="col-md-2">
				';
        while ($row = mysqli_fetch_object($result)) {
            $messageJSON = (string) json_encode($row);
            echo '
						<div class="list-group">
							<a href="#" onclick="displayMessage(\'' . $row->messageID . '\');"" class="list-group-item">
								<p class="list-group-item-text">' . $row->messageTime . ' - ' . $row->userLogin . '</p>
								<h4 class="list-group-item-heading">' . $row->messageSubject . '</h4>
							</a>
						</div>
					';
        }
        echo '</div>';
    } else {
        echo '<script type="text/javascript">', 'printError(\'Error while getting your messages!\')', '</script>';
    }
}
Beispiel #10
0
 public function getUserByProjectId($projectId)
 {
     $mysql = new Mysql();
     $sql = "SELECT GROUP_CONCAT(DISTINCT result.UserId) as Ids ,GROUP_CONCAT(DISTINCT result.name) as Names FROM (SELECT d.UserId,u.Name FROM " . $mysql->dbpre . "developer" . $mysql->debug . " as d ," . $mysql->dbpre . "user" . $mysql->debug . " as u WHERE d.UserId=u.UserId and ProjectId=" . intval($projectId) . " ) as result";
     //echo $sql;
     $result = $mysql->getLine($sql);
     $mysql->closeDb();
     return $result;
 }
 /**
  * Add main response fields.
  *
  * @param Mysql $query
  */
 protected function setResponseData(Mysql $query)
 {
     $query_rows = clone $query;
     $this->setResponse('total_items', $query_rows->nolimit()->nogroupby()->noorderby()->count()->get()->counter());
     //$this->setResponse('total_items', $query_rows->nolimit()->noorderby()->get()->count());
     $this->setResponse('cur_page', $this->cur_page);
     $this->setResponse('selected_item', $this->selected_item);
     $this->setResponse('data', $query->get()->all());
 }
Beispiel #12
0
 function createUser($un, $pwd)
 {
     $mysql = new Mysql();
     $createCredentials = $mysql->createUsernameandPass($un, md5($pwd));
     if ($createCredentials) {
         header("location: login.php");
     } else {
         return 1;
     }
 }
Beispiel #13
0
 public function getList($projectId)
 {
     $mysql = new Mysql();
     $sql = "SELECT m.*,u.Name FROM " . $mysql->dbpre . "memo" . $mysql->debug . " as m," . $mysql->dbpre . "user" . $mysql->debug . " as u WHERE m.UserId=u.UserId AND ProjectId=" . intval($projectId);
     // var_dump( $sql );
     // exit;
     $result = $mysql->getData($sql);
     $mysql->closeDb();
     return $result;
 }
Beispiel #14
0
 public static function kill()
 {
     $mysql_name = env('container') . '_mysql';
     $mysql = new Mysql($mysql_name);
     $mysql->kill();
     $web_name = basename(self::getProjectDir());
     $web_name .= '_web';
     $web = new Web($web_name);
     $web->kill();
 }
Beispiel #15
0
 function validate_user($un, $pwd)
 {
     $mysql = new Mysql();
     $ensure_credentials = $mysql->verify_Username_and_Pass($un, md5($pwd));
     if ($ensure_credentials) {
         $_SESSION['status'] = 'authorized';
         header("location: index2.php");
     } else {
         return "Benutzername und Passwort nicht korrekt!";
     }
 }
Beispiel #16
0
 function validate_user($un, $pwd)
 {
     $mysql = new Mysql();
     $ensure_credentials = $mysql->verify_Username_and_Pass($un, md5($pwd));
     if ($ensure_credentials) {
         $_SESSION['status'] = 'authorized';
         header('location: index.php');
     } else {
         return "Please enter a correct username and password";
     }
 }
Beispiel #17
0
 public static function getClient($email, $password)
 {
     $mysql = new Mysql();
     $response = $mysql->query("select * from client where email='{$email}' and password=PASSWORD('{$password}')");
     $mysql->closeConnection();
     if ($response == false) {
         return false;
     }
     $response = mysql_fetch_assoc($response);
     $client = new Client($response['name'], $response['surname'], $response['email'], $response['password']);
     return $client;
 }
function printCountrySelect()
{
    global $mysql;
    $MySQLConnection = new Mysql($mysql['host'], $mysql['port'], $mysql['user'], $mysql['password'], $mysql['database']);
    $MySQLConnection->connect();
    $result = $MySQLConnection->getQuery('SELECT * FROM countries;');
    echo '<select id="userCountry" name="userCountry"><option value="">---NO COUNTRY SELECTED---</option>';
    while ($row = mysqli_fetch_assoc($result)) {
        echo '<option value="' . $row["iso3166"] . '">' . $row["countryName"] . '</option>';
    }
    echo '</select>';
}
Beispiel #19
0
 function __construct($name = '')
 {
     static $db;
     if (!is_object($db)) {
         $db = new Mysql();
     }
     if ($name) {
         $this->tablename = $name;
     } else {
         $this->tablename = MODEL_NAME;
     }
     $this->db = $db->t($this->tablename);
 }
Beispiel #20
0
 public static function mantenimientoPopup(EntidadPopup $objPopupEntidad, array $param)
 {
     $query = NULL;
     $error = NULL;
     $objcons = new Mysql();
     try {
         $query = "CALL SP_MNT_POPUP('" . $param[0] . "',\n                                           '" . $objPopupEntidad->getIdpopup() . "',\n                                           '" . $objPopupEntidad->getNom() . "',    \n                                           '" . $objPopupEntidad->getImg() . "',    \n                                           '" . $objPopupEntidad->getAncho() . "',    \n                                           '" . $objPopupEntidad->getAlto() . "',        \n                                           '" . $objPopupEntidad->getResizable() . "',\n                                           '" . $objPopupEntidad->getPosition() . "', \n                                           '" . $objPopupEntidad->getEnlace() . "',\n                                           '" . $objPopupEntidad->getUrl() . "',\n                                           '" . $objPopupEntidad->getAbrir() . "',    \n                                           '" . $objPopupEntidad->getSwactivo() . "');";
         $rs = $objcons->ejecutar($query);
         $error = 1;
     } catch (PDOException $exc) {
         $error = 0;
     }
     return $error;
 }
Beispiel #21
0
 public static function mantenimientoServicio(EntidadServicio $objServicio, array $param)
 {
     $query = NULL;
     $error = NULL;
     $objMysql = new Mysql();
     try {
         $query = "CALL sp_mnt_servicio('" . $param[0] . "',\n                                           '" . $objServicio->getIdservicio() . "',\n                                           '" . $objServicio->getDescripcion() . "',\n                                           '" . $objServicio->getFoto() . "',    \n                                           '" . $objServicio->getFotochico() . "',        \n                                           '" . $objServicio->getEliminado() . "',\n                                           '" . $objServicio->getUrl() . "');";
         $rs = $objMysql->ejecutar($query);
         $error = 1;
     } catch (PDOException $exc) {
         $error = 0;
     }
     return $error;
 }
Beispiel #22
0
 public static function mantenimientoBanner(EntidadBannerInterior $objBannerEntidad, array $param)
 {
     $query = NULL;
     $error = NULL;
     $objMysql = new Mysql();
     try {
         $query = "CALL sp_mnt_bannerinterno('" . $param[0] . "',\n                                           '" . $objBannerEntidad->getIdbannerinterior() . "',\n                                           '" . $objBannerEntidad->getDescripcion() . "',\n                                           '" . $objBannerEntidad->getFoto() . "',    \n                                           '" . $objBannerEntidad->getFotochico() . "',        \n                                           '" . $objBannerEntidad->getEliminado() . "',\n                                           '" . $objBannerEntidad->getUrl() . "');";
         $rs = $objMysql->ejecutar($query);
         $error = 1;
     } catch (PDOException $exc) {
         $error = 0;
     }
     return $error;
 }
Beispiel #23
0
 public static function mantenimientoConvocatoria(EntidadConvocatoria $objBannerConvocatoria, array $param)
 {
     $query = NULL;
     $error = NULL;
     $objMysql = new Mysql();
     try {
         $query = "CALL sp_mnt_convocatoria('" . $param[0] . "',\n                                           '" . $objBannerConvocatoria->getIdconvocatoria() . "',\n                                           '" . $objBannerConvocatoria->getDescripcion() . "',    \n                                           '" . $objBannerConvocatoria->getFec_ini() . "',        \n                                           '" . $objBannerConvocatoria->getFec_fin() . "',\n                                           '" . $objBannerConvocatoria->getDoc_conv() . "',    \n                                           '" . $objBannerConvocatoria->getDoc_res() . "',   \n                                           '" . $objBannerConvocatoria->getMostrar() . "',\n                                           '" . $objBannerConvocatoria->getResultado() . "');";
         $rs = $objMysql->ejecutar($query);
         $error = 1;
     } catch (PDOException $exc) {
         $error = 0;
     }
     return $error;
 }
Beispiel #24
0
 public static function mantenimientoDatos(EntidadDatos $objDatosEntidad, array $param)
 {
     $query = NULL;
     $error = NULL;
     $objMysql = new Mysql();
     try {
         $query = "CALL sp_mnt_datos('" . $param[0] . "','" . $objDatosEntidad->getIddatos() . "','" . $objDatosEntidad->getPosicion() . "','" . $objDatosEntidad->getNombre() . "','" . $objDatosEntidad->getContenido() . "','" . $objDatosEntidad->getUrl() . "');";
         $rs = $objMysql->ejecutar($query);
         $error = 1;
     } catch (PDOException $exc) {
         $error = 0;
     }
     return $error;
 }
Beispiel #25
0
 public static function mantenimientoPagina(EntidadPagina $objPaginaEntidad, array $param)
 {
     $query = NULL;
     $error = NULL;
     $objMysql = new Mysql();
     try {
         $query = "CALL sp_mnt_pagina('" . $param[0] . "'," . "'" . $objPaginaEntidad->getIdpagweb() . "'," . "'" . $objPaginaEntidad->getIdusuario() . "'," . "'" . $objPaginaEntidad->getTitulo() . "'," . "'" . $objPaginaEntidad->getTipo() . "'," . "'" . $objPaginaEntidad->getTag() . "'," . "'" . $objPaginaEntidad->getDirecimag() . "'," . "'" . $objPaginaEntidad->getContenido() . "'," . "'" . $objPaginaEntidad->getImagen() . "'," . "'" . $objPaginaEntidad->getDesc() . "'," . "'" . $objPaginaEntidad->getIdclase() . "'," . "'" . $objPaginaEntidad->getScript() . "');";
         $rs = $objMysql->ejecutar($query);
         $error = 1;
     } catch (PDOException $exc) {
         $error = 0;
     }
     return $error;
 }
Beispiel #26
0
 public static function adicionar_contador($tabela, $id)
 {
     $db = new Mysql();
     switch ($tabela) {
         case 'NOTICIA':
             $campo_id = 'NOTICIA_CDG';
             break;
         case 'ITEM':
             $campo_id = 'ITEM_CDG';
             break;
     }
     $db->Query(' UPDATE ' . $tabela . ' SET ' . $tabela . '_VIEW = ' . $tabela . '_VIEW + 1 
                   WHERE ' . $campo_id . ' = ' . $id);
 }
Beispiel #27
0
 public static function mantenimientoBanner(EntidadBanner $objBannerEntidad, array $param)
 {
     $query = NULL;
     $error = NULL;
     $objMysql = new Mysql();
     try {
         $query = "CALL sp_mnt_banner('" . $param[0] . "',\n                                           '" . $objBannerEntidad->getIdbanner() . "',\n                                           '" . $objBannerEntidad->getTitulo() . "',    \n                                           '" . $objBannerEntidad->getUrl() . "',        \n                                           '" . $objBannerEntidad->getOrden() . "',\n                                           '" . $objBannerEntidad->getFoto() . "',    \n                                           '" . $objBannerEntidad->getFotochico() . "',        \n                                           '" . $objBannerEntidad->getEliminado() . "',    \n                                           '" . $objBannerEntidad->getCargaurl() . "',    \n                                           '" . $objBannerEntidad->getMostrar() . "',\n                                           '" . $objBannerEntidad->getIdcatempre() . "',\n                                           '" . $objBannerEntidad->getDescripcion() . "',\n                                           '" . $objBannerEntidad->getAbrir() . "',\n                                           '" . $objBannerEntidad->getEnlace() . "');";
         $rs = $objMysql->ejecutar($query);
         $error = 1;
     } catch (PDOException $exc) {
         $error = 0;
     }
     return $error;
 }
Beispiel #28
0
 public static function mantenimientoProducto(EntidadProducto $objProductoEntidad, array $param)
 {
     $query = NULL;
     $error = NULL;
     $objMysql = new Mysql();
     try {
         $query = "CALL sp_mnt_productos('" . $param[0] . "',\n                                           '" . $objProductoEntidad->getIdproducto() . "',\n                                           '" . $objProductoEntidad->getCodigo() . "',    \n                                           '" . $objProductoEntidad->getNombre() . "',        \n                                           '" . $objProductoEntidad->getIdcategoria() . "',\n                                           '" . $objProductoEntidad->getFoto1() . "',    \n                                           '" . $objProductoEntidad->getFoto2() . "',  \n                                           '" . $objProductoEntidad->getFoto3() . "', \n                                           '" . $objProductoEntidad->getDocumento() . "',  \n                                           '00-00-0000',\n                                           '" . $objProductoEntidad->getEliminado() . "',    \n                                           '" . $objProductoEntidad->getDestacado() . "',    \n                                           '" . $objProductoEntidad->getDescripcion() . "',\n                                           '" . $objProductoEntidad->getEdades() . "',    \n                                           '" . $objProductoEntidad->getIdgenero() . "', \n                                           '" . $objProductoEntidad->getPotencia() . "', \n                                           '" . $objProductoEntidad->getVoltaje() . "', \n                                           '" . $objProductoEntidad->getCaracter() . "');";
         $rs = $objMysql->ejecutar($query);
         $error = 1;
     } catch (PDOException $exc) {
         $error = 0;
     }
     return $error;
 }
Beispiel #29
0
 public static function mantenimientoProyecto(EntidadProyecto $objProyectoEntidad, array $param)
 {
     $query = NULL;
     $error = NULL;
     $objMysql = new Mysql();
     try {
         $query = "CALL sp_mnt_proyecto('" . $param[0] . "',\n                                           '" . $objProyectoEntidad->getIdproyecto() . "',\n                                           '" . $objProyectoEntidad->getFoto() . "',    \n                                           '" . $objProyectoEntidad->getDescripcion() . "',\n                                           '" . $objProyectoEntidad->getContenido() . "',\n                                           '" . $objProyectoEntidad->getUrl() . "',\n                                           '" . $objProyectoEntidad->getAbrir() . "',\n                                           '" . $objProyectoEntidad->getMostrar() . "');";
         $rs = $objMysql->ejecutar($query);
         $error = 1;
     } catch (PDOException $exc) {
         $error = 0;
     }
     return $error;
 }
Beispiel #30
0
 public static function mantenimientoClase(EntidadClase $objClaseEntidad, array $param)
 {
     $query = NULL;
     $error = NULL;
     $objMysql = new Mysql();
     try {
         $query = "CALL sp_mnt_clase('" . $param[0] . "','" . $objClaseEntidad->getIdclase() . "','" . $objClaseEntidad->getNombre() . "','00-00-0000','" . $objClaseEntidad->getEliminado() . "');";
         $rs = $objMysql->ejecutar($query);
         $error = 1;
     } catch (PDOException $exc) {
         $error = 0;
     }
     return $error;
 }