示例#1
0
function login($id, $passwd, $url)
{
    $dbh = dbconnect();
    $query = "select mem_id,mem_pw from member_data where mem_id='{$id}'";
    $sth = dbquery($dbh, $query);
    if (!$sth) {
        print_msg(mysql_error());
    }
    list($mem_id, $mem_pw) = dbselect($sth);
    dbclose($dbh);
    if (!$mem_id) {
        print_alert("해당 ID가 없습니다.  ", 'back');
    } elseif ($mem_pw != $passwd) {
        print_alert("비밀번호가 틀립니다.  ", 'back');
    } else {
        setcookie("MemberID", $mem_id);
        header("Location: {$url}");
    }
    return;
}
示例#2
0
function check_idnum($idnum)
{
    if (!check_idnum_syntax($idnum)) {
        print_msg("주민등록가 잘못되었습니다.<br>정확히 입력하세요.", 'check_idnum', -1);
    }
    $dbh = dbconnect();
    $idnum2 = substr($idnum, 0, 6) . "-" . substr($idnum, 6, 7);
    $query = "select mem_idnum from member_data where mem_idnum='{$idnum2}'";
    $sth = dbquery($dbh, $query);
    if (!$sth) {
        print_msg(mysql_error());
    }
    list($mem_idnum) = dbselect($sth);
    dbclose($dbh);
    if ($mem_idnum == $idnum2) {
        return false;
    } else {
        return true;
    }
}
示例#3
0
function check_passwd($db, $idx, $rn, $passwd)
{
    /* 데이타 확인 */
    $dbh = dbconnect();
    $table_name = "bbs_" . $db;
    $query = "select idx,replynum,passwd from {$table_name} where idx={$idx} and replynum={$rn}";
    $sth = dbquery($dbh, $query);
    if (!$sth) {
        print_message(mysql_error());
    }
    list($c_idx, $c_replynum, $c_passwd) = dbselect($sth);
    dbclose($dbh);
    /* 존재하지 않을때 */
    if (!$c_idx) {
        return -1;
    }
    /* 비밀번호 확인 */
    if ($passwd == $admin_passwd || $passwd == $c_passwd) {
        return 1;
    }
    return 0;
}
}
// HTML code to display the graph
echo "<TABLE BORDER=\"0\" CELLPADDING=\"10\" CELLSPACING=\"0\" WIDTH=\"100%\">";
echo "<TR>";
echo " <TD ALIGN=\"CENTER\"><IMG SRC=\"" . IMAGES_DIR . "mailscannerlogo.gif\" ALT=\"MailScannr Logo\"></TD>";
echo "</TR>";
echo "<TR>";
//  Check Permissions to see if the file has been written and that apache to read it.
if (is_readable($filename)) {
    echo " <TD ALIGN=\"CENTER\"><IMG SRC=\"" . $filename . "\" ALT=\"Graph\"></TD>";
} else {
    echo "<TD ALIGN=\"CENTER\"> File isn't readable. Please make sure that " . CACHE_DIR . " is readable and writable by MailWatch.";
}
echo "</TR>";
echo "<TR>";
echo "<TD ALIGN=\"CENTER\">";
echo "<TABLE WIDTH=\"500\">";
echo "<TR BGCOLOR=\"#F7CE4A\">";
echo "<TH>Domain</TH>";
echo "<TH>Count</TH>";
echo "<TH>Size</TH>";
echo "</TR>";
for ($i = 0; $i < count($data); $i++) {
    echo "<TR BGCOLOR=\"#EBEBEB\">\n <TD>{$data_names[$i]}</TD>\n <TD ALIGN=\"RIGHT\">" . number_format($data[$i]) . "</TD>\n <TD ALIGN=\"RIGHT\">" . format_mail_size($data_size[$i]) . "</TD>\n</TR>\n";
}
echo "\n  </TABLE>\n </TD>\n</TR>\n</TABLE>";
// Add footer
html_end();
// Close any open db connections
dbclose();
示例#5
0
文件: webgui.php 项目: epto/webgui8
function retGUI() {
	global $CMD;
	global $OUTJSON;
	global $DBH;
	global $STDIN;
	global $APPL;
	global $ini;
	if (!isset($OUTJSON['cmd'])) $OUTJSON['cmd']=array();
	
	endWin();
	
	if (count($CMD)) {
		foreach($CMD as $a) $OUTJSON['cmd'][]= $a;
		}
			
	header("Content-Type: application/json; charset=UTF-8",true);
	header("X-Sid: ".session_id());
	fclose($STDIN);
	if (isset($ini['db']))dbclose($DBH);
	
	exit(json_encode($OUTJSON));
	}
