Location: PHPKode > scripts > Linker IMG > linker-img/manage/mail_select.php
<?php

//=====================================
// LINKER Category Engine
//=====================================
// Filename : mail_select.php
// Path  : Manage directory
// last update : 2002/07/13
// Desc : Selected mail Send
//=====================================

//=====================================
// File include part
//=====================================

include ("./authen.php");
include ("../function/$Sdb_type.php"); 
include ("../function/main_func.php"); 
include ("../$Slang/m_common.php"); 

$db = new DB_Sql($Sdb_host,$Sdb_user,$Sdb_pass,$Sselect_db);

//=====================================
// Search from
//=====================================

if (!$switch) {

$parent = view_category("",1);

print <<<EOF
<html>
<head>
<LINK rel='stylesheet' type='text/css' href='./linker.css'>
<meta http-equiv='Content-Type' content='text/html; charset=$Scharset'>
</head>

<body bgcolor="#E9E9E9">
<form action='mail_select.php' method='post'>
<input type="hidden" name="switch" value="search">


<table border=0 cellpadding=0 cellspacing=1>
<tr>
<td colspan=2>

	<table width="100%" border="1"><tr><td bgcolor="#000066" align="center">
	<b><font color="white" size="2">$l_select_mail</font></b>
	</td></tr></table>

</td>	</tr>

<tr><td colspan=2 width=500>&nbsp;</td></tr>

<tr>
<td width='100' bgcolor='#F6F6F6' height='24'><font size='2'>&nbsp;$l_sid</font></td>
<td bgcolor='#F6F6F6'>&nbsp;<input type='text' name='sid'></td>
</tr>

<tr>
<td width='100' bgcolor='#F6F6F6' height='24'><font size='2'>&nbsp;$l_cat</font></td>
<td bgcolor='#F6F6F6'>&nbsp;<font size=2><select name='parent'>$parent</select></td>
</tr>

<tr>
<td width='100' bgcolor='#F6F6F6' height='24'><font size='2'>&nbsp;$l_title</font></td>
<td bgcolor='#F6F6F6'>&nbsp;<input type='text' name='title' size=30></td>
</tr>

<tr>
<td width='100' bgcolor='#F6F6F6' height='24'><font size='2'>&nbsp;$l_source</font></td>
<td bgcolor='#F6F6F6'>&nbsp;<input type='text' name='url' size=30></td>
</tr>

<tr>
<td width='100' bgcolor='#F6F6F6' height='24'><font size='2'>&nbsp;$l_scont</font></td>
<td bgcolor='#F6F6F6'>&nbsp;<input type='text' name='scont' size=30></td>
</tr>

<tr>
<td width='100' bgcolor='#F6F6F6' height='24'><font size='2'>&nbsp;$l_name</font></td>
<td bgcolor='#F6F6F6'>&nbsp;<input type='text' name='name' size=30></td>
</tr>

<tr>
<td width='100' bgcolor='#F6F6F6' height='24'><font size='2'>&nbsp;$l_email</font></td>
<td bgcolor='#F6F6F6'>&nbsp;<input type='text' name='email' size=30></td>
</tr>

<tr>
<td width='100' bgcolor='#F6F6F6' height='24'><font size='2'>&nbsp;$l_search_type</font></td>
<td bgcolor='#F6F6F6'><font size='2'>&nbsp;<select name='view_type'><option>or</option>
<option>and</option></select></font></td>
</tr>

<tr>
<td width='100' bgcolor='#F6F6F6' height='24'><font size='2'>&nbsp;$l_del_dup</font></td>
<td bgcolor='#F6F6F6'><font size='2'>&nbsp;<select name='dup_type'><option>Y</option><option>N</option>
</select></font></td>
</tr>

<tr>
<td colspan=2 align=center><font size='2'>
<input type='submit' value='  $l_submit  ' class=cinput>
<input type='button' value='  $l_reset  '  onClick="reset()" class=cinput>
</font></td>
</tr>

</table></form>
</body></html>

EOF;
}

//=====================================
// Print Search result part
//=====================================


