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

//=====================================
// LINKER Category Engine
//=====================================
// Filename : mail_list.php
// Path  : Manage directory
// last update : 2002/03/13
// Desc : All mail Maillint 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);

//=====================================
// Send Form
//=====================================

if (!$switch) {


print <<<EOF

<html>
<head>
<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_list.php?mode=send' 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">$l_mailing_list</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='#E0E0E0' height='24' align='center' colspan=2>
<font size='2'>

<input type='submit' value='$l_sendmail' class=cinput>
<input type='reset' value='  $l_reset  ' class=cinput>
</font></td></tr>
</table></form>
EOF;
}

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

if ($switch == "send") {

$db->query("select email from LINKER_MAIL where email !='' group by email");
$total = $db->numrow;
$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_maillist ( $l_total $total $l_mail )</font></b>
</td></tr></table>

</td>	</tr>

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

EOF;

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

//=====================================
// Loop sendmail
//=====================================

while ($row=$db->nrecord()) {

send_mail($row[email],$title,$content,$checkhtml);

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

EOF;
flush(); 
usleep(5000);

}

//=====================================
// Establish Time
//=====================================

$spend_time = time() - $start_time;

echo "
<table border='0' cellpadding=0 cellspacing=1 width='500' >
<tr><td bgcolor='#E0E0E0' height='24'><font size='2'>&nbsp; $total $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>
";

}

?>
Return current item: Linker IMG