本文整理汇总了PHP中prepare_sql_tab函数的典型用法代码示例。如果您正苦于以下问题:PHP prepare_sql_tab函数的具体用法?PHP prepare_sql_tab怎么用?PHP prepare_sql_tab使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prepare_sql_tab函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: find_all_field_by_tab
function find_all_field_by_tab($id_tab)
{
$list_fields = array('field', 'id', 'tab');
$sql = prepare_sql_tab($list_fields);
$id_tab = prepare_id($id_tab);
if (is_array($id_tab)) {
$sql['SQL'] .= " from downloadwk_fields where tab in ";
$sql_all_field = mysql2_prepare($sql['SQL'], $sql['ARG'], $id_tab);
$result = mysql2_query_secure($sql_all_field['SQL'], $_SESSION['OCS']["readServer"], $sql_all_field['ARG']);
while ($val = mysql_fetch_array($result)) {
$array[$val['id']] = $val['id'];
}
return $array;
}
return false;
}
示例2: ob_start
ob_start();
$ajax = true;
} else {
$ajax = false;
}
print_item_header($l->g(1220));
if (!isset($protectedPost['SHOW'])) {
$protectedPost['SHOW'] = 'NOSHOW';
}
$table_name = "sd_cartridges";
$tab_options = $protectedPost;
$tab_options['form_name'] = $form_name;
$tab_options['table_name'] = $table_name;
$list_fields = array($l->g(66) => 'TYPE', $l->g(1104) => 'LEVEL', $l->g(1225) => 'MAXCAPACITY', $l->g(1226) => 'COLOR', $l->g(53) => 'DESCRIPTION');
//$list_fields['SUP']= 'ID';
$sql = prepare_sql_tab($list_fields);
$list_fields["PERCENT_BAR"] = 'CAPACITY';
$tab_options["replace_query_arg"]['CAPACITY'] = "round(100-(LEVEL*100/MAXCAPACITY))";
$list_col_cant_del = $list_fields;
$default_fields = $list_fields;
$sql['SQL'] = $sql['SQL'] . " , round(100-(LEVEL*100/MAXCAPACITY)) AS CAPACITY FROM %s WHERE (snmp_id=%s)";
$sql['ARG'][] = 'snmp_cartridges';
$sql['ARG'][] = $systemid;
$tab_options['ARG_SQL'] = $sql['ARG'];
$tab_options['LBL']['PERCENT_BAR'] = $l->g(1125);
$tab_options['REPLACE_WITH_LIMIT']['DOWN'][$l->g(1104)] = 0;
$tab_options['REPLACE_WITH_LIMIT']['DOWNVALUE'][$l->g(1104)] = $msq_tab_error;
$tab_options['REPLACE_WITH_LIMIT']['DOWN'][$l->g(1225)] = 0;
$tab_options['REPLACE_WITH_LIMIT']['DOWNVALUE'][$l->g(1225)] = $msq_tab_error;
$tab_options['REPLACE_WITH_LIMIT']['DOWN']['PERCENT_BAR'] = 0;
$tab_options['REPLACE_WITH_LIMIT']['DOWNVALUE']['PERCENT_BAR'] = $msq_tab_error;
示例3: delkey
delkey($protectedPost['SUP_PROF']);
$tab_options['CACHE'] = 'RESET';
} else {
if (isset($protectedPost['del_check']) and $protectedPost['del_check'] != '') {
// delete multiple selected rows
$ids = explode(',', $protectedPost['del_check']);
foreach ($ids as $id) {
delkey($id);
}
$tab_options['CACHE'] = 'RESET';
}
}
$list_fields = array('ID' => "id", $l->g(49) => "name", 'REGTREE' => "REGTREE", 'REGKEY' => "REGKEY", 'REGVALUE' => "REGVALUE", 'SUP' => "id", 'MODIF' => "id", 'CHECK' => 'id');
$list_col_cant_del = array('SUP' => 'SUP', 'MODIF' => 'MODIF', $l->g(49) => $l->g(49), 'CHECK' => 'CHECK');
$default_fields = array($l->g(49) => "name", 'REGTREE' => "REGTREE", 'REGKEY' => "REGKEY", 'REGVALUE' => "REGVALUE", 'SUP' => "id", 'MODIF' => "id", 'CHECK' => "id");
$sql = prepare_sql_tab($list_fields, array('SUP', 'MODIF', 'CHECK'));
$tab_options['ARG_SQL'] = $sql['ARG'];
$sql['SQL'] .= " from regconfig ";
$tab_options['FILTRE']['name'] = $l->g(49);
$tab_options['FILTRE']['REGKEY'] = 'REGKEY';
$tab_options['FILTRE']['REGVALUE'] = 'REGVALUE';
$tab_options['REPLACE_VALUE']['REGTREE'] = $list_registry_key;
$tab_options['LBL_POPUP']['SUP'] = 'name';
$tab_options['form_name'] = $form_name;
$tab_options['table_name'] = $table_name;
ajaxtab_entete_fixe($list_fields, $default_fields, $tab_options, $list_col_cant_del);
$img['image/delete.png'] = $l->g(162);
del_selection($form_name);
} elseif ($protectedPost['tab'] == 'ADD') {
if (isset($protectedPost['Valid_modif'])) {
$form_values = array("NAME" => $protectedPost["NAME"], "REGTREE" => $protectedPost["REGTREE"], "REGKEY" => $protectedPost["REGKEY"], "REGVALUE" => $protectedPost["REGVALUE"]);
示例4: array
//only for admins
if ($_SESSION['OCS']['CONFIGURATION']['GROUPS'] == "YES") {
if ($protectedPost['onglet'] == "STAT") {
$list_fields['CHECK'] = 'ID';
}
$list_fields['SUP'] = 'ID';
$tab_options['LBL_POPUP']['SUP'] = 'NAME';
$tab_options['LBL']['SUP'] = $l->g(122);
}
//changement de nom � l'affichage des champs
$tab_options['LBL']['CHECK'] = $l->g(52);
$tab_options['LBL']['GROUP_NAME'] = $l->g(49);
$table_name = "LIST_GROUPS";
$default_fields = array('GROUP_NAME' => 'GROUP_NAME', 'DESCRIPTION' => 'DESCRIPTION', 'CREATE' => 'CREATE', 'NBRE' => 'NBRE', 'SUP' => 'SUP', 'CHECK' => 'CHECK');
$list_col_cant_del = array('GROUP_NAME' => 'GROUP_NAME', 'SUP' => 'SUP', 'CHECK' => 'CHECK');
$query = prepare_sql_tab($list_fields, array('SUP', 'CHECK', 'NBRE'));
$tab_options['ARG_SQL'] = $query['ARG'];
$querygroup = $query['SQL'];
//requete pour les groupes de serveurs
if ($protectedPost['onglet'] == "SERV") {
$querygroup .= " from hardware h,download_servers ds where ds.group_id=h.id and h.deviceid = '_DOWNLOADGROUP_'";
//calcul du nombre de machines par groupe de serveur
$sql_nb_mach = "SELECT count(*) nb, group_id\n\t\t\t\t\tfrom download_servers group by group_id";
} else {
//requete pour les groupes 'normaux'
$querygroup .= " from hardware h,groups g";
$querygroup .= "\twhere g.hardware_id=h.id and h.deviceid = '_SYSTEMGROUP_' ";
if ($protectedPost['onglet'] == "DYNA") {
$querygroup .= " and ((g.request is not null and trim(g.request) != '') \n\t\t\t\t\t\t\tor (g.xmldef is not null and trim(g.xmldef) != ''))";
} elseif ($protectedPost['onglet'] == "STAT") {
$querygroup .= " and (g.request is null or trim(g.request) = '')\n\t\t\t\t\t and (g.xmldef is null or trim(g.xmldef) = '') ";
示例5: deleteDid_snmp
$table_name = $form_name;
//delete snmp
if ($protectedPost['SUP_PROF'] != '') {
deleteDid_snmp($protectedPost['SUP_PROF']);
$tab_options['CACHE'] = 'RESET';
}
if (isset($protectedPost['del_check']) and $protectedPost['del_check'] != '') {
deleteDid_snmp($protectedPost['del_check']);
$tab_options['CACHE'] = 'RESET';
}
echo open_form($form_name);
$list_fields = array('TAG' => 'TAG', 'NAME_SNMP' => 'NAME', $l->g(352) => 'UPTIME', $l->g(95) => 'MACADDR', $l->g(34) => 'IPADDR', $l->g(1227) => 'CONTACT', $l->g(295) => 'LOCATION', $l->g(33) => 'DOMAIN', $l->g(66) => 'TYPE', $l->g(1228) => 'SNMPDEVICEID');
$tab_options['FILTRE'] = array_flip($list_fields);
$tab_options['FILTRE']['NAME'] = $l->g(49);
asort($tab_options['FILTRE']);
$list_fields['SUP'] = 'ID';
$list_fields['CHECK'] = 'ID';
$list_col_cant_del = array('SUP' => 'SUP', 'CHECK' => 'CHECK');
$default_fields = array('TAG' => 'TAG', 'NAME_SNMP' => 'NAME_SNMP', $l->g(34) => $l->g(34), $l->g(95) => $l->g(95));
$sql = prepare_sql_tab($list_fields, $list_col_cant_del);
$tab_options['ARG_SQL'] = $sql['ARG'];
$queryDetails = $sql['SQL'] . ",ID from snmp s \n\t\t\t\t\t\tleft join snmp_accountinfo s_a on s.id=s_a.snmp_id ";
$tab_options['LBL_POPUP']['SUP'] = 'NAME';
$tab_options['LBL']['SUP'] = $l->g(122);
$tab_options['LIEN_LBL']['NAME_SNMP'] = 'index.php?' . PAG_INDEX . '=' . $pages_refs['ms_snmp_detail'] . '&head=1&id=';
$tab_options['LIEN_CHAMP']['NAME_SNMP'] = 'ID';
$tab_options['LBL']['NAME_SNMP'] = $l->g(49);
tab_req($table_name, $list_fields, $default_fields, $list_col_cant_del, $queryDetails, $form_name, 95, $tab_options);
$img['image/sup_search.png'] = $l->g(162);
del_selection($form_name);
echo close_form();
示例6: array
$list_fields['MODIF'] = 'e.FILEID';
}
}
$default_fields = array($l->g(1037) => $l->g(1037), $l->g(1039) => $l->g(1039), $l->g(274) => $l->g(274), $l->g(953) . " (KB)" => $l->g(953) . " (KB)", 'SELECT' => 'SELECT');
$list_col_cant_del = array($l->g(1037) => $l->g(1037), 'MODIF' => 'MODIF');
if ($protectedPost['onglet'] != 'SERV_GROUP') {
$default_fields['PACK_LOC'] = 'PACK_LOC';
$list_col_cant_del['PACK_LOC'] = 'PACK_LOC';
}
//$querypack = 'SELECT ';
if ($protectedPost['onglet'] == 'SERV_GROUP') {
$distinct = true;
} else {
$distinct = false;
}
$sql = prepare_sql_tab($list_fields, array('SELECT'), $distinct);
$sql['SQL'] .= " from download_available a, download_enable e ";
if ($protectedPost['onglet'] == 'MACH') {
$sql['SQL'] .= "where a.FILEID=e.FILEID and e.SERVER_ID is null ";
} else {
$sql['SQL'] .= ", hardware h where a.FILEID=e.FILEID and h.id=e.group_id and e.SERVER_ID is not null ";
}
if (isset($fileid_show) and $fileid_show != array()) {
$sql = mysql2_prepare($sql['SQL'], $sql['ARG'], $fileid_show, true);
}
if (isset($_SESSION['OCS']['RESTRICTION']['TELEDIFF_VISIBLE']) and $_SESSION['OCS']['RESTRICTION']['TELEDIFF_VISIBLE'] == "YES") {
$sql['SQL'] .= " and a.comment not like '%s'";
array_push($sql['ARG'], '%[VISIBLE=0]%');
}
$tab_options['QUESTION']['SELECT'] = $l->g(699);
$tab_options['FILTRE'] = array('e.FILEID' => 'Timestamp', 'a.NAME' => $l->g(49));
示例7: array
$list_fields['ZIP'] = 'FILEID';
$list_fields['ACTIVE'] = 'FILEID';
$list_fields['SUP'] = 'FILEID';
$list_fields['CHECK'] = 'FILEID';
$tab_options['LBL_POPUP']['SUP'] = 'NAME';
}
$list_fields['STAT'] = 'FILEID';
$table_name = "LIST_PACK";
$default_fields = array('Timestamp' => 'Timestamp', $l->g(593) => $l->g(593), 'SHOWACTIVE' => 'SHOWACTIVE', 'CHECK' => 'CHECK', 'NOTI' => 'NOTI', 'SUCC' => 'SUCC', 'ERR_' => 'ERR_', 'SUP' => 'SUP', 'ACTIVE' => 'ACTIVE', 'STAT' => 'STAT', 'ZIP' => 'ZIP');
/*if ($show_stats){
$default_fields['NOTI']='NOTI';
$default_fields['SUCC']='SUCC';
$default_fields['ERR_']='ERR_';
}*/
$list_col_cant_del = array('SHOWACTIVE' => 'SHOWACTIVE', 'SUP' => 'SUP', 'ACTIVE' => 'ACTIVE', 'STAT' => 'STAT', 'ZIP' => 'ZIP', 'CHECK' => 'CHECK');
$querypack = prepare_sql_tab($list_fields, array('SELECT', 'ZIP', 'STAT', 'ACTIVE', 'SUP', 'CHECK', 'NO_NOTIF', 'NOTI', 'SUCC', 'ERR_'));
$querypack['SQL'] .= " from download_available ";
if ($protectedPost['SHOW_SELECT'] == 'download') {
$querypack['SQL'] .= " where (comment not like '%s' or comment is null or comment = '')";
} else {
$querypack['SQL'] .= " where comment like '%s'";
}
array_push($querypack['ARG'], "[PACK REDISTRIBUTION%");
$arg_count = array("[PACK REDISTRIBUTION%");
if ($_SESSION['OCS']['profile']->getRestriction('TELEDIFF_VISIBLE', 'YES') == "YES") {
$querypack['SQL'] .= " and comment not like '%s'";
array_push($querypack['ARG'], "%[VISIBLE=0]%");
array_push($arg_count, "%[VISIBLE=0]%");
}
$tab_options['ARG_SQL'] = $querypack['ARG'];
$tab_options['ARG_SQL_COUNT'] = $arg_count;
示例8: add_rule
add_rule($protectedPost['RULE_NAME'], $protectedPost, $protectedPost['OLD_MODIF']);
echo msg_success($l->g(711));
$tab_options['CACHE'] = 'RESET';
} else {
msg_error($l->g(670));
}
}
//form name
$form_name = "rules";
//show all rules
echo open_form($form_name);
$list_fields = array('ID_RULE' => 'RULE', 'RULE_NAME' => 'RULE_NAME', 'SUP' => 'RULE', 'MODIF' => 'RULE');
$table_name = "DOWNLOAD_AFFECT_RULES";
$default_fields = array('ID_RULE' => 'ID_RULE', 'RULE_NAME' => 'RULE_NAME', 'SUP' => 'SUP', 'MODIF' => 'MODIF');
$list_col_cant_del = array('ID_RULE' => 'ID_RULE', 'SUP' => 'SUP', 'MODIF' => 'MODIF');
$sql = prepare_sql_tab($list_fields, array('SUP'));
$sql['SQL'] .= " from download_affect_rules ";
$tab_options['ARG_SQL'] = $sql['ARG'];
$result_exist = tab_req($table_name, $list_fields, $default_fields, $list_col_cant_del, $sql['SQL'], $form_name, 80, $tab_options);
echo "<br>";
//Modif a rule => get this values
if ($protectedPost['MODIF'] != "" and $protectedPost['OLD_MODIF'] != $protectedPost['MODIF']) {
$sql = "select priority,cfield,op,compto,rule_name \n\t\t\t\tfrom download_affect_rules \n\t\t\t where rule='%s' \n\t\t\t\torder by priority";
$arg = $protectedPost['MODIF'];
$res = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg);
$i = 1;
while ($val = mysql_fetch_array($res)) {
$protectedPost['PRIORITE_' . $i] = $val['priority'];
$protectedPost['CFIELD_' . $i] = $val['cfield'];
$protectedPost['OP_' . $i] = $val['op'];
$protectedPost['COMPTO_' . $i] = $val['compto'];
示例9: count
}
}
if (isset($protectedGet['all_computers']) and isset($protectedGet['nb']) and is_numeric($protectedGet['nb']) and $protectedGet['nb'] < 16 and isset($protectedGet['comp']) and $protectedGet['comp'] == "<") {
$sql_liste_soft = "select count(" . $info_name_soft["field_name_soft"] . ") nb," . $info_name_soft["field_name_soft"] . " \n\t\t\t\t\t\tfrom softwares group by " . $info_name_soft["field_name_soft"] . " having nb<%s";
$arg_liste_soft = $protectedGet['nb'];
$result_liste_soft = mysql2_query_secure($sql_liste_soft, $_SESSION['OCS']["readServer"], $arg_liste_soft);
$list_soft = "";
while ($item_liste_soft = mysqli_fetch_object($result_liste_soft)) {
$list_soft[] = $item_liste_soft->{$info_name_soft}["field_name_soft"];
}
$fields = array("a.tag" => $_SESSION['OCS']['TAG_LBL']['TAG'], $alias_name_soft => $l->g(20), "h.name" => $l->g(23), "h.userid" => $l->g(24), "h.description" => $l->g(53), "h.lastdate" => $l->g(728));
/*$result_search_soft = mysql2_query_secure( $sql['SQL'], $_SESSION['OCS']["readServer"],$sql['ARG']);
while($item_search_soft = mysqli_fetch_object($result_search_soft)){
$soft[]=$item_search_soft->name;
}*/
$sql = prepare_sql_tab(array_keys($fields));
$sql['SQL'] .= " from accountinfo a, (select hardware_id, " . $info_name_soft["field_name_soft"] . " as sname from softwares where " . $info_name_soft["field_name_soft"] . " in ";
$sql = mysql2_prepare($sql['SQL'], $sql['ARG'], $list_soft);
$sql['SQL'] .= ") s";
if (isset($_SESSION['OCS']['USE_NEW_SOFT_TABLES']) and $_SESSION['OCS']['USE_NEW_SOFT_TABLES'] == 1) {
$sql['SQL'] .= " left join (select id, name as " . $alias_name_soft . " from " . $info_name_soft['table'] . ") cache on cache.id=s.sname ";
}
$sql['SQL'] .= ",hardware h \n\t\t\t\t\twhere a.hardware_id=h.id and s.hardware_id=h.id ";
if (isset($_SESSION['OCS']['TAGS'])) {
$sql['SQL'] .= " and a.tag in ";
$sql = mysql2_prepare($sql['SQL'], $sql['ARG'], $_SESSION['OCS']['TAGS']);
}
$sql['SQL'] .= " order by h.name";
} else {
$fields = array('nb' => $l->g(55), 'name' => $l->g(20));
}
示例10: mysql2_query_secure
*
* if your version of ocs < 2.0, your tag are in this table but not in accountinfo_config
* so we have to add them.
*
*/
//show all columns in accountinfo table
$sql = "show columns from accountinfo";
$res = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"]);
while ($value = mysqli_fetch_object($res)) {
if ($value->Field != 'HARDWARE_ID' and $value->Field != 'TAG') {
$list_field[$value->Field] = $value->Field;
}
$type_field[$value->Field] = $value->Type;
}
$fields_table = array('ID', 'NAME_ACCOUNTINFO', 'TYPE,NAME', 'ID_TAB', 'COMMENT', 'SHOW_ORDER', 'ACCOUNT_TYPE');
$sql = prepare_sql_tab($fields_table);
$sql['SQL'] .= "from accountinfo_config where ACCOUNT_TYPE='COMPUTERS'";
$res = mysql2_query_secure($sql['SQL'], $_SESSION['OCS']["readServer"], $sql['ARG']);
while ($value = mysqli_fetch_object($res)) {
if (!isset($max_order) or $value->SHOW_ORDER > $max_order) {
$max_order = $value->SHOW_ORDER;
}
if ($value->NAME_ACCOUNTINFO != 'TAG') {
//this column does'nt exist in accountinfo_config
if (!$list_field['fields_' . $value->ID]) {
//add this column in accountinfo_config
$sql_column_account = "ALTER TABLE accountinfo ADD COLUMN %s VARCHAR(255) default NULL";
$arg = "fields_" . $value->ID;
if (isset($protectedPost['EXE']) and $protectedPost['EXE'] != '') {
mysql2_query_secure($sql_column_account, $_SESSION['OCS']["writeServer"], $arg);
addLog('SCRIPT_ADD_COLUMN_ACCOUNTINFO', $arg);