<?php
include_once("include/config.php");
include_once("include/auth.lib.php");
list($status, $user) = auth_get_status();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Inserimento news Entinoprofit.org - Rivs.it - Aesnazionale.it</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="testata">
<table width="760" border="0" cellpadding="0" cellspacing="0" align="center">
<!--DWLayoutTable-->
<tr>
<td height="105" colspan="2" valign="top"><img src="images/testata.jpg" width="760" height="105" border="0"></td>
</tr>
<tr><td height="37" colspan="2" valign="center" background="images/navbar.gif"><div align="center" class="titolo"><b>Pannello di importazione email</b></div>
</td>
</tr>
</table>
</div>
<?php
switch($status){
case AUTH_LOGGED:
include("menu.php");
?>
<div id="main">
<div id="news">
<div class="alert">Tramite questo pannello è possibile importare email incollando nel campo di testo un documento, ci penserà lui a estrarre le email e importarle nel gruppo selezionato e controllare se sono già presenti in archivio.</div>
<?php
if ($_POST['import']) {
$email = $_POST['import'];
$tipo = $_POST['tipo'];
$lista = explode(';', $email);
$cont_elem = count($lista);
for($i=0;$i < $cont_elem; $i++) {
$mailZ = trim($lista[$i]);
if(chkEmail($mailZ)) {
$query = mysql_query("SELECT mail FROM mailinglist WHERE mail = '".$mailZ."' AND tipo = '".$tipo."'");
$query2 = mysql_query("SELECT mail FROM mailinglist WHERE mail = '".$mailZ."' AND tipo = '35'");
if(mysql_num_rows($query) == 0) {
if($tipo == '35') {
mysql_query("DELETE FROM mailinglist where mail = '".$mailZ."'");
echo "<p>$mailZ <font color='green'>Record cancellato da altre mailing list</font></p>";
}
if(mysql_num_rows($query2) == 0) {
mysql_query("INSERT INTO mailinglist (tipo,mail,active) VALUES ('$tipo','$mailZ','1')") or die (mysql_error());
echo "<p>$mailZ <font color='green'>Record inserito</font></p>";
} else {
echo "<p>$mailZ <font color ='red'>Record in Blacklist</font></p>";
}
} else {
echo "<p>$mailZ <font color ='red'>Record duplicato</font></p>";
}
}
}
}
?>
<form action="" method="post" class="cssform" name="formimport">
<table width="760" border="0" cellpadding="2" cellspacing="0" align="center">
<tr valign="middle">
<td>Seleziona Mailing List
<select name="tipo" type="text" id="tipo">
<option value="">>> Seleziona</option>
<?php
$query = "SELECT id,tipologia FROM tpmailing WHERE tipologia != '' ORDER by tipologia ASC";
$risultato = mysql_query($query) or die(mysql_error());
while ($array = mysql_fetch_array($risultato, MYSQL_BOTH)) {
echo '<option value='.$array['id'].'>'.$array['tipologia'].'</option>';
}
?></select></td>
</tr>
<tr valign="middle">
<td class="text3"><textarea name="import" cols="100" rows="20" id="import"></textarea> <label></label></td>
</tr>
</table>
<table width="760px" align="center">
<!--DWLayoutTable-->
<tr height="50"><td width="100%" height="30"> <div align="center">
<input type="submit" value="Importa email" style= "BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; MARGIN: 2px 0px; BORDER-LEFT: gray 1px solid; BORDER-BOTTOM: gray 1px solid;">
</div></td></tr>
</table>
</form>
<?php
break;
case AUTH_NOT_LOGGED:
?>
<table width="760" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td >Login Club </td>
</tr>
<tr>
<td >
<form action="login.php<?=$link?>" method="post">
<table cellspacing="2">
<!--DWLayoutTable-->
<tr>
<td >Username :</td>
<td ><input name="uname" type="text" size="10"></td>
</tr>
<tr>
<td class="text1">Password :</td>
<td><input name="passw" type="password" size="10"></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="action" value="entra">
</td>
</tr>
<tr><td height="21" colspan="2" valign="top" ><!--DWLayoutEmptyCell--> </td>
</tr>
</table>
</form>
</table>
<?php
break; }
?>
</div></div>
</body>
</html>