Migliorata formattazione mail e inclusione ciclo while ulteriore per recupero in toto
This commit is contained in:
+32
-43
@@ -2,61 +2,50 @@
|
||||
$username="root";
|
||||
$password="vpsad24068";
|
||||
$hostname = "localhost";
|
||||
|
||||
//connection string with database
|
||||
$dbhandle = mysqli_connect($hostname, $username, $password)
|
||||
or die("Unable to connect to MySQL");
|
||||
echo "";
|
||||
or die("Unable to connect to MySQL");
|
||||
|
||||
// connect with database
|
||||
$selected = mysqli_select_db($dbhandle, "wptest")
|
||||
or die("Could not select examples");
|
||||
//$email = 'francesco.finazzi@unibg.it';
|
||||
or die("Could not select examples");
|
||||
|
||||
$query = "SELECT DISTINCT wp_articoli2autori.email FROM wp_articoli2autori";
|
||||
//echo $query;
|
||||
|
||||
$result = mysqli_query($dbhandle,$query);
|
||||
$rows = [];
|
||||
while($row = mysqli_fetch_array($result))
|
||||
{
|
||||
$rows[] = $row;
|
||||
$query2 = "SELECT wp_articoli2autori.doi,wp_articoli2autori.email FROM wp_articoli2autori
|
||||
$query2 = "SELECT wp_articoli2autori.doi,wp_articoli2autori.email,wp_articoli.title FROM wp_articoli2autori
|
||||
INNER JOIN wp_articoli ON wp_articoli2autori.doi = wp_articoli.doi
|
||||
WHERE wp_articoli.appr = 0 AND wp_articoli.veto = 0 AND wp_articoli2autori.email = '$row[0]'
|
||||
GROUP BY wp_articoli2autori.email,wp_articoli.doi
|
||||
LIMIT 3";
|
||||
$result2 = mysqli_query($dbhandle,$query2);
|
||||
echo $query2;
|
||||
$rowdoi = mysqli_fetch_array($result2);
|
||||
echo $rowdoi[0];
|
||||
$from = 'mario@graspa.org';
|
||||
$to = 'marco@steamware.net';
|
||||
$appr = '1';
|
||||
$veto = '0';
|
||||
//$to = $row_data['email']; // The column where your e-mail was stored.
|
||||
$subject = 'Please approve';
|
||||
//$veto = 'https://graspa.org/veto.php?';
|
||||
$msg = "APPROVA http://localhost/test/?email=".$to."&doi=".$rowdoi[0]."&appr=".$appr."&veto=".$veto." "."O"." "."RIFIUTA https://graspa.org/veto.php?".$rowdoi[0];
|
||||
//$msg = 'Hello world!';
|
||||
mail($to, $subject, $msg, $from);
|
||||
//echo $row[0];
|
||||
$result2 = mysqli_query($dbhandle,$query2);
|
||||
//echo $query2;
|
||||
while ($rowdoi = mysqli_fetch_array($result2))
|
||||
{
|
||||
echo $rowdoi[0];
|
||||
echo $rowdoi[1];
|
||||
$headers = '';
|
||||
$headers .= 'MIME-Version: 1.0' . "\r\n";
|
||||
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
|
||||
//$from = 'mario@graspa.org';
|
||||
$to = 'marco@steamware.net';
|
||||
|
||||
//$to = $row_data['email']; // The column where your e-mail was stored.
|
||||
$subject = 'Approvazione articoli Graspa';
|
||||
|
||||
$msg = "APPROVA <a href=\"http://localhost/test/?email=".$to."&doi=".$rowdoi[0]."&appr=1"."&veto=0\">$rowdoi[2]</a>"."<br>"." "."RIFIUTA <a href=\"http://localhost/test/?email=".$to."&doi=".$rowdoi[0]."&appr=0"."&veto=1\">$rowdoi[2]</a>";
|
||||
|
||||
if (empty($rowdoi[0])){
|
||||
continue;
|
||||
} else {
|
||||
mail($to, $subject, $msg,$headers);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
//echo $rows[0];
|
||||
//$row = mysqli_fetch_array($result);
|
||||
//echo $row;
|
||||
//print_r($row);
|
||||
//$result2 = array_map('strval', $rows);
|
||||
//$test = mysqli_fetch_assoc($result)->email;
|
||||
//echo $test;
|
||||
//foreach( mysqli_fetch_assoc($result)->email as $autore){
|
||||
// $query = "SELECT wp_articoli2autori.doi,$autore FROM wp_articoli2autori
|
||||
// INNER JOIN wp_articoli ON wp_articoli2autori.doi = wp_articoli.doi
|
||||
// WHERE wp_articoli.appr = 0 AND wp_articoli.veto = 0
|
||||
// GROUP BY wp_articoli2autori.email,wp_articoli.doi
|
||||
// LIMIT 3";
|
||||
//$result = mysqli_query($dbhandle,$query);
|
||||
//echo $query;
|
||||
//}
|
||||
|
||||
|
||||
//$url = 'http://export.arxiv.org/api/query?search_query=au:Finazzi_F';
|
||||
|
||||
// }
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user