function dbQuery($DBHost, $DBName, $DBUserID, $DBPassWord, $pSQL, $pStopOnError)
{
    //---------open connection and database and return query
    $con = mysql_connect($DBHost, $DBUserID, $DBPassWord) or die("Could not connect to database");
    //mysql_query("SET NAMES utf8");
    //mysql_query("SET CHARACTER_SET utf8");
    mysql_select_db($DBName, $con) or die("Could not select database");
    if ($pStopOnError) {
        //-----stop if there is an error
        $t = mysql_query($pSQL) or die("<HR/>Could not execute : -- <br/>\n<HR/>" . $pSQL);
        //---------log SQL statements
        if (strtoupper(substr(trim($pSQL), 0, 7)) != 'SELECT') {
            $t1 = mysql_query("Select * From zzsys_setup");
            $setup = mysql_fetch_object($t1);
            if ($setup->set_log_sql == '1') {
                $hex = str_hex($pSQL);
                mysql_query("INSERT INTO zzsys_sql_log (sql_sql) VALUES ('{$hex}')");
            }
        }
    } else {
        $t = mysql_query($pSQL);
        //---------log SQL statements
        if (strtoupper(substr(trim($pSQL), 0, 7)) != 'SELECT') {
            $t1 = mysql_query("Select * From zzsys_setup");
            $setup = mysql_fetch_object($t1);
            if ($setup->set_log_sql == '1') {
                $hex = str_hex($pSQL);
                mysql_query("INSERT INTO zzsys_sql_log (sql_sql) VALUES ('{$hex}')");
            }
        }
    }
    return $t;
}
Пример #2
0
// load main config
$conf_lines = file($qpkg_conf["dnsmasq"]["Install_Path"] . "/dnsmasq.conf");
foreach ($conf_lines as $line_num => $line) {
    # there can be multiple consecutive tabs (or spaces) in the config - filter out whitespace.
    $arr = explode("=", $line);
    $arr[0] = trim($arr[0]);
    if (isset($arr[1])) {
        $arr[1] = trim($arr[1]);
    }
    # ctype_space checks for \n\r\t
    if (strlen($line) > 0 && substr($line, 0, 1) == "#" || ctype_space($line) || $line == '') {
        // this is a comment or whitespace line, do nothing.
    } else {
        if (!in_array(sizeof($arr), array(1, 2))) {
            # not a comment or whitespace;
            log_error("config line @{$line_num} '{$line}' (" . str_hex($line) . ") is invalid");
            continue 1;
        } else {
            switch ($arr[0]) {
                case "server":
                    $key = "server";
                    $conf[$key][isset($conf[$key]) ? sizeof($conf[$key]) : 0] = $arr[1];
                    break;
                case "dhcp-option":
                    $key = "dhcp-option";
                    $conf[$key][isset($conf[$key]) ? sizeof($conf[$key]) : 0] = $arr[1];
                    $option = explode(",", $arr[1]);
                    switch ($option[0]) {
                        case "option:router":
                            $conf["dhcp-option-router"] = $option[1];
                            break;
Пример #3
0
					<th data-override="hostname">Hostname</th> 
					<th data-override="fqdn">FQDN (optional)</th> 
				</tr>
			</thead>
			<tbody>
<?php 
foreach ($hostmap_lines as $line_num => $line) {
    # there can be multiple consecutive tabs (or spaces) in the config - filter out whitespace.
    $arr = array_values(array_filter(explode(" ", str_replace(array("\t", ","), " ", $line))));
    # ctype_space checks for \n\r\t
    if (strlen($line) > 0 && substr($line, 0, 1) == "#" || ctype_space($line) || $line == '') {
        // this is a comment or whitespace line, do nothing.
    } else {
        if (!in_array(sizeof($arr), array(2, 3))) {
            # not a comment or whitespace the line doesn't have 2 or 3 commas, error
            log_error("hostmap config line @{$line_num} '{$line}' (" . str_hex($line) . ") is invalid", true);
            continue 1;
        } else {
            echo "\n\t\t\t<tr>\n\t\t\t\t<td>" . $arr[0] . "</td>\n\t\t\t\t<td>" . $arr[1] . "</td>\n\t\t\t\t<td>" . $arr[2] . "</td>\n\t\t\t</tr>\n\t\t";
        }
    }
}
?>
				<tr>
					<td></td>
					<td></td>
					<td></td>
				<tr>
			</tbody>
		</table>
		<div class="floatwrap">