<?php
function add_where_create($http_arg) {
	$add_where = "";
	if ($http_arg['ac'] <> "") {
		if ($add_where <> "") {
			$add_where .= " and ";
		}
		$add_where .= " id_account = '".$http_arg['ac']."'";
	}
	if ($http_arg['del'] <> "on") {
		if ($add_where <> "") {
			$add_where .= " and ";
		}
		$add_where .= " c_delete = 0";
	}
	return ($add_where);
}
function add_my_filter($http_arg) {
?>
	<div>
<script language="JavaScript">
<!--
function SelectionAccount(form, sel) {
	for (i = 0; i < sel.options.length; i++) {
		if (sel.options[i].selected == true) {
			window.location.href = "<?= $_SERVER['SCRIPT_NAME'] ?>?ac=" + escape(sel.options[i].value) + "&<?= query_from_http_arg_pool($http_arg, 'ac') ?>";
		}
	}
}
function accountReset() {
	window.location.href = "<?= $_SERVER['SCRIPT_NAME'] ?>?<?= query_from_http_arg_pool($http_arg, 'ac') ?>";
}
function CheckboxDelView(onOff)
{
	if (onOff == 'on') {
		window.location.href = "<?= $_SERVER['SCRIPT_NAME'] ?>?del=off&<?= query_from_http_arg_pool($http_arg, 'del') ?>";
	} else {
		window.location.href = "<?= $_SERVER['SCRIPT_NAME'] ?>?del=on&<?= query_from_http_arg_pool($http_arg, 'del') ?>";
	}
}
//-->
</script>
<?php
	$sqlsel = 'SELECT m_account.id_account, m_account.c_handle';
	$sqlsel .= ' FROM (SELECT distinct id_account FROM m_bbs) A';
	$sqlsel .= ' JOIN '._DB_ACCOUNT_SCHEMA.'.m_account ON '._DB_ACCOUNT_SCHEMA.'.m_account.id_account = A.id_account';
	$rs_sel = my_mysql_query($sqlsel);
?>
	投稿者：<select name="account" class="<? if ($http_arg['ac'].'' <> '') echo 'mp_list_filter_true'; ?>" onChange="SelectionAccount(this.form, this)">
		<option value="" class="mp_list_filter_false">すべて
<?php
		while ($rec_sel=mysql_fetch_array($rs_sel)) {
?>
		<option value="<?= $rec_sel['id_account'] ?>"<?= $rec_sel['id_account'] == $http_arg['ac'] ? ' selected class="mp_list_filter_true"' : ' class="mp_list_filter_false"' ?>><?= my_htmlspecialchars($rec_sel['c_handle']) ?>
<?php
		}
?>
	</select>
	<input type="button" name="" value="リセット" onClick="accountReset()">&nbsp;&nbsp;
	<input type="checkbox" name="" value="on" onClick="CheckboxDelView('<?= $http_arg['del'] ?>')"<?= $http_arg['del'] == 'on' ? ' checked' : '' ?>>削除済み投稿を表示

<?php
}
?>