if ($switch=="search") {

if (!$sid && !$title  && !$url && !$parent && !$scont && !$name && !$email && $view_type)  errmsg($l_error_nofield);
if ($sid) {   if ($cque) $cque.="$view_type "; $cque.="sid='$sid' ";}
if ($title) {  if ($cque) $cque.="$view_type "; $cque.="title like '%$title%' ";}
if ($url) {  if ($cque) $cque.="$view_type "; $cque.="url like '%$url%' ";}
if ($parent) {    if ($cque) $cque.="$view_type "; $cque.="parent='$parent' ";} 
if ($scont) {  if ($cque) $cque.="$view_type "; $cque.="scont like '%$onecon%' ";}
if ($name) {  if ($cque) $cque.="$view_type ";  $cque.="name like '%$name%' ";} 
if ($email) {  if ($cque) $cque.="$view_type ";  $cque.="email like '%$email%' ";}
if ($dup_type =="Y") $dup = "group by email";

$db->query("select email from LINKER_LINK where email !='' and ($cque) $dup order by sid");
//echo "select email from LINKER_LINK where email !='' and ($cque) $dup order by sid";exit;
$view_total = $db->numrow;


//=====================================
// no mail address
//=====================================

if (!$view_total) {

print <<<EOF
<html>
<head>
<LINK rel='stylesheet' type='text/css' href='./linker.css'>
<meta http-equiv='Content-Type' content='text/html; charset=$Scharset'>
</head>


<body bgcolor="#E9E9E9">
<table border=0 cellpadding=0 cellspacing=1>
<tr>
<td colspan=2>

	<table width="500" border="1"><tr><td bgcolor="#000066" align="center">
	<b><font color="white" size="2">$l_nomail_add</font></b>
	</td></tr></table>

</td>	</tr>

<tr><td colspan=2 width=500>&nbsp;</td></tr>

<tr>
<td align=center><input type=button onClick="history.back()" value="$l_research" class=cinput></td>
</tr>
</table>
</body></html>
EOF;
exit;
}

//=====================================
// print search result
//=====================================

print <<<EOF

<html>
<head>
<title></title>
<LINK rel='stylesheet' type='text/css' href='./linker.css'>
<meta http-equiv='Content-Type' content='text/html; charset=$Scharset'>
<SCRIPT LANGUAGE="JavaScript">
<!--
function selectall()
{
	 
	for( var i=0; i<document.myform.elements.length; i++) {
		var ele = document.myform.elements[i];
		if(ele.type == 'checkbox')
			{ele.checked = true;}
	}
	return;

}

function selectnone()
{
	 
	for( var i=0; i<document.myform.elements.length; i++) {
		var ele = document.myform.elements[i];
		if(ele.type == 'checkbox')
			{ele.checked = false;}
	}
	return;

}

//-->
</SCRIPT>
</HEAD>

<body bgcolor="#E9E9E9">
<form action="mail_select.php" method='post' name='myform'>
<input type="hidden" name="switch" value="send">

<table border=0 cellpadding=0 cellspacing=1>
<tr>
<td colspan=2>

	<table width="100%" border="1"><tr><td bgcolor="#000066" align="center">
	<b><font color="white" size="2">$view_total $l_total_num</font></b>
	</td></tr></table>

</td>	</tr>

<tr><td colspan=2 width=500>&nbsp;</td></tr>

<tr><td colspan=2 align=right bgcolor='#E0E0E0' height=24><font size=2>
<input type="radio" name="checkhtml" value="" checked>PLAIN&nbsp;
<input type="radio" name="checkhtml" value="on">HTML&nbsp;
</font></td></tr>

<tr>
<td bgcolor='#F6F6F6' height='24' width=100>&nbsp;<font size='2'>$l_mail_title</font></td>
<td bgcolor='#F6F6F6'><font size='2'><input type='text' name='title' size='30' style="width:350px"></font></td>
</tr>

<tr>
<td bgcolor='#F6F6F6' height='24' width=100>&nbsp;<font size='2'>$l_mail_content</font></td>
<td bgcolor='#F6F6F6'><font size='2'><textarea name='content' rows='12' cols='30' style="width:350px"></textarea></font></td>
</tr>

<tr><td bgcolor='#F6F6F6' height='24' align='center' colspan=2>
<input type='submit' value='$l_sendmail' class=cinput>
<input type='button' value='$l_research' onClick="history.back()" class=cinput>
</td></tr>


<tr><td colspan=2>&nbsp;</td></tr>

<tr><td  align='right' bgcolor='#E0E0E0' colspan=2>
<input type='button' onClick='javascript:selectall()' value='$l_select_all ' class=cinput>
<input type='button' onClick='javascript:selectnone()' value='$l_select_none' class=cinput>
</td></tr>

EOF;


while ($row = $db->nrecord())
if ($view_type) 
print <<<EOF
<tr><td bgcolor='#F6F6F6' colspan=2>
<font size='2'><input type='checkbox' name='mailaddr[]' value='$row[email]' checked>
$row[email]</font></td></tr>
EOF;


print <<<EOF

<tr><td  align='right' bgcolor='#E0E0E0' colspan=2>
<input type='button' onClick='javascript:selectall()' value='$l_select_all ' class=cinput>
<input type='button' onClick='javascript:selectnone()' value='$l_select_none' class=cinput>
</td></tr>

</table></form>

EOF;

}

//=====================================
// Send mail part
//=====================================

if ($switch == "send") {

$start_time = time();

print <<<EOF
<html>
<head>
<LINK rel='stylesheet' type='text/css' href='./linker.css'>
<meta http-equiv='Content-Type' content='text/html; charset=$Scharset'>
</head>
<body bgcolor="#E9E9E9">

<table border=0 cellpadding=0 cellspacing=1>
<tr>
<td colspan=2>

<table width="100%" border="1"><tr><td bgcolor="#000066" align="center">
<b><font color="white" size="2">$l_send_txt</font></b>
</td></tr></table>

</td>	</tr>

<tr><td colspan=2 width=500>&nbsp;</td></tr>
</table>

EOF;



for ($i=0; $i<100; $i++) { echo ("    ");  flush();}

for ($i=0;$i<count($mailaddr),$mailaddr[$i] ;$i++) {
send_mail(trim($mailaddr[$i]),$title,$content,$checkhtml);

print <<<EOF
<table border='0' cellpadding=0 cellspacing=1 width='500' ><tr>
<td bgcolor='#FFFFFF' height='24'>&nbsp;<font size=2>$mailaddr[$i]</font></td>
</table>

EOF;
flush(); 
usleep(5000);
}

$spend_time = time() - $start_time;

print <<<EOF

<table border='0' cellpadding=0 cellspacing=1 width='500' >
<tr><td bgcolor='#E0E0E0' height='24'><font size='2'>&nbsp; $total $i $l_mail_result</font></td></tr>
<tr><td bgcolor='#E0E0E0'  height='24'><font size='2'>&nbsp; $l_esttime : $spend_time $l_sec</font></td></tr>
</table></body></html>
</body></html>

EOF;

} // end send

?>
Return current item: Linker IMG