Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > IT форум > Помощь студентам
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 26.05.2011, 09:08   #1
Rodimon
Новичок
Джуниор
 
Регистрация: 26.05.2011
Сообщений: 2
По умолчанию Внедрить в скрипт ограничение email"ov за проход

Подскажите пожалуйста человеку который первый раз сталкивается со скриптами рассылки. Нужно внедрить ограничение а по возможности и внедрить метод sleep () вот для этого кода.

PHP код:

<?
session_start
();
require_once(
'../inc/global_var.php');
require_once(
'../inc/connect.php');
require(
'check_session.php');
require(
'../inc/lib.php');

$ds_arr mysql_fetch_array(mysql_query('select count(distinct(t.em)) as cr from
                                    (select email as em from object where email<>\'\'
                                     union all
                                     select email as em from job_list where email<>\'\'
                                     union all
                                     select from_email as em from send_message where from_email<>\'\'
                                    ) as t where t.em not in (SELECT email FROM send_ignore_list_email)'
));
$count_all_email=$ds_arr['cr']; 



//=====================================================================================================================
if (isset($_GET['test_id']))//делаем тестовую рассылку на порталовский адрес 
{
 
$ds_arr=mysql_fetch_array(mysql_query("select * from send_to_all_mess where id=".$_GET['test_id']));
 
$msg_text $ds_arr['text_message'];
 
$to_email='info@krasnodar-today.ru';
 
 if (
$ds_arr['unsubscribe']=='yes'$msg_text=$msg_text.'<br><br><br><br><p align="center" style="font-style:italic">
 Если Вы хотите отказаться от получения этой рассылки, нажмите <a href="http://'
.$g_domain.'/unsubscribe.php?email='.$to_email.'">здесь</a></p>';
  
 
$b mail_($ds_arr['from_address'],$to_email,$ds_arr['subject'],$msg_text);
 if (
$b
   
header("Location: send_to_all_email.php?test_send_email=success"); 
 else 
   
header("Location: send_to_all_email.php?test_send_email=falue"); 




//============================ГЕНЕРАЦИЯ НОВОСТНОЙ РАССЫЛКИ===============================================================
if (isset($_POST['save_add_news'])) // сформируем и сохраним письмо после его добавления

 
$body='<style type="text/css">
              p, span, strong, b, div, a {font-family:tahoma;font-size:12px;}
              a { text-decoration: underline; color: rgb(8, 87, 166); }
              a:hover { text-decoration: none; }
              #brd {border: 1px dotted rgb(204, 204, 204);}
             </style>
             <p>Новости '
.$g_gorod_2.' от '.date("d.m.Y").'</p><br>
             <a href="http://'
.$g_domain.'"><img height="47" border="0" width="280" alt="" src="http://'.$g_domain.'/img/'.$g_gorod_4.'_logo_email.jpg" /></a>
             <br><br><br>
            <table cellspacing="5" cellpadding="5" width="100%" id="brd">
            <tbody>'
;
  
$arr=explode("|"$_POST['sel_id_news']);
  
$n=1;
  for (
$i=0;$i<count($arr)-1;$i++)    
  {    
    
$ds_arr mysql_fetch_assoc(mysql_query("SELECT * FROM news_list where id_news=".$arr[$i]));
    if (
$n==1) {$body.='<tr>';}
    
$body.='<td width="50%" valign="top" id="brd">
                  <a target="_blank" href="http://'
.$g_domain.'/news/news_full.php?id_news='.$ds_arr['id_news'].'">
                <img border="0" src="http://'
.$g_domain.'/news/news_files/image_pict/'.$ds_arr['id_news'].'.jpg" /><br><br>
                 <b>'
.str_replace("'","\"",$ds_arr['caption_news']).'</b>
                </a><br><br>
                </td>'
;
    
$n++;
    if (
$n==3) {$body.='</tr>';$n=1;}            
  }
 
$body.='</tbody></table><br>
            <p>С уважением, Администрация городского портала <a href="http://'
.$g_domain.'">http://'.$g_domain.'/</a><br />
            г. '
.$g_gorod_1.'<br />
            info@krasnodar-today.ru</p>'
;
            
 if (isset(
$_POST['unsubscribe'])) $unsubscribe='yes'; else $unsubscribe='no';
 
$sql_str "INSERT INTO send_to_all_mess(date_create,from_address,subject,text_message,count_email,status_,unsubscribe)
              VALUES (NOW(),
                      '"
.$_POST['from_address']."',
                      '"
.$_POST['subject']."',
                      '"
.$body."',
                      "
.$count_all_email.",
                      '"
.$_POST['status_']."',
                      '"
.$unsubscribe."')";
 
//echo $sql_str;
 
mysql_query($sql_str) or die(mysql_error());
 
$insert_id=mysql_insert_id();
 
$sql_str "INSERT INTO send_list_email(email,id_subscribe)
                                         select distinct(t.em),"
.$insert_id." from
                                            (select email as em from object where email<>''
                                             union all
                                             select email as em from job_list where email<>''
                                             union all
                                             select from_email as em from send_message where from_email<>''
                                            ) as t where t.em not in (SELECT email FROM send_ignore_list_email)"
;
 
mysql_query($sql_str) or die(mysql_error());
 
header("Location: send_to_all_email.php");
}




?>
Использую класс phpmailer

Заранее благодарен за любую помошь!
Rodimon вне форума Ответить с цитированием
Старый 26.05.2011, 13:07   #2
Rodimon
Новичок
Джуниор
 
Регистрация: 26.05.2011
Сообщений: 2
По умолчанию я так понимаю надо где то здесь ставить ограничения

PHP код:
if (isset($_POST['unsubscribe'])) $unsubscribe='yes'; else $unsubscribe='no';
 
$sql_str "INSERT INTO send_to_all_mess(date_create,from_address,subject,text_message,count_email,status_,unsubscribe)
              VALUES (NOW(),
                      '"
.$_POST['from_address']."',
                      '"
.$_POST['subject']."',
                      '"
.$body."',
                      "
.$count_all_email.",
                      '"
.$_POST['status_']."',
                      '"
.$unsubscribe."')";
 
//echo $sql_str;
 
mysql_query($sql_str) or die(mysql_error());
 
$insert_id=mysql_insert_id();
 
$sql_str "INSERT INTO send_list_email(email,id_subscribe)
                                         select distinct(t.em),"
.$insert_id." from
                                            (select email as em from object where email<>''
                                             union all
                                             select email as em from job_list where email<>''
                                             union all
                                             select from_email as em from send_message where from_email<>''
                                            ) as t where t.em not in (SELECT email FROM send_ignore_list_email)"
;
 
mysql_query($sql_str) or die(mysql_error());
 
header("Location: send_to_all_email.php");

Rodimon вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Кто поможет изменить скрипт:<script src="http://up4um.com/js/widget.js" F23 Помощь студентам 0 15.02.2011 21:40
Написать скрипт, который помещал бы на документ таблицу "безопасных цветов". lildens JavaScript, Ajax 1 21.10.2010 16:26
Скрипт: вместо F5 нажимаем ссылку "Обновить". Satello PHP 2 16.03.2010 11:26
Ограничение на ввод символов в "поле ввода" zvezda_t JavaScript, Ajax 0 07.02.2010 19:57
В такой код можно внедрить скрипт? nikleb PHP 1 05.07.2008 21:00