public function saveAction() { $db = new DBmysql(); $conn = $db->connect(); $last_id = $conn->query("SELECT MAX(ide) as dato from encuestas"); $last_id = mysqli_fetch_array($last_id); $last_id = $last_id['dato'] + 1; $val1 = 1; $query = "INSERT INTO encuestas (" . "ide," . "idForm," . "idMuestra," . "cod_municipio," . "idEstablecimiento," . "idAreaSupervision," . "fechaencuesta," . "resultados," . "cod_usuario," . "phone" . ") VALUES (" . $last_id . "," . $this->idForm . "," . $this->idMuestra . "," . $this->idMunicipio . "," . $this->idEstablecimiento . "," . $this->idAreaSupervision . ",'" . $this->fechaEncuesta . "','" . $this->resultados . "\t'," . $this->idUsuario . "," . $val1 . ");"; echo $query; $conn->query($query); return 0; }
public static function getlink($modelname) { $tableinfo = DBConfig::$tableinfo; if (array_key_exists($modelname, $tableinfo)) { $strDT = $tableinfo[$modelname]; //获得database table 字符串 $strDT = preg_replace('#\\s+#', ',', $strDT); //去掉空白.注意,代码中用空白,方便后期程序调试时添加或减少字段,这里再用逗号隔开方便处理 $arrDT = explode(',', $strDT); $database = $arrDT[0]; //database name $tablename = $arrDT[1]; //table name $dbConfigName = end($arrDT); //暂时必须有 连接数据库所需的ip/port/username/password $dbConfig = DBConfig::${$dbConfigName}; $host = $dbConfig['host']; $username = $dbConfig['username']; $password = $dbConfig['password']; return DBmysql::getInstance($host, $username, $password, $database, $tablename); } else { echo 'no table info <' . $tablename . '> found !'; exit; } }
/** * Constructor * * @param $ID ID of the ocs server ID **/ function __construct($dbhost, $dbuser, $dbpassword, $dbdefault) { $this->dbhost = $dbhost; $this->dbuser = $dbuser; $this->dbpassword = $dbpassword; $this->dbdefault = $dbdefault; parent::__construct(); }
/** * Constructor * * @param $ID ID of the ocs server ID **/ function __construct($ID) { $this->ocsservers_id = $ID; $data = PluginOcsinventoryngOcsServer::getConfig($ID); $this->dbhost = $data["ocs_db_host"]; $this->dbuser = $data["ocs_db_user"]; $this->dbpassword = rawurldecode($data["ocs_db_passwd"]); $this->dbdefault = $data["ocs_db_name"]; $this->dbenc = $data["ocs_db_utf8"] ? "utf8" : "latin1"; parent::__construct(); }
/** * Constructor * * @param $ID ID of the ocs server ID **/ function __construct($ID) { global $CFG_GLPI; $this->ocsservers_id = $ID; if ($CFG_GLPI["use_ocs_mode"]) { $data = OcsServer::getConfig($ID); $this->dbhost = $data["ocs_db_host"]; $this->dbuser = $data["ocs_db_user"]; $this->dbpassword = rawurldecode($data["ocs_db_passwd"]); $this->dbdefault = $data["ocs_db_name"]; $this->dbenc = $data["ocs_db_utf8"] ? "utf8" : "latin1"; parent::__construct(); } }
public function getMunicipios() { $db = new DBmysql(); $conn = $db->connect(); $query = "SELECT cod_municipio as id, municipio as name FROM municipios"; $result = $conn->query($query); $municipios = array(); // $query_est = "SELECT * FROM establecimientos"; $ind = 0; while ($row = mysqli_fetch_assoc($result)) { $query_est = "SELECT idEstablecimiento as id, establecimiento as name FROM establecimientos WHERE cod_municipio = " . $row['id']; $result2 = $conn->query($query_est); $establecimientos = array(); while ($row2 = mysqli_fetch_assoc($result2)) { array_push($establecimientos, $row2); } $municipios[$ind]['id'] = $row['id']; $municipios[$ind]['name'] = $row['name']; $municipios[$ind]['establecimientos'] = $establecimientos; //array_push($municipios, $row); $ind++; } return json_encode($this->utf8ize($municipios)); }
public function getAccountInfoColumns() { $query = "SHOW COLUMNS FROM `accountinfo`"; $columns = $this->db->query($query); while ($column = $this->db->fetch_assoc($columns)) { $res[$column['Field']] = $column['Field']; } if (TableExists("accountinfo_config")) { $query = "SELECT * FROM `accountinfo_config` "; $confs = $this->db->query($query); while ($conf = $this->db->fetch_assoc($confs)) { $key = "fields_" . $conf["ID"]; if (array_key_exists($key, $res)) { if ($conf["TYPE"]) { $res[$key] = array("NOM" => $conf['COMMENT'], "PREFIX" => "ACCOUNT_INFO_" . $conf["NAME"] . "_"); } else { $res[$key] = $conf['COMMENT']; } } } } return $res; }
function updateDbUpTo031() { global $DB, $migration; $ret = array(); // Before 0.31 if (!TableExists("glpi_config") && !TableExists("glpi_configs")) { $query = "CREATE TABLE `glpi_config` (\n `ID` int(11) NOT NULL auto_increment,\n `num_of_events` varchar(200) NOT NULL default '',\n `jobs_at_login` varchar(200) NOT NULL default '',\n `sendexpire` varchar(200) NOT NULL default '',\n `cut` varchar(200) NOT NULL default '',\n `expire_events` varchar(200) NOT NULL default '',\n `list_limit` varchar(200) NOT NULL default '',\n `version` varchar(200) NOT NULL default '',\n `logotxt` varchar(200) NOT NULL default '',\n `root_doc` varchar(200) NOT NULL default '',\n `event_loglevel` varchar(200) NOT NULL default '',\n `mailing` varchar(200) NOT NULL default '',\n `imap_auth_server` varchar(200) NOT NULL default '',\n `imap_host` varchar(200) NOT NULL default '',\n `ldap_host` varchar(200) NOT NULL default '',\n `ldap_basedn` varchar(200) NOT NULL default '',\n `ldap_rootdn` varchar(200) NOT NULL default '',\n `ldap_pass` varchar(200) NOT NULL default '',\n `admin_email` varchar(200) NOT NULL default '',\n `mailing_signature` varchar(200) NOT NULL default '',\n `mailing_new_admin` varchar(200) NOT NULL default '',\n `mailing_followup_admin` varchar(200) NOT NULL default '',\n `mailing_finish_admin` varchar(200) NOT NULL default '',\n `mailing_new_all_admin` varchar(200) NOT NULL default '',\n `mailing_followup_all_admin` varchar(200) NOT NULL default '',\n `mailing_finish_all_admin` varchar(200) NOT NULL default '',\n `mailing_new_all_normal` varchar(200) NOT NULL default '',\n `mailing_followup_all_normal` varchar(200) NOT NULL default '',\n `mailing_finish_all_normal` varchar(200) NOT NULL default '',\n `mailing_new_attrib` varchar(200) NOT NULL default '',\n `mailing_followup_attrib` varchar(200) NOT NULL default '',\n `mailing_finish_attrib` varchar(200) NOT NULL default '',\n `mailing_new_user` varchar(200) NOT NULL default '',\n `mailing_followup_user` varchar(200) NOT NULL default '',\n `mailing_finish_user` varchar(200) NOT NULL default '',\n `ldap_field_name` varchar(200) NOT NULL default '',\n `ldap_field_email` varchar(200) NOT NULL default '',\n `ldap_field_location` varchar(200) NOT NULL default '',\n `ldap_field_realname` varchar(200) NOT NULL default '',\n `ldap_field_phone` varchar(200) NOT NULL default '',\n PRIMARY KEY (`ID`)\n ) TYPE=MyISAM AUTO_INCREMENT=2 "; $DB->queryOrDie($query); $query = "INSERT INTO `glpi_config`\n VALUES (1, '10', '1', '1', '80', '30', '15', ' 0.31', 'GLPI powered by indepnet',\n '/glpi', '5', '0', '', '', '', '', '', '', '*****@*****.**', 'SIGNATURE',\n '1', '1', '1', '1', '0', '0', '0', '0', '0', '0', '0', '0','1', '1', '1',\n 'uid', 'mail', 'physicaldeliveryofficename', 'cn', 'telephonenumber')"; $DB->queryOrDie($query); echo "<p class='center'>Version > 0.31 </p>"; } // Save if problem with session during update $glpilanguage = $_SESSION["glpilanguage"]; // < 0.78 if (TableExists("glpi_config")) { // Get current version // Use language from session, even if sometime not reliable $query = "SELECT `version`, 'language'\n FROM `glpi_config`"; $result = $DB->queryOrDie($query, "get current version"); $current_version = trim($DB->result($result, 0, 0)); $glpilanguage = trim($DB->result($result, 0, 1)); // < 0.85 } else { if (FieldExists('glpi_configs', 'version')) { // Get current version and language $query = "SELECT `version`, `language`\n FROM `glpi_configs`"; $result = $DB->queryOrDie($query, "get current version"); $current_version = trim($DB->result($result, 0, 0)); $glpilanguage = trim($DB->result($result, 0, 1)); } else { $configurationValues = Config::getConfigurationValues('core', array('version', 'language')); $current_version = $configurationValues['version']; $glpilanguage = $configurationValues['language']; } } // To prevent problem of execution time ini_set("max_execution_time", "0"); $migration = new Migration($current_version); switch ($current_version) { case "0.31": include "update_031_04.php"; update031to04(); case "0.4": case "0.41": include "update_04_042.php"; update04to042(); case "0.42": showLocationUpdateForm(); include "update_042_05.php"; update042to05(); case "0.5": include "update_05_051.php"; update05to051(); case "0.51": case "0.51a": include "update_051_06.php"; update051to06(); case "0.6": include "update_06_065.php"; update06to065(); case "0.65": include "update_065_068.php"; update065to068(); case "0.68": include "update_068_0681.php"; update068to0681(); case "0.68.1": case "0.68.2": case "0.68.3": // Force update content if (showLocationUpdateForm()) { $query = "UPDATE `glpi_config`\n SET `version` = ' 0.68.3x'"; $DB->queryOrDie($query, "0.68.3"); showContentUpdateForm(); exit; } case "0.68.3x": // Special version for replay upgrade process from here include "update_0681_07.php"; update0681to07(); case "0.7": case "0.70.1": case "0.70.2": include "update_07_071.php"; update07to071(); case "0.71": case "0.71.1": include "update_071_0712.php"; update071to0712(); case "0.71.2": include "update_0712_0713.php"; update0712to0713(); case "0.71.3": case "0.71.4": case "0.71.5": case "0.71.6": include "update_0713_072.php"; update0713to072(); case "0.72": include "update_072_0721.php"; update072to0721(); case "0.72.1": include "update_0721_0722.php"; update0721to0722(); case "0.72.2": case "0.72.21": include "update_0722_0723.php"; update0722to0723(); case "0.72.3": case "0.72.4": include "update_0723_078.php"; update0723to078(); case "0.78": include "update_078_0781.php"; update078to0781(); case "0.78.1": include "update_0781_0782.php"; update0781to0782(); case "0.78.2": case "0.78.3": case "0.78.4": case "0.78.5": include "update_0782_080.php"; update0782to080(); case "0.80": include "update_080_0801.php"; update080to0801(); case "0.80.1": case "0.80.2": include "update_0801_0803.php"; update0801to0803(); case "0.80.3": case "0.80.4": case "0.80.5": case "0.80.6": case "0.80.61": case "0.80.7": include "update_0803_083.php"; update0803to083(); case "0.83": include "update_083_0831.php"; update083to0831(); case "0.83.1": case "0.83.2": include "update_0831_0833.php"; update0831to0833(); case "0.83.3": case "0.83.31": case "0.83.4": case "0.83.5": case "0.83.6": case "0.83.7": case "0.83.8": case "0.83.9": case "0.83.91": include "update_0831_084.php"; update0831to084(); case "0.84": include "update_084_0841.php"; update084to0841(); case "0.84.1": case "0.84.2": include "update_0841_0843.php"; update0841to0843(); case "0.84.3": include "update_0843_0844.php"; update0843to0844(); case "0.84.4": case "0.84.5": include "update_0845_0846.php"; update0845to0846(); case "0.84.6": case "0.84.7": case "0.84.8": case "0.84.9": include "update_084_085.php"; update084to085(); case "0.85": case "0.85.1": case "0.85.2": include "update_085_0853.php"; update085to0853(); case "0.85.3": case "0.85.4": case "0.85.5": include "update_0853_090.php"; update0853to090(); case "0.90": break; default: include "update_031_04.php"; update031to04(); include "update_04_042.php"; update04to042(); showLocationUpdateForm(); include "update_042_05.php"; update042to05(); include "update_05_051.php"; update05to051(); include "update_051_06.php"; update051to06(); include "update_06_065.php"; update06to065(); include "update_065_068.php"; update065to068(); include "update_068_0681.php"; update068to0681(); // Force update content $query = "UPDATE `glpi_config`\n SET `version` = ' 0.68.3x'"; $DB->queryOrDie($query, "0.68.3"); showContentUpdateForm(); exit; } // Update version number and default langage and new version_founded ---- LEAVE AT THE END Config::setConfigurationValues('core', array('version' => '0.90', 'language' => $glpilanguage, 'founded_new_version' => '')); // Update process desactivate all plugins $plugin = new Plugin(); $plugin->unactivateAll(); DBmysql::optimize_tables($migration); return $ret; }
<?php session_start(); require 'db.php'; $user = $_POST['user']; $pass = $_POST['pass']; $db = new DBmysql('192.168.0.93', 'pelisio', 'pel2015', 'pelisio'); if ($result = $db->consulta2("SELECT user,pass,activo FROM usuario WHERE user = '******';")) { if ($result['activo'] != 1) { echo "3"; } else { if ($result['pass'] != $pass) { echo "2"; } else { $_SESSION["userid"] = $user; echo "1"; } } } else { echo 404; } $db->desconectar();
$percent = 0; } if ($percent >= 0) { Html::displayProgressBar(400, $percent); echo '<br>'; } if ($offset != -1) { if (restoreMySqlDump($DB, $path . "/" . $_GET["file"], $duree)) { echo "<div class='center'>" . "<a href=\"backup.php?file=" . $_GET["file"] . "&duree={$duree}&offset=" . "{$offset}&cpt={$cpt}&donotcheckversion=1\">"; echo __('Automatic redirection, else click') . "</a>"; echo "<script language='javascript' type='text/javascript'>" . "window.location=\"backup.php?file=" . $_GET["file"] . "&duree={$duree}&offset={$offset}&cpt={$cpt}&donotcheckversion=1\";" . "</script></div>"; Html::glpi_flush(); exit; } } else { DBmysql::optimize_tables(NULL, true); // Compatiblity for old version for utf8 complete conversion $cnf = new Config(); $input['id'] = 1; $input['utf8_conv'] = 1; $cnf->update($input); } } if (isset($_POST["delfile"])) { if (isset($_POST['file']) && $_POST["file"] != "") { $filename = $_POST["file"]; if (is_file($path . "/" . $_POST["file"])) { unlink($path . "/" . $_POST["file"]); // TRANS: %s is a file name echo "<div class ='center spaced'>" . sprintf(__('%s deleted'), $filename) . "</div>"; }
/** * @see PluginOcsinventoryngOcsClient::getSnmp() * @param array $options * @return array */ public function getSnmp($options) { if (isset($options['OFFSET'])) { $offset = "OFFSET " . $options['OFFSET']; } else { $offset = ""; } if (isset($options['MAX_RECORDS'])) { $max_records = "LIMIT " . $options['MAX_RECORDS']; } else { $max_records = ""; } if (isset($options['ORDER'])) { $order = $options['ORDER']; } else { $order = " LASTDATE "; } if (isset($options['FILTER'])) { $filters = $options['FILTER']; if (isset($filters['IDS']) and $filters['IDS']) { $ids = $filters['IDS']; $where_ids = " AND snmp.ID IN ("; $where_ids .= join(',', $ids); $where_ids .= ") "; } else { $where_ids = ""; } if (isset($filters['EXCLUDE_IDS']) and $filters['EXCLUDE_IDS']) { $exclude_ids = $filters['EXCLUDE_IDS']; $where_exclude_ids = " AND snmp.ID NOT IN ("; $where_exclude_ids .= join(',', $exclude_ids); $where_exclude_ids .= ") "; } else { $where_exclude_ids = ""; } if (isset($filters['DEVICEIDS']) and $filters['DEVICEIDS']) { $deviceids = $filters['DEVICEIDS']; $where_deviceids = " AND snmp.SNMPDEVICEID IN ('"; $where_deviceids .= join('\',\'', $deviceids); $where_deviceids .= "') "; } else { $where_deviceids = ""; } if (isset($filters['EXCLUDE_DEVICEIDS']) and $filters['EXCLUDE_DEVICEIDS']) { $exclude_deviceids = $filters['EXCLUDE_DEVICEIDS']; $where_exclude_deviceids = " AND snmp.SNMPDEVICEID NOT IN ("; $where_exclude_deviceids .= join(',', $exclude_deviceids); $where_exclude_deviceids .= ") "; } else { $where_exclude_deviceids = ""; } if (isset($filters['INVENTORIED_SINCE']) and $filters['INVENTORIED_SINCE']) { $since = $filters['INVENTORIED_SINCE']; $where_since = " AND (`snmp`.`LASTDATE` > "; $where_since .= "'" . $since . "'"; $where_since .= ") "; } else { $where_since = ""; } if (isset($filters['INVENTORIED_BEFORE']) and $filters['INVENTORIED_BEFORE']) { $before = $filters['INVENTORIED_BEFORE']; $where_before = " AND (UNIX_TIMESTAMP(`snmp`.`LASTDATE`) < (UNIX_TIMESTAMP(" . $before . ")-180"; // $where_before .= "'" .$before. "'"; $where_before .= ")) "; } else { $where_before = ""; } if (isset($filters['CHECKSUM']) and $filters['CHECKSUM']) { $checksum = $filters['CHECKSUM']; $where_checksum = " AND ('" . $checksum . "' & snmp.CHECKSUM) "; } else { $where_checksum = ""; } $where_condition = $where_ids . $where_exclude_ids . $where_deviceids . $where_exclude_deviceids . $where_checksum . $where_since . $where_before; } else { $where_condition = ""; } $query = "SELECT DISTINCT snmp.ID FROM snmp, snmp_accountinfo\n WHERE snmp.SNMPDEVICEID NOT LIKE '\\_%'\n AND snmp.ID = snmp_accountinfo.SNMP_ID\n {$where_condition}"; $request = $this->db->query($query); if ($this->db->numrows($request)) { $count = $this->db->numrows($request); $query = "SELECT DISTINCT snmp.ID, snmp.NAME FROM snmp, snmp_accountinfo\n WHERE snmp.SNMPDEVICEID NOT LIKE '\\_%'\n AND snmp.ID = snmp_accountinfo.SNMP_ID\n {$where_condition}\n ORDER BY {$order}\n {$max_records} {$offset}"; $request = $this->db->query($query); $this->getAccountInfoColumns(); while ($snmpid = $this->db->fetch_assoc($request)) { $snmpids[] = $snmpid['ID']; } $res["TOTAL_COUNT"] = $count; // if (isset($options['DISPLAY']['CHECKSUM'])) { // $checksum = $options['DISPLAY']['CHECKSUM']; // } else { // $checksum = self::CHECKSUM_NONE; // } // if (isset($options['DISPLAY']['WANTED'])) { // $wanted = $options['DISPLAY']['WANTED']; // } else { // $wanted = self::WANTED_NONE; // } $complete = 1; if (isset($options['COMPLETE'])) { $complete = $options['COMPLETE']; } $res["SNMP"] = $this->getSnmpSections($snmpids, $complete); } else { $res = array(); } return $res; }
<?php // Database initialization $oDB = new DBmysql($fusebox['dbLogin'], $fusebox['dbPassword'], $fusebox['dbName'], $fusebox['dbHost'], $fusebox['dbPort']); if (!$oDB) { _throw("FCannotInstantiateDB", "Cannot instantiate DB class"); } if (!$oDB->connect()) { _throw("FCannotConnectToDB", "Cannot connect to database server you specified (" . $oDB->getError() . ")"); } // making fake fuseaction for global things $ogFuseaction = new Fuseaction(0, $fusebox['globalFuseaction'], "Entire site", "", $fusebox['globalStickyAttributes']); // FuseManager initialization $oFuseManager = new FuseManager($oDB, $fusebox['tableFuseactions'], false); if (!$oFuseManager->initialize()) { _throw("FNoFuseactionsTable", "There is no fuseactions table called \"{$fusebox['tableFuseactions']}\" present in DB"); } // sync'ing fuseactions if ($fusebox['mode'] == "development") { if (!$oFuseManager->synchronizeFuseactions($fusebox)) { _throw("FCannotSynchronizeFuseactions", "Error occured while synchronizing fuseactions, check your database"); } } // getting current fuseaction $oFuseaction = $oFuseManager->getFuseaction($attributes['fuseaction']); if (!$oFuseaction) { _throw("FNoSuchFuseaction", "There is no fuseaction called \"{$attributes['fuseaction']}\" found"); } // loading 'sticky' attributes values from session for entire site getStickyAttributes($ogFuseaction->getName(), $ogFuseaction->getStickyAttributes()); // loading 'sticky' attributes values from session for this fuseaction
<?php require 'db.php'; $ipvisitante = $_SERVER["REMOTE_ADDR"]; $idpelicula = $_REQUEST['id']; $db = new DBmysql('192.168.0.93', 'pelisio', 'pel2015', 'pelisio'); $temp1 = $db->consulta2("SELECT IFNULL(COUNT(pip),0) AS votos FROM votos WHERE pip = '" . $_SERVER["REMOTE_ADDR"] . "';"); if ($temp1['votos'] == '0') { $statement = $db->statment("INSERT INTO votos (cod, pip) VALUES(?, ?)"); $statement->bind_param('is', $idpelicula, $ipvisitante); $statement->execute(); $statement->close(); $temp = $db->consulta2("SELECT cod, SUM(1) AS total FROM votos WHERE cod = " . $idpelicula); echo $temp['total']; } else { echo 0; } $db->desconectar();
private function getRestricciones($idsend) { $db = new DBmysql(); $conn = $db->connect(); $query = "SELECT idRestriccion as id, idPreguntaDestino as destino, idListaValor as valor FROM restricciones WHERE idpregunta =" . $idsend; $result = $conn->query($query); $restricciones = array(); $ind = 0; while ($row = mysqli_fetch_assoc($result)) { $restricciones[$ind]['id'] = $row['id']; $restricciones[$ind]['destino'] = $row['destino']; $restricciones[$ind]['valor'] = $row['valor']; $ind++; } return $restricciones; }
<?php require 'db.php'; $db = new DBmysql('192.168.0.93', 'pelisio', 'pel2015', 'pelisio'); $temp = $db->consulta("SELECT codigo FROM pelicula where activo = 1"); $pila = array(); foreach ($temp as $clave => $valor) { $pila[] = $clave; } echo json_encode($pila);
// Entite $added = 0; $entity = new Entity (); for ($i=0 ; $i<max(1,pow($entity_number,1/2))&&$added<$entity_number ; $i++) { $added++; $newID = $entity->add(array('name' => "entity $i", 'comment' => "comment entity $i")); generate_entity($newID); for ($j=0 ; $j<mt_rand(0,pow($entity_number,1/2))&&$added<$entity_number ; $j++) { $added++; $newID2 = $entity->add(array('name' => "s-entity $j", 'comment' => "comment s-entity $j", 'entities_id' => $newID)); generate_entity($newID2); for ($k=0 ; $k<mt_rand(0,pow($entity_number,1/2))&&$added<$entity_number ; $k++) { $added++; $newID3 = $entity->add(array('name' => "ss-entity $k", 'comment' => "comment ss-entity $k", 'entities_id' => $newID2)); generate_entity($newID3); } } } DBmysql::optimize_tables(); // clean messages; $_SESSION["MESSAGE_AFTER_REDIRECT"]='' ?>
/** * Clean log cron function * * @param $task for log **/ static function cronOptimize($task) { $nb = DBmysql::optimize_tables(NULL, true); $task->setVolume($nb); return 1; }
public function saveAction() { $db = new DBmysql(); $conn = $db->connect(); $last_id = $conn->query("SELECT MAX(idModulo) as dato from modulos"); $last_id = mysqli_fetch_array($last_id); $last_id = $last_id['dato'] + 1; $query = "INSERT INTO modulos (idModulo,codModulo,nomModulo) VALUES (" . $last_id . ",'" . $this->codModulo . "','" . $this->nomModulo . "');"; $conn->query($query); return 0; }
<?php require 'db.php'; $cod = $_POST['cod']; $db = new DBmysql('192.168.0.93', 'pelisio', 'pel2015', 'pelisio'); $temp = $db->consulta2("SELECT IFNULL(COUNT(cod),0) total FROM votos WHERE cod =" . $cod); echo $temp['total']; //echo json_encode($temp);
<?php session_start(); require 'db.php'; $movies = $_POST['movies']; $db = new DBmysql('192.168.0.93', 'pelisio', 'pel2015', 'pelisio'); $result = $db->ejecutar("DELETE FROM pelicula;"); $result = $db->ejecutar("DELETE FROM votos;"); for ($i = 0; $i < count($movies); $i++) { $result = $db->ejecutar("INSERT INTO pelicula(codigo,propuesta) VALUES(" . $movies[$i] . ",'" . $_SESSION["userid"] . "');"); } $db->desconectar();
$migration->displayWarning("***** Install process of plugin TIMELINETICKET *****"); } else { $migration->displayWarning("***** Update process of plugin TIMELINETICKET *****"); } $migration->displayWarning("Current Timelineticket version: {$current_version}"); $migration->displayWarning("Version to update: " . PLUGIN_TIMELINETICKET_VERSION); // To prevent problem of execution time ini_set("max_execution_time", "0"); ini_set("memory_limit", "-1"); $mess = ''; if ($current_version != PLUGIN_TIMELINETICKET_VERSION and $current_version != '0') { $mess = "Update done."; } else { if ($current_version == PLUGIN_TIMELINETICKET_VERSION) { $mess = "No migration needed."; } else { $mess = "installation done."; } } $plugin->getFromDBbyDir("timelineticket"); $plugin->install($plugin->fields['id']); plugin_timelineticket_install(); $migration->displayWarning($mess); $plugin->load("timelineticket"); $plugin->activate($plugin->fields['id']); $plugin->load("timelineticket"); if (in_array('--optimize', $_SERVER['argv'])) { $migration->displayTitle("Optimizing tables"); DBmysql::optimize_tables($migration); $migration->displayWarning("Optimize done."); }
<?php include_once 'FormularioEntity.php'; $user = isset($_GET['user']) ? $_GET['user'] : ''; $pass = isset($_GET['password']) ? $_GET['password'] : ''; $db = new DBmysql(); $conn = $db->connect(); $query = "SELECT * FROM usuarios"; $result = $conn->query($query); $valid = false; while ($row = mysqli_fetch_assoc($result)) { if ($row['usuario'] == $user && $row['password_android'] == $pass) { $valid = true; } //print_r($row);echo "<br>"; } if (!$valid) { $enviar['respuesta'] = 0; $enviar['mensaje'] = "Credenciales incorrectas"; $enviar['muestras'] = array(); print_r($enviar); } else { $formulario = new Formularios(); $formularios = $formulario->getMuestras(); $enviar = array(); $enviar['respuesta'] = 1; $enviar['mensaje'] = "validado exitosamente"; $enviar['muestras'] = $formularios; print_r($enviar); return json_encode($formulario->utf8ize($enviar)); print_r($formularios);