ho la news letter che legga gli utenti e quindi le mail da un sql.. ma fin quando gli utenti sono 100 va bene... io che ne ho 2000 mi da problemi.. non mi invia le mail mi restituisce errore come se non riuscisse a caricare .. come faccio a risolvere il problema ? ? ? ? ?
incollo lo script :
<?php require_once('../newsletterconn.php'); ?>
<?php
session_start();
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "errore.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
mysql_select_db($database_newsletterconn, $newsletterconn);
$query_iscritti = "SELECT * FROM iscritti ORDER BY indirizzo ASC";
$iscritti = mysql_query($query_iscritti, $newsletterconn) or die(mysql_error());
$row_iscritti = mysql_fetch_assoc($iscritti);
$totalRows_iscritti = mysql_num_rows($iscritti);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 2.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>Newsletter</title>
</head>
<body>
<div class="bianco">
<div align="center"> </div>
</div>
<div id="testata">
<p align="center">Amministrazione newsletter </div>
<div id="contenuto">
<div align="center">
<p><b>Account in utilizzo: <i><?php echo($_SESSION['MM_Username']); ?></i></b>
</p>
<p><a href="privata.php">Torna all'indice del pannello </a></p>
<p><strong>Invia una nuova newsletter</strong></p>
<p><strong> <?php
$titolo= $_POST['titolo'];
// Se formattate la newsletter con TAGS HTML per andare a capo, togliete "Nl2br" da qui sotto
// lasciando il resto così com'è.
$testo= nl2br($_POST['testo']);
// Imposto l'indirizzo e-mail del mittente
$email= "[email protected]";
do {
// Configuro i dati di invio della mail
// (destinatario, mittente, oggetto e corpo)
$mail_to = $row_iscritti['indirizzo'];
$mail_from = $email;
$mail_subject = $titolo;
// Imposto colore e grandezza del carattere
$mail_body = "<p><font color=#000000 face=tahoma size=2>$testo</font></p>";
// Specifico le intestazioni per il formato Html
$mail_in_html = "MIME-Version: 1.0\r\n";
$mail_in_html .= "Content-type: text/html; charset=iso-8859-1\r\n";
$mail_in_html .= "From: <$mail_from>";
// Invio la mail
if (mail($mail_to, $mail_subject, $mail_body, $mail_in_html))
{
}
else
{
print "Errore per";
print $mail_to ;
print "\n" ;
}
} while ($row_iscritti = mysql_fetch_assoc($iscritti));
echo ("Operazione completata");
?></strong></p>
</div>
</div>
<div class="bianco">
<div align="center"><a href="index.php"><< Torna indietro</a></div>
</div>
<div id="footer">
</div>
</body>
</html>
<?php
mysql_free_result($iscritti);
?>
mi restituisce tutti gli utenti come errore.. come faccio sono disperato...
incollo lo script :
<?php require_once('../newsletterconn.php'); ?>
<?php
session_start();
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "errore.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
mysql_select_db($database_newsletterconn, $newsletterconn);
$query_iscritti = "SELECT * FROM iscritti ORDER BY indirizzo ASC";
$iscritti = mysql_query($query_iscritti, $newsletterconn) or die(mysql_error());
$row_iscritti = mysql_fetch_assoc($iscritti);
$totalRows_iscritti = mysql_num_rows($iscritti);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 2.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>Newsletter</title>
</head>
<body>
<div class="bianco">
<div align="center"> </div>
</div>
<div id="testata">
<p align="center">Amministrazione newsletter </div>
<div id="contenuto">
<div align="center">
<p><b>Account in utilizzo: <i><?php echo($_SESSION['MM_Username']); ?></i></b>
</p>
<p><a href="privata.php">Torna all'indice del pannello </a></p>
<p><strong>Invia una nuova newsletter</strong></p>
<p><strong> <?php
$titolo= $_POST['titolo'];
// Se formattate la newsletter con TAGS HTML per andare a capo, togliete "Nl2br" da qui sotto
// lasciando il resto così com'è.
$testo= nl2br($_POST['testo']);
// Imposto l'indirizzo e-mail del mittente
$email= "[email protected]";
do {
// Configuro i dati di invio della mail
// (destinatario, mittente, oggetto e corpo)
$mail_to = $row_iscritti['indirizzo'];
$mail_from = $email;
$mail_subject = $titolo;
// Imposto colore e grandezza del carattere
$mail_body = "<p><font color=#000000 face=tahoma size=2>$testo</font></p>";
// Specifico le intestazioni per il formato Html
$mail_in_html = "MIME-Version: 1.0\r\n";
$mail_in_html .= "Content-type: text/html; charset=iso-8859-1\r\n";
$mail_in_html .= "From: <$mail_from>";
// Invio la mail
if (mail($mail_to, $mail_subject, $mail_body, $mail_in_html))
{
}
else
{
print "Errore per";
print $mail_to ;
print "\n" ;
}
} while ($row_iscritti = mysql_fetch_assoc($iscritti));
echo ("Operazione completata");
?></strong></p>
</div>
</div>
<div class="bianco">
<div align="center"><a href="index.php"><< Torna indietro</a></div>
</div>
<div id="footer">
</div>
</body>
</html>
<?php
mysql_free_result($iscritti);
?>
mi restituisce tutti gli utenti come errore.. come faccio sono disperato...