New: Reset invalid email script
This commit is contained in:
parent
0e9100fe75
commit
7272f64177
@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('NOSESSION')) define('NOSESSION', '1');
|
if (!defined('NOSESSION')) define('NOSESSION', '1');
|
||||||
|
if (!defined('MAXEMAILS')) define('MAXEMAILS',100);
|
||||||
|
|
||||||
$sapi_type = php_sapi_name();
|
$sapi_type = php_sapi_name();
|
||||||
$script_file = basename(__FILE__);
|
$script_file = basename(__FILE__);
|
||||||
@ -67,37 +68,57 @@ if (!empty($login))
|
|||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
|
$myfile = fopen($id,"r") or die("Unable to open file\n");
|
||||||
// TODO Loop on the entry file to get the 100 first entries
|
|
||||||
|
|
||||||
$groupofemails=array();
|
$groupofemails=array();
|
||||||
|
for ($i=0; $i < MAXEMAILS; $i++)
|
||||||
|
{
|
||||||
|
$tmp =fgets($myfile);
|
||||||
|
if($tmp == null)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$groupofemails[$i] = trim($tmp,"\n");
|
||||||
|
}
|
||||||
|
|
||||||
// For each groupofemail, we update tables to set email field to empty
|
// For each groupofemail, we update tables to set email field to empty
|
||||||
|
|
||||||
|
$sql_base = "UPDATE ".MAIN_DB_PREFIX;
|
||||||
|
foreach($groupofemails as $email)
|
||||||
|
{
|
||||||
if ($type == 'all' || $type == 'thirdparty')
|
if ($type == 'all' || $type == 'thirdparty')
|
||||||
{
|
{
|
||||||
// Loop on each record and update the email to null if email into $groupofemails
|
// Loop on each record and update the email to null if email into $groupofemails
|
||||||
// TODO
|
|
||||||
|
$sql=$sql_base."societe as s SET s.email = NULL WHERE s.email = '".$email."';";
|
||||||
|
$db->query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type == 'all' || $type == 'contact')
|
if ($type == 'all' || $type == 'contact')
|
||||||
{
|
{
|
||||||
// Loop on each record and update the email to null if email into $groupofemails
|
// Loop on each record and update the email to null if email into $groupofemails
|
||||||
// TODO
|
|
||||||
|
$sql=$sql_base."socpeople as s SET s.email = NULL WHERE s.email = '".$email."';";
|
||||||
|
$db->query($sql);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type == 'all' || $type == 'user')
|
if ($type == 'all' || $type == 'user')
|
||||||
{
|
{
|
||||||
// Loop on each record and update the email to null if email into $groupofemails
|
// Loop on each record and update the email to null if email into $groupofemails
|
||||||
// TODO
|
|
||||||
|
$sql=$sql_base."user as u SET u.email = NULL WHERE u.email = '".$email."';";
|
||||||
|
$db->query($sql);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type == 'all' || $type == 'member')
|
if ($type == 'all' || $type == 'member')
|
||||||
{
|
{
|
||||||
// Loop on each record and update the email to null if email into $groupofemails
|
// Loop on each record and update the email to null if email into $groupofemails
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$sql=$sql_base."adherent as a SET a.email = NULL WHERE a.email = '".$email."';";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$db->commit();
|
$db->commit();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user