login  Naam:   Wachtwoord: 
Registreer je!
 Scripts:

Scripts > PHP > Handige scripts > Email ontdubbel script

Email ontdubbel script

Auteur: skyce - 30 maart 2005 - 11:25 - Gekeurd door: CelestialCelebi - Hits: 5572 - Aantal punten: 4.50 (3 stemmen)





Dit script haalt alle email adressen uit een grote lap tekst en daarna haalt het alle dubbele email adressen eruit.

Erg handig dus bijv. bij fwd mailtjes.

Je kan het bijv. goed gebruiken bij import van email lijst bij nieuwsbrieven systeem

Gr33tz SkYcE

Code:
  1. <html>
  2.  
  3. <head>
  4. <title>Email ontdubbel script - SkYcE &copy; 2005.</title>
  5. </head>
  6.  
  7. <body bgcolor="Maroon">
  8. <center>
  9. <font color="#FFFFFF">
  10. <?php
  11. /*
  12. function dubbelarray($array) {
  13.   if(is_array($array)) {
  14.   $aantalelementen = count($array);
  15.   for($i=0; $i<$aantalelementen; $i++) {
  16.   $regel = each($array);
  17.   $key = $regel[value];
  18.   $nieuwarray[$key]=$nieuwarray[$key]+1;
  19.   }
  20.   }else{
  21.   return FALSE;
  22.   }
  23. return $nieuwarray;
  24. }
  25. */
  26.  
  27. $check = true;
  28.  
  29. if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
  30.  
  31. $check = false;
  32. $input = $_POST["emaillist"];
  33.  
  34. $emailstring = '![A-Za-z0-9_-]+([\.]{1}[A-Za-z0-9_-]+)*@[A-Za-z0-9-]+([\.]{1}[A-Za-z0-9-]+)!i';
  35. preg_match_all($emailstring, $input, $output);
  36. $count_input = count($output[1]);
  37.  
  38. for ($i=0; $i<$count_input; $i++) {
  39. $emailarray[] = strtolower($output[0][$i]);
  40. }
  41. $unique = array_unique($emailarray);
  42. natsort($unique);
  43.  
  44. $z = count($unique);
  45. $q = $count_input - $z;
  46. echo'<div align="left"><b>';
  47. echo $z.' email adressen gevonden.<br>';
  48. echo $q.' dubbele email adressen<br>';
  49. echo 'Van de '.$count_input.' email adressen<br><br></b>';
  50. foreach ($unique as $v){
  51. echo $v.'<br>';
  52. }
  53. echo '</div>';
  54.  
  55.  
  56. // echo '<div align="left"><pre><font color="#FFFFFF">';
  57. // print_r($unique);
  58. // echo '</font></pre></div>';
  59.  
  60. }
  61.  
  62. if($check == true) {
  63. ?>
  64. <h2>Email ontdubbel script - SkYcE &copy; 2005</h2>
  65. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
  66. <textarea name="emaillist" rows="20" cols="80"></textarea><br><br>
  67. <input type="submit" name="submit" value="Ontdubbel alle emailadressen">
  68. </form>
  69. <?php
  70. }
  71. ?>
  72. </font>
  73. </center>
  74. </body>
  75. </html>
Download code! Download code (.txt)

 Stemmen
Niet ingelogd.

 Reacties
Post een reactie
Lees de reacties (2)
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.024s