 |
|
คงประมาณนี้
<?php
$_d = '_file3';
$_f = '_file3.txt';
define('PREFIX','tb');
$_em = array(
1 => " [email protected] \n ",
2 => ' [email protected] '
);
////////// //////
if(! opendir($_d)) mkdir($_d, '0775');
if(! file_exists($_d.'/'.$_f)) touch($_d.'/'.$_f);
// $_fp = fopen($_d.'/'.$_f, 'wb'); fwrite($_fp, serialize($_em)); fclose($_fp);
$_fp = fopen($_d.'/'.$_f, 'wb');
foreach($_em as $_val){
fwrite($_fp, $_val);
} fclose($_fp); // End.
///////// ///////
$_file = file($_d.'/'.$_f);
$_db = mysql_connect($_s, $_u, $_p);
foreach($_file as $_val){
$_query = mysql_db_query($_db, 'INSERT INTO '.PREFIX.'_email(id, email) VALUES(NULL, \''.$_val.'\')'); // PHP v4 ,PHP v5 not 5.3, 6
mysql_free_result($_query); // return free result
} // End.
mysql_close($_db);
// ////////////////////////
// mail
$_query = mysql_query($_db,'SELECT email FROM '.PREFIX.'_email ');
$_email = array();
while($_result = mysql_fetch_assoc($_query)){
$_email = $_result['email'];
}
// bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
$_err = ' ';
foreach($_email as $_key=> $_val){
if(! mail($_val , $_subject , $_message ,$_headers)) $_err .= ' Sent error ! ! '.($_key+1).' : '.$_val .'<br>';
}
?>
<div id = "_get_error"><?= $_err; ?></div>
|
 |
 |
 |
 |
Date :
2010-07-06 15:39:20 |
By :
mrjidjad |
|
 |
 |
 |
 |
|
|
 |