本文整理汇总了PHP中mysql2_query_secure函数的典型用法代码示例。如果您正苦于以下问题:PHP mysql2_query_secure函数的具体用法?PHP mysql2_query_secure怎么用?PHP mysql2_query_secure使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysql2_query_secure函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert
function insert($NAME, $IVALUE, $TVALUE = "")
{
global $list_hardware_id, $tab_hadware_id;
//delete old value before insert new
erase($NAME);
// if it's for group or a machine
if (isset($list_hardware_id)) {
$arg = array($list_hardware_id, $NAME, $IVALUE);
if ($TVALUE != "") {
$sql = "INSERT INTO devices(HARDWARE_ID,NAME,IVALUE,TVALUE) VALUES ('%s', '%s', '%s', '%s')";
array_push($arg, $TVALUE);
} else {
$sql = "INSERT INTO devices(HARDWARE_ID, NAME, IVALUE) VALUES('%s', '%s', '%s')";
}
mysql2_query_secure($sql, $_SESSION['OCS']["writeServer"], $arg);
} else {
//else : request
$i = 0;
while ($tab_hadware_id[$i]) {
$arg = array($tab_hadware_id[$i], $NAME, $IVALUE);
if ($TVALUE != "") {
$sql = "INSERT INTO devices(HARDWARE_ID,NAME,IVALUE,TVALUE) VALUES ('%s', '%s', '%s', '%s')";
array_push($arg, $TVALUE);
} else {
$sql = "INSERT INTO devices(HARDWARE_ID, NAME, IVALUE) VALUES ('%s', '%s', '%s')";
}
mysql2_query_secure($sql, $_SESSION['OCS']["writeServer"], $arg);
$i++;
}
}
}
示例2: look_config_default_values
function look_config_default_values($field_name, $like = '', $default_values = '')
{
if ($like == '') {
$sql = "select NAME,IVALUE,TVALUE,COMMENTS from config where NAME in ";
$arg_sql = array();
$arg = mysql2_prepare($sql, $arg_sql, $field_name);
} else {
$arg['SQL'] = "select NAME,IVALUE,TVALUE,COMMENTS from config where NAME like '%s'";
$arg['ARG'] = $field_name;
}
$resdefaultvalues = mysql2_query_secure($arg['SQL'], $_SESSION['OCS']["readServer"], $arg['ARG']);
while ($item = mysqli_fetch_object($resdefaultvalues)) {
$result['name'][$item->NAME] = $item->NAME;
$result['ivalue'][$item->NAME] = $item->IVALUE;
$result['tvalue'][$item->NAME] = $item->TVALUE;
$result['comments'][$item->NAME] = $item->COMMENTS;
}
if (is_array($default_values)) {
foreach ($default_values as $key => $value) {
$key = strtolower($key);
if (is_array($value)) {
foreach ($value as $name => $val) {
if (!isset($result[$key][$name]) or $result[$key][$name] == '') {
$result[$key][$name] = $val;
}
}
}
}
}
return $result;
}
示例3: exec_fichier_sql
function exec_fichier_sql($fichier, $link)
{
global $l;
$db_file = $fichier;
$dbf_handle = @fopen($db_file, "r");
echo "<br>";
if (!$dbf_handle) {
msg_error($l->g(2112) . " : " . $fichier);
return true;
} else {
if (filesize($db_file) > 0) {
$sql_query = fread($dbf_handle, filesize($db_file));
fclose($dbf_handle);
$data_sql = explode(";", $sql_query);
foreach ($data_sql as $k => $v) {
if (trim($v) != "") {
echo ".";
ob_flush();
flush();
mysql2_query_secure($v, $link);
}
}
return false;
}
return true;
}
}
示例4: show_computer_summary
function show_computer_summary($computer)
{
global $l;
$urls = $_SESSION['OCS']['url_service'];
$labels = array('SYSTEM' => array('USERID' => $l->g(24), 'OSNAME' => $l->g(274), 'OSVERSION' => $l->g(275), 'OSCOMMENTS' => $l->g(286), 'DESCRIPTION' => $l->g(53), 'WINCOMPANY' => $l->g(51), 'WINOWNER' => $l->g(348), 'WINPRODID' => $l->g(111), 'WINPRODKEY' => $l->g(553), 'VMTYPE' => $l->g(1267)), 'NETWORK' => array('WORKGROUP' => $l->g(33), 'USERDOMAIN' => $l->g(557), 'IPADDR' => $l->g(34), 'NAME_RZ' => $l->g(304)), 'HARDWARE' => array('SWAP' => $l->g(50), 'MEMORY' => $l->g(26), 'UUID' => $l->g(1268), 'ARCH' => $l->g(1247)), 'AGENT' => array('USERAGENT' => $l->g(357), 'LASTDATE' => $l->g(46), 'LASTCOME' => $l->g(820)));
$cat_labels = array('SYSTEM' => $l->g(1387), 'NETWORK' => $l->g(1388), 'HARDWARE' => $l->g(1389), 'AGENT' => $l->g(1390));
foreach ($labels as $cat_key => $cat) {
foreach ($cat as $key => $lbl) {
if ($key == "MEMORY") {
$sqlMem = "SELECT SUM(capacity) AS 'capa' FROM memories WHERE hardware_id=%s";
$argMem = $computer->ID;
$resMem = mysql2_query_secure($sqlMem, $_SESSION['OCS']["readServer"], $argMem);
$valMem = mysqli_fetch_array($resMem);
if ($valMem["capa"] > 0) {
$memory = $valMem["capa"];
} else {
$memory = $computer->{$key};
}
$data[$key] = $memory;
} elseif ($key == "LASTDATE" or $key == "LASTCOME") {
$data[$key] = dateTimeFromMysql($computer->{$key});
} elseif ($key == "NAME_RZ") {
$data[$key] = "";
$data_RZ = subnet_name($computer->ID);
$nb_val = count($data_RZ);
if ($nb_val == 1) {
$data[$key] = $data_RZ[0];
} elseif (isset($data_RZ)) {
foreach ($data_RZ as $index => $value) {
$data[$key] .= $index . " => " . $value . "<br>";
}
}
} elseif ($key == "VMTYPE" and $computer->UUID != '') {
$sqlVM = "select vm.hardware_id,vm.vmtype, h.name from virtualmachines vm left join hardware h on vm.hardware_id=h.id where vm.uuid='%s' order by h.name DESC";
$argVM = $computer->UUID;
$resVM = mysql2_query_secure($sqlVM, $_SESSION['OCS']["readServer"], $argVM);
$valVM = mysqli_fetch_array($resVM);
$data[$key] = $valVM['vmtype'];
$link_vm = "<a href='index.php?" . PAG_INDEX . "=" . $urls->getUrl('ms_computer') . "&head=1&systemid=" . $valVM['hardware_id'] . "' target='_blank'><font color=red>" . $valVM['name'] . "</font></a>";
$link[$key] = true;
if ($data[$key] != '') {
msg_info($l->g(1266) . "<br>" . $l->g(1269) . ': ' . $link_vm);
}
} elseif ($key == "IPADDR" and $_SESSION['OCS']['profile']->getRestriction('WOL', 'NO') == "NO") {
$data[$key] = $computer->{$key} . " <a href=# OnClick='confirme(\"\",\"WOL\",\"bandeau\",\"WOL\",\"" . $l->g(1283) . "\");'><i>WOL</i></a>";
$link[$key] = true;
} elseif ($computer->{$key} != '') {
$data[$key] = $computer->{$key};
}
}
}
echo open_form("bandeau");
show_summary($data, $labels, $cat_labels, $link);
echo "<input type='hidden' id='WOL' name='WOL' value=''>";
echo close_form();
}
示例5: get_redistrib_package_info
function get_redistrib_package_info($timestamp)
{
$query = "SELECT FILEID, NAME, PRIORITY, FRAGMENTS, SIZE, OSNAME, COMMENT FROM download_available" . " WHERE NAME LIKE '%%_redistrib' AND COMMENT LIKE '%%[PACK REDISTRIBUTION %s]%%'";
$res = mysql2_query_secure($query, $_SESSION['OCS']['readServer'], $timestamp);
if (mysqli_num_rows($res)) {
return mysqli_fetch_assoc($res);
} else {
return false;
}
}
示例6: delkey
function delkey($id)
{
//find the registry key
$sql = "select name from regconfig where id =%s";
$arg = $id;
$res = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg);
$row = mysql_fetch_object($res);
$name = $row->name;
//delete key
$sql_reg = "delete from regconfig where id =%s ";
mysql2_query_secure($sql_reg, $_SESSION['OCS']["writeServer"], $arg);
//delete cache
$sql_reg = "delete from registry_name_cache where name ='%s' ";
mysql2_query_secure($sql_reg, $_SESSION['OCS']["writeServer"], $name);
}
示例7: find_device_line
function find_device_line($status, $packid)
{
$sql = "select hardware_id,ivalue from devices where name='DOWNLOAD' and tvalue";
if ($status == "NULL") {
$sql .= " IS NULL ";
$arg = $packid;
} elseif ($status == "NOTNULL") {
$sql .= " IS NOT NULL ";
$arg = $packid;
} else {
$sql .= " LIKE '%s' ";
$arg = array($status, $packid);
}
$sql .= "AND ivalue IN (SELECT id FROM download_enable WHERE fileid='%s') " . "AND hardware_id NOT IN (SELECT id FROM hardware WHERE deviceid='_SYSTEMGROUP_')";
$res = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg);
while ($row = mysqli_fetch_object($res)) {
$result['HARDWARE_ID'][] = $row->hardware_id;
$result['IVALUE'][] = $row->ivalue;
}
return $result;
}
示例8: foreach
}
if ($listIDdel != '') {
foreach ($listIDdel as $k => $v) {
desactive_packet('', $v);
}
}
mysql2_query_secure("DELETE FROM download_enable WHERE FILEID=%s", $_SESSION['OCS']["writeServer"], $protectedPost['DEL_ALL']);
echo "<script>window.opener.document.packlist.submit(); self.close();</script>";
}
if ($protectedPost['SUP_PROF'] != '') {
desactive_packet('', $protectedPost['SUP_PROF']);
mysql2_query_secure("DELETE FROM download_enable WHERE ID=%s", $_SESSION['OCS']["writeServer"], $protectedPost['SUP_PROF']);
}
}
$sql_details = "select distinct priority,fragments,size from download_available where fileid=%s";
$res_details = mysql2_query_secure($sql_details, $_SESSION['OCS']["readServer"], $protectedGet['timestamp']);
$val_details = mysqli_fetch_array($res_details);
$tps = "<br>" . $l->g(992) . " : <b><font color=red>" . tps_estimated($val_details) . "</font></b>";
PrintEnTete($l->g(481) . $tps);
echo "<br>";
$form_name = "tele_actives";
//ouverture du formulaire
echo open_form($form_name);
$list_fields = array($l->g(460) => 'e.ID', 'Timestamp' => 'e.FILEID', $l->g(470) => 'e.INFO_LOC', $l->g(471) => 'e.PACK_LOC', $l->g(49) => 'a.NAME', $l->g(440) => 'a.PRIORITY', $l->g(480) => 'a.FRAGMENTS', $l->g(462) => 'a.SIZE', $l->g(25) => 'a.OSNAME');
if (!$cant_active) {
$list_fields['SUP'] = 'e.ID';
}
$table_name = "LIST_ACTIVES";
$default_fields = $list_fields;
$list_col_cant_del = array($l->g(460) => $l->g(460), 'SUP' => 'SUP');
$querypack = 'SELECT distinct ';
示例9: mysql2_query_secure
$querygroup .= " group by h.ID";
$result = mysql2_query_secure($sql_nb_mach, $_SESSION['OCS']["readServer"]);
while ($item = mysql_fetch_object($result)) {
//on force les valeurs du champ "nombre" � l'affichage
$tab_options['VALUE']['NBRE'][$item->group_id] = $item->nb;
}
//Modif ajout�e pour la prise en compte
//du chiffre � rajouter dans la colonne de calcul
//quand on a un seul groupe et qu'aucune machine n'est dedant.
if (!isset($tab_options['VALUE']['NBRE'])) {
$tab_options['VALUE']['NBRE'][] = 0;
}
//on recherche les groupes visible pour cocher la checkbox � l'affichage
if ($protectedPost['onglet'] == "STAT") {
$sql = "select id from hardware where workgroup='GROUP_4_ALL'";
$result = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"]);
while ($item = mysql_fetch_object($result)) {
$protectedPost['check' . $item->id] = "check";
}
}
//on ajoute un javascript lorsque l'on clic sur la visibilit� du groupe pour tous
$tab_options['JAVA']['CHECK']['NAME'] = "NAME";
$tab_options['JAVA']['CHECK']['QUESTION'] = $l->g(811);
$tab_options['FILTRE'] = array('NAME' => $l->g(679), 'DESCRIPTION' => $l->g(53));
//affichage du tableau
$result_exist = tab_req($table_name, $list_fields, $default_fields, $list_col_cant_del, $querygroup, $form_name, 100, $tab_options);
//if your profil is an admin groups, you can create one
if ($_SESSION['OCS']['CONFIGURATION']['GROUPS'] == "YES") {
echo "</td></tr></table>";
if ($protectedPost['onglet'] == "STAT") {
echo "<BR><input type='submit' name='add_static_group' value='" . $l->g(587) . "'>";
示例10: mysql2_prepare
$insert = mysql2_prepare($sql_insert, $arg_sql, $array_values);
mysql2_query_secure($insert['SQL'], $_SESSION['OCS']["writeServer"], $insert['ARG']);
// mysql_query( "INSERT INTO ".$table." (".$fields.") VALUES('".$values."')", $_SESSION['OCS']["writeServer"]) or mysql_error($_SESSION['OCS']["writeServer"]);
//If we add a field, you must add a new colonm in downloadwk_pack table
if ($table == "downloadwk_fields") {
$id = mysql_insert_id($_SESSION['OCS']["writeServer"]);
if (is_numeric($id)) {
if ($protectedPost["newtype"] == 1) {
$type = "LONGTEXT";
} elseif ($protectedPost["newtype"] == 8) {
$type = "BLOB";
} else {
$type = "VARCHAR(255)";
}
$sql_add_column = "ALTER TABLE downloadwk_pack ADD COLUMN fields_" . $id . " " . $type . " default NULL";
mysql2_query_secure($sql_add_column, $_SESSION['OCS']["writeServer"]);
} else {
msg_error("mysql_insert_id() problem");
}
}
msg_success($l->g(1069));
reloadform_closeme($protectedGet['form']);
if ($protectedPost['Valid_modif_x'] != "") {
unset($protectedPost['newfield'], $protectedPost['newlbl']);
}
} else {
msg_error($ERROR);
}
}
//NAME FIELD
$name_field = array("newfield");
示例11: insert_with_rules
function insert_with_rules($list_id, $rule_detail, $fileid)
{
if (is_array($list_id)) {
$list_id_hardware = implode(',', $list_id);
} else {
$list_id_hardware = $list_id;
}
if ($list_id_hardware == "") {
return;
}
//for servers
//recherche de tous les hardware_id des servers et des id de download_enable correspondant
$sql_infoServ = "select server_id,id from download_enable where group_id != '' \n\t\t\t\t\t\t\t\tand fileid=%s";
$arg_infoServ = $fileid;
//echo $sql_infoServ;
$res_infoServ = mysql2_query_secure($sql_infoServ, $_SESSION['OCS']["readServer"], $arg_infoServ);
//cr�ation de la liste des id_hardware des servers et d'un tableau de l'id de download_enable en fonction de l'hardware_id
while ($val_infoServ = mysql_fetch_array($res_infoServ)) {
$list_serverId[$val_infoServ['server_id']] = $val_infoServ['server_id'];
$tab_Server[$val_infoServ['server_id']] = $val_infoServ['id'];
}
if ($rule_detail['compto'] == "NAME" or $rule_detail['compto'] == "WORKGROUP" or $rule_detail['compto'] == "USERID") {
$tablecompto = "hardware";
$id_server = "ID";
}
if ($rule_detail['compto'] == "IPSUBNET" or $rule_detail['compto'] == "IPADDRESS") {
$tablecompto = "networks";
$id_server = "HARDWARE_ID";
}
$sql_servValues = "select a.%s,a.%s,d.id as id_download_enable from %s a,download_enable d\n\t\t\t\t\t\t where a.%s in ";
$arg_servValues = array($rule_detail['compto'], $id_server, $tablecompto, $id_server);
$arg = mysql2_prepare($sql_servValues, $arg_servValues, $list_serverId);
$arg['SQL'] .= " and d.server_id=a.%s and fileid='%s'";
array_push($arg['ARG'], $id_server);
array_push($arg['ARG'], $fileid);
$res_servValues = mysql2_query_secure($arg['SQL'], $_SESSION['OCS']["readServer"], $arg['ARG']);
//echo $sql_servValues."<br><br>";
while ($val_servValues = mysql_fetch_array($res_servValues)) {
$tab_serValues[$val_servValues[$rule_detail['compto']]] = $val_servValues[$id_server];
$correspond_servers[$val_servValues[$id_server]] = $val_servValues['id_download_enable'];
}
//for machines
if ($rule_detail['cfield'] == "NAME" or $rule_detail['cfield'] == "WORKGROUP" or $rule_detail['cfield'] == "USERID") {
$tablefield = "hardware";
$id_mach = "ID";
}
if ($rule_detail['cfield'] == "IPSUBNET" or $rule_detail['cfield'] == "IPADDRESS") {
$tablefield = "networks";
$id_mach = "HARDWARE_ID";
}
$sql_machValue = "select %s,%s from %s where %s in ";
$arg_machValue = array($rule_detail['cfield'], $id_mach, $tablefield, $id_mach);
$arg = mysql2_prepare($sql_machValue, $arg_machValue, $list_id_hardware);
$res_machValue = mysql2_query_secure($arg['SQL'], $_SESSION['OCS']["readServer"], $arg['ARG']);
//print_r($tab_serValues);
while ($val_machValue = mysql_fetch_array($res_machValue)) {
if ($rule_detail['op'] == "EGAL") {
//echo "<br>".$val_machValue[$rule_detail['cfield']]."<br>";
//cas of egal
if (isset($tab_serValues[$val_machValue[$rule_detail['cfield']]])) {
$tab_final[$val_machValue[$id_mach]] = $correspond_servers[$tab_serValues[$val_machValue[$rule_detail['cfield']]]];
$verif_idMach[$val_machValue[$id_mach]] = $val_machValue[$id_mach];
} else {
$not_match[$val_machValue[$id_mach]] = $val_machValue[$id_mach];
//$nb_notMatch++;
}
} elseif ($rule_detail['op'] == "DIFF") {
if (!isset($tab_serValues[$val_machValue[$rule_detail['cfield']]])) {
$tab_final[$val_machValue[$id_mach]] = $correspond_servers[$tab_serValues[$val_machValue[$rule_detail['cfield']]]];
$verif_idMach[$val_machValue[$id_mach]] = $val_machValue[$id_mach];
} else {
$not_match[$val_machValue[$id_mach]] = $val_machValue[$id_mach];
//$nb_notMatch++;
}
}
}
if (isset($verif_idMach)) {
$sql_verif = "select d.hardware_id as hardware_id\n\t\t\t from devices d,download_enable d_e \n\t\t\t where d.ivalue=d_e.id and fileid=%s\n\t\t\t\tAND d.HARDWARE_ID in ";
$arg_verif = array($fileid);
$arg = mysql2_prepare($sql_verif, $arg_verif, $verif_idMach);
$arg['SQL'] .= " and d.name='DOWNLOAD'";
$res_verif = mysql2_query_secure($arg['SQL'], $_SESSION['OCS']["readServer"], $arg['ARG']);
//recup�ration des machines en doublon
while ($val_verif = mysql_fetch_array($res_verif)) {
//cr�ation du tableau de doublon
$exist[$val_verif['hardware_id']] = $val_verif['hardware_id'];
//suppression des doublons
//unset($tab_final[$val_verif['hardware_id']]);
//$nb_exist++;
}
//suppression des doublons pour remettre le statut a attente de notification
if ($exist != '') {
desactive_mach_serv(implode(',', $exist), $fileid);
}
//insertion en base
$nb_insert = 0;
foreach ($tab_final as $key => $value) {
$query = "INSERT INTO devices(HARDWARE_ID, NAME, IVALUE) VALUES('%s', '%s','%s')";
$arg = array($key, 'DOWNLOAD', $value);
mysql2_query_secure($query, $_SESSION['OCS']["writeServer"], $arg);
//.........这里部分代码省略.........
示例12: add_rule
function add_rule($RULE_NAME, $RULE_VALUES, $ID_RULE = '')
{
global $l, $protectedPost;
$rule_exist = verify_name($RULE_NAME);
if ($rule_exist == 'NAME_NOT_EXIST') {
//verify this id is new
$sql = "select id from download_affect_rules where id='%s'";
$arg = $ID_RULE;
$result_id = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg);
$id_exist = mysqli_fetch_object($result_id);
//generate id
if (!is_numeric($ID_RULE) or $ID_RULE == '' or isset($id_exist->id)) {
$sql_new_id = "select max(RULE) as ID_RULE from download_affect_rules";
$result_new_id = mysql2_query_secure($sql_new_id, $_SESSION['OCS']["readServer"]);
$new_id = mysqli_fetch_object($result_new_id);
$ID_RULE = $new_id->ID_RULE;
$ID_RULE++;
}
//insert new rule
$i = 1;
while ($RULE_VALUES['PRIORITE_' . $i]) {
if ($RULE_VALUES['CFIELD_' . $i] != "") {
$sql_insert_rule = "insert into download_affect_rules (RULE,RULE_NAME,PRIORITY,CFIELD,OP,COMPTO,SERV_VALUE) \n\t\t\t\tvalue (%s,'%s',%s,'%s','%s','%s','%s')";
$arg = array($ID_RULE, $protectedPost['RULE_NAME'], $RULE_VALUES['PRIORITE_' . $i], $RULE_VALUES['CFIELD_' . $i], $RULE_VALUES['OP_' . $i], $RULE_VALUES['COMPTO_' . $i], $RULE_VALUES['COMPTO_TEXT_' . $i]);
mysql2_query_secure($sql_insert_rule, $_SESSION['OCS']["writeServer"], $arg);
}
$i++;
}
} else {
echo msg_error($l->g(670));
}
}
示例13: array
*/
//origin = workflow teledeploy
if ($protectedGet['prov'] == "dde_wk") {
$sql = "select FILE,FILE_NAME,FILE_TYPE,FILE_SIZE\n\t\t\t FROM temp_files \n\t\t\t where id = '%s'";
$arg = array($protectedGet["value"]);
}
if ($protectedGet['prov'] == "agent") {
$sql = "select %s as FILE,name as FILE_NAME from deploy where name = '%s'";
$arg = array('content', $protectedGet["value"]);
}
if ($protectedGet['prov'] == "ssl") {
$sql = "select FILE,FILE_NAME from ssl_store where id = '%s'";
$arg = array($protectedGet["value"]);
}
if (isset($sql) and $sql != '') {
$res_document_root = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg);
$val_document_root = mysqli_fetch_array($res_document_root);
if (!isset($val_document_root['FILE_TYPE']) or $val_document_root['FILE_TYPE'] != '') {
$val_document_root['FILE_TYPE'] = "application/force-download";
}
if (!isset($val_document_root['FILE_SIZE']) or $val_document_root['FILE_SIZE'] != '') {
$val_document_root['FILE_SIZE'] = strlen($val_document_root['FILE']);
}
}
if (isset($val_document_root['FILE_NAME'])) {
// iexplorer problem
if (ini_get("zlib.output-compression")) {
ini_set("zlib.output-compression", "Off");
}
header("Pragma: public");
header("Expires: 0");
示例14: mysqli_connect
$msg_header_error_sol[] = $l->g(2023);
}
//defaut user already exist on databases?
try {
$link_read = mysqli_connect(SERVER_READ, DFT_DB_CMPT, DFT_DB_PSWD);
$link_write = mysqli_connect(SERVER_WRITE, DFT_DB_CMPT, DFT_DB_PSWD);
mysqli_select_db($link_read, DB_NAME);
mysqli_select_db($link_write, DB_NAME);
$msg_header_error[] = $l->g(2024) . ' ' . DB_NAME;
$msg_header_error_sol[] = $l->g(2025);
} catch (Exception $e) {
}
//admin user already exist on data base with defaut password?
$reqOp = "SELECT id,user_group FROM operators WHERE id='%s' and passwd ='%s'";
$arg_reqOp = array(DFT_GUI_CMPT, md5(DFT_GUI_PSWD));
$resOp = mysql2_query_secure($reqOp, $_SESSION['OCS']["readServer"], $arg_reqOp);
$rowOp = mysqli_fetch_object($resOp);
if (isset($rowOp->id)) {
$msg_header_error[] = $l->g(2026);
$msg_header_error_sol[] = $l->g(2027);
}
/***************************************************** WARNING MESSAGES *****************************************************/
$msg_header_warning = array();
//Demo mode activate?
if (DEMO) {
$msg_header_warning[] = $l->g(2104) . " " . GUI_VER_SHOW . "<br>";
}
if ($_SESSION['OCS']['LOG_GUI'] == 1) {
//check if the GUI logs directory is writable
$rep_ok = is_writable($_SESSION['OCS']['LOG_DIR']);
if (!$rep_ok) {
示例15: connexion_local_read
//$base = 'OTHER';
$base = "OCS";
connexion_local_read();
mysql_select_db($db_ocs, $link_ocs);
$sql_black = "select SUBNET,MASK from blacklist_subnet";
$res_black = mysql2_query_secure($sql_black, $link_ocs);
while ($row = mysql_fetch_object($res_black)) {
$subnet_to_balcklist[$row->SUBNET] = $row->MASK;
}
$req = "select distinct ipsubnet,s.name,s.id \n\t\t\tfrom networks n left join subnet s on s.netid=n.ipsubnet\n\t\t\t,accountinfo a\n\t\twhere a.hardware_id=n.HARDWARE_ID \n\t\t\tand n.status='Up'";
if (isset($_SESSION['OCS']["mesmachines"]) and $_SESSION['OCS']["mesmachines"] != '' and $_SESSION['OCS']["mesmachines"] != 'NOTAG') {
$req .= "\tand " . $_SESSION['OCS']["mesmachines"] . " order by ipsubnet";
} else {
$req .= " union select netid,name,id from subnet";
}
$res = mysql2_query_secure($req, $link_ocs) or die(mysql_error($link_ocs));
while ($row = mysql_fetch_object($res)) {
unset($id);
$list_subnet[] = $row->ipsubnet;
/* foreach ($subnet_to_balcklist as $key=>$value){
if ($key == $row -> ipsubnet)
$id='--'.$l->g(703).'--';
}
*/
/*
applied again patch of revision 484 ( fix bug: https://bugs.launchpad.net/ocsinventory-ocsreports/+bug/637834 )
*/
if (is_array($subnet_to_balcklist)) {
foreach ($subnet_to_balcklist as $key => $value) {
if ($key == $row->ipsubnet) {
$id = '--' . $l->g(703) . '--';