示例#6
0
文件: list.php 项目: puchon/php4-book
    print_alert("DB를 지정하셔야 합니다.", 'back');
    exit;
}
if (!$m) {
    $m = 'list';
}
/* Table 이름 지정 */
$table_name = "bbs_" . $db;
if (!$pn) {
    $pn = 1;
}
/* DB접속 */
$dbh = dbconnect();
$from_string = "from=list";
$start_num = ($pn - 1) * $max_list;
$end_num = $pn * $max_list;
/* 전체 글수 */
$query = "select count(idx) from {$table_name}";
$sth = dbquery($dbh, $query);
list($total_count) = dbselect($sth);
/* 데이터 $max_list 만큼 뽑아서 @LIST_DATA 에 저장. */
$query = "select {$column} from {$table_name} order by idx desc,replynum limit {$start_num},{$max_list}";
$sth = dbquery($dbh, $query);
$i = 0;
$LIST_DATA = array();
while ($field = dbselect($sth)) {
    array_push($LIST_DATA, "{$field['0']}|{$field['1']}|{$field['2']}|\n\t\t{$field['3']}|{$field['4']}|{$field['5']}|{$field['6']}|{$field['7']}");
    $i++;
}
dbclose($dbh);
include "show_list.php";
示例#7
0
文件: index.php 项目: epto/webgui8
				
		WGSession();
		
		$startFile=WGHTTPRedirection();
		if ($lockIntUri) {
			header("Location: /",true);
			exit("Access denied by HTTP policy.");
			}
	}
	
if (!$lockIntUri or isset($ini['logon'])) $_SESSION=array();

header("Content-Type: text/html; charset=UTF-8",true,200);

EWGCacheFont();
if ($DBH) dbclose($DBH);

?><!doctype html>
<html>
	<head>
		<meta charset="utf-8"/>
		<title><?php 
echo htmlspecialchars(@$ini['webgui']['title'], ENT_QUOTES);
?>
</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<?
	if (@$ini['webgui']['cookie']) echo "<script src=\"/sys/cookie.js\"></script>\n";
	?>
	<link rel="stylesheet" href="/sys/win.css">
	<? 
        echo $row["groupid"];
        ?>
</td><td><?php 
        echo $row["groupname"];
        ?>
</td><td><?php 
        echo $row["content"];
        ?>
</td><td><?php 
        echo $row["timewhen"];
        ?>
</td></tr>		
<?php 
        //$i++;
    }
    ?>
	
<tr><td colspan=7>Total: <?php 
    echo $number_of_queries;
    ?>
 records.</td></tr>
