<?
	include("head.php");
	include("../include/db.inc.php");
	include("../include/bit_functions.inc.php");
	include("../include/pager.php");	
	$db1=new db;
    $db1->open();mysql_query("SET NAMES 'utf8'");

if($_SESSION['uname']=='' || $_SESSION['pwd']=='')
		{
			header("location:login.php");
		}

	if(isset($_POST['massmaliling']))
	{
			
	         	$headers ="From:"._ADMIN_MAIL_. "\r\n";
                //$headers .= "Reply-To:". _ADMIN_MAIL_NAME_. "<"._ADMIN_MAIL_ ."> \r\n";
                $headers .= "Content-Transfer-Encoding: 8bit\n";
                $headers .= "MIME-Version: 1.0\n";
                $headers .= "Content-type: text/html; charset=utf-8\n";
				$subject =$_POST['subject'];
				$message =$_POST['mailing'];
				
			     $sc="select uid from t123go_bid where pid='".$_POST['product']."' group by uid order by uid ";  
				$res=mysql_query($sc);
				while($data=mysql_fetch_array($res))
				 {
					 $all_mail = get_fieldval(id,email,user,$data['uid']);
					 mail($all_mail,$subject,$message,$headers);
					 
				}
							
	}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>123gewon ADMINISTRATOR</title>
<link href="index.css" rel="stylesheet" type="text/css" />
</head>
<style>
.a1{color:#000000}
a:hover {text-decoration: none; color:#000000}
.style3 {
	font-family: "Times New Roman", Times, serif;
	font-size: 24px;
	font-style: italic;
	color: #FFFFFF;
}
</style> 
<link rel="shortcut icon" href="<?=_BASEURL_?>/favicon.ico" /></head>
<script src="../js/validation.js"></script>
<script language="javascript" type="text/javascript" src="tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
	tinyMCE.init({
		mode : "textareas",
		theme : "advanced",
		plugins : "spellchecker,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable",
		theme_advanced_buttons1_add_before : "save,newdocument,separator",
		theme_advanced_buttons1_add : "fontselect,fontsizeselect",
		theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,separator,forecolor,backcolor",
		theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",
		theme_advanced_buttons3_add_before : "tablecontrols,separator",
		theme_advanced_buttons3_add : "emotions,iespell,flash,advhr,separator,print,separator,ltr,rtl,separator,fullscreen",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,spellchecker",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_path_location : "bottom",
		content_css : "/example_data/example_full.css",
	    plugin_insertdate_dateFormat : "%Y-%m-%d",
	    plugin_insertdate_timeFormat : "%H:%M:%S",
		extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
		external_link_list_url : "example_data/example_link_list.js",
		external_image_list_url : "example_data/example_image_list.js",
		flash_external_list_url : "example_data/example_flash_list.js",
		file_browser_callback : "mcFileManager.filebrowserCallBack",
		theme_advanced_resize_horizontal : false,
		theme_advanced_resizing : true,
		apply_source_formatting : true,
		spellchecker_languages : "+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv"
	});
</script>
<script language="javascript">
function validate()
{

     if(document.addfrm.subject.value=='')
	{
		 alert("Enter Your Subject Here");
		 document.addfrm.subject.focus();
		return false;

	} 
	 if(document.addfrm.mailing.value=='')
	{
		 alert("Enter Your Mail Description Here");
		 document.addfrm.mailing.focus();
		return false;

	}
	}
	</script>
<body>
<table width="100%%" border="0" cellspacing="2" cellpadding="0">
       
          <tr>
            <td colspan="2">
            
               
                <table width="706" height="134" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="12">&nbsp;</td>
    <td width="709">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>
<form name="addfrm" method="post" action="" onSubmit="return validate();">
<input type="hidden" name="product" value="<?=$_GET[id]?>" />
<table width="99%" border="0">
<tr>
        <th colspan="2">!!Mailing To All Bidders!!</th>
</tr>
  
 <tr>
		<td >Mail To: </td>
		<td >All Bidders Of Product! <br /></td>		
</tr>


<tr>
		<td >Subject</td>
		<td ><input type="text" name="subject"  style="width:300px"/></td>		
</tr>
  
 <tr>
        <td>Message</td>
        <td><textarea type="text" name="mailing" style="width:620px; height:320px"></textarea></td>
</tr>
 
 <tr>
        <td colspan="2"> <input type="submit" name="massmaliling" value="Send"></td>
</tr>
 
</table></form>
</td>
</tr>
</table>

            </td>
          </tr>
     
       </table>
</body>
</html>
