Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Blokowanie treści adresu email, xxx@o.fuck
mayu11
post
Post #1





Grupa: Zarejestrowani
Postów: 99
Pomógł: 9
Dołączył: 9.09.2008

Ostrzeżenie: (0%)
-----


Witam, mam takie pytanie... jak zablokować maila w taki sposób:

Adres.Email@Host.emaila => xxxxx.xxxxx@Host.emaila

Szukałem czegoś takiego, ale nikt chyba tego nie szukał, wiem, że trzeba pobawić się chyba z preg_replace / str_replace, ale nie wiem jak.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
MateuszS
post
Post #2





Grupa: Zarejestrowani
Postów: 1 429
Pomógł: 195
Dołączył: 6.10.2008
Skąd: Kraków/Tomaszów Lubelski

Ostrzeżenie: (0%)
-----


Pewnie slabo szukales, na szczescie mi sie nudzilo i napisalem malego giganta

  1. function email($email) {
  2. if (preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i", $email)) {
  3. return true;
  4. }
  5. return false;
  6.  
  7. }
  8.  
  9. function booyakasha($email)
  10. {
  11. if(email($email)) {
  12. $email = explode('@', $email);
  13. $array = str_split($email[0]);
  14. foreach($array as $checkIt) {
  15. if($checkIt != ".") {
  16. $new = str_replace($checkIt, "x", $checkIt);
  17. $newEmail = $newEmail.$new;
  18. } else {
  19. $newEmail = $newEmail.".";
  20. }
  21. }
  22. return $newEmail."@".$email[1];
  23. }
  24. }
  25.  
  26. echo booyakasha("mat.eusz@wp.pl");
Go to the top of the page
+Quote Post
Fifi209
post
Post #3





Grupa: Zarejestrowani
Postów: 4 655
Pomógł: 556
Dołączył: 17.03.2009
Skąd: Katowice

Ostrzeżenie: (0%)
-----


Cytat(MateuszScirka @ 14.03.2010, 22:02:53 ) *
Pewnie slabo szukales, na szczescie mi sie nudzilo i napisalem malego giganta

  1. function email($email) {
  2. if (preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i", $email)) {
  3. return true;
  4. }
  5. return false;
  6.  
  7. }

Ehh... a filter_var ?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 16.10.2025 - 15:33