<?php 
} else {
    echo "0 results";
}
?>
</table>
</center>
<?php 
dbclose($con);
示例#9
0
文件: createdict.php 项目: n2i/xvnkb
}
$word = '';
$phonetic = '';
$definitions = '';
$n = 0;
$db = dbcreate('./ev.db');
$fp = fopen('ev.src', 'r');
while ($s = fgets($fp)) {
    if (preg_match('|^@([^/]+)(/([^/]+)/)?|', $s, $m)) {
        if ($word != '') {
            if (strpos($word, '00-database-') === 0) {
                // TODO:
                // Database info
            } else {
                $n++;
                dbsave($db, $word, $phonetic, $definitions);
                echo "Count = {$n}\r";
            }
            $definitions = '';
        }
        list($sw, $word, $sp, $phonetic) = $m;
    } else {
        $definitions .= $s;
    }
}
if ($word != '') {
    dbsave($db, $word, $phonetic, $definitions);
}
fclose($fp);
dbclose($db);
示例#10
0
    while ($row = mysqli_fetch_assoc($res)) {
        $mood = new Weekly();
        $mood->date = $row['iter'];
        $mood->val = getMood($row['mood'], $row['count']);
        $moods[] = $mood;
    }
    /*  $moods=array();
      $i=0;
      for($i=0; $i<3; $i++)
      {
        $mood = new Weekly();
        $mood->date = $i;
        $mood->val = $i*20;
        $moods[] = $mood;
      }
    */
    echo json_encode($moods);
}
switch ($type) {
    case "day":
        dayAnalysis();
        break;
    case "hourly":
        hourlyAnalysis();
        break;
    case "week":
        weekAnalysis();
        break;
}
dbclose($conn);
示例#11
0
function doit($input)
{
    global $fp;
    if (!($fp = popen($input, 'r'))) {
        die("Cannot open pipe");
    }
    dbconn();
    $lines = 1;
    while ($line = fgets($fp, 2096)) {
        // Reset variables
        unset($parsed, $postfix, $_timestamp, $_host, $_type, $_msg_id, $_relay, $_dsn, $_status, $_delay);
        $parsed = new syslog_parser($line);
        $_timestamp = mysql_real_escape_string($parsed->timestamp);
        $_host = mysql_real_escape_string($parsed->host);
        // Postfix
        if ($parsed->process == 'postfix/smtp' && class_exists('postfix_parser')) {
            $postfix = new postfix_parser($parsed->entry);
            if (DEBUG) {
                print_r($postfix);
            }
            $_msg_id = mysql_real_escape_string($postfix->id);
            // Milter-ahead rejections
            if (preg_match('/Milter: /i', $postfix->raw) && preg_match('/(rejected recipient|user unknown)/i', $postfix->entries['reject'])) {
                $_type = mysql_real_escape_string('unknown_user');
                $_status = mysql_real_escape_string(get_email($postfix->entries['to']));
            }
            // Unknown users
            if (preg_match('/user unknown/i', $postfix->entry)) {
                // Unknown users
                $_type = mysql_real_escape_string('unknown_user');
                $_status = mysql_real_escape_string($postfix->raw);
            }
            // you can use these matches to populate your table with all the various reject reasons etc., so one could get stats about MTA rejects as well
            // example
            if (preg_match('/NOQUEUE/i', $postfix->entry)) {
                if (preg_match('/Client host rejected: cannot find your hostname/i', $postfix->entry)) {
                    $_type = mysql_real_escape_string('unknown_hostname');
                } else {
                    $_type = mysql_real_escape_string('NOQUEUE');
                }
                $_status = mysql_real_escape_string($postfix->raw);
            }
            // Relay lines
            if (isset($postfix->entries['relay']) && isset($postfix->entries['status'])) {
                $_type = mysql_real_escape_string('relay');
                $_delay = mysql_real_escape_string($postfix->entries['delay']);
                $_relay = mysql_real_escape_string(get_ip($postfix->entries['relay']));
                $_dsn = mysql_real_escape_string($postfix->entries['dsn']);
                $_status = mysql_real_escape_string($postfix->entries['status']);
            }
        }
        if (isset($_type)) {
            dbquery("REPLACE INTO mtalog VALUES (FROM_UNIXTIME('{$_timestamp}'),'{$_host}','{$_type}','{$_msg_id}','{$_relay}','{$_dsn}','{$_status}','{$_delay}')");
        }
        $lines++;
    }
    dbclose();
    pclose($fp);
}
示例#12
0
function dbtest()
{
    if ($dbc = @mysql_connect(DB_HOST, DB_USER, DB_PASSWORD)) {
        if (!mysql_select_db(DB_NAME)) {
            $error_str = "Error: Could not select database: " . dberror();
        } else {
            dbclose($dbc);
            return true;
        }
    } else {
        $error_str = "Error: Could not connect to database: " . dberror();
    }
    return false;
}
示例#13
0
function set_start($idx)
{
    global $URL, $pn;
    $dbh = dbconnect();
    $query = "select poll_idx,status from poll_data where poll_idx={$idx}";
    $sth = dbquery($dbh, $query);
    list($poll_idx, $edate) = dbselect($sth);
    if (!$poll_idx) {
        print_alert("존재하지 않는 데이터입니다.   ", 'back');
        exit;
    } elseif ($status == 1) {
        print_alert("현재 설문중입니다.   ", 'back');
        exit;
    }
    /* 설문 재개 */
    $query = "update poll_data set status='1' where poll_idx={$idx}";
    $sth = dbquery($dbh, $query);
    if (!$sth) {
        $msg = "에러가 발생하였습니다.<br><br>\n" . mysql_error();
        print_message($msg);
    } else {
        header("Location: {$URL['list']}?pn={$pn}");
        exit;
    }
    dbclose($dbh);
    exit;
}