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 (1 - 7)
blooregard
post
Post #2


Newsman


Grupa: Moderatorzy
Postów: 2 033
Pomógł: 290
Dołączył: 21.12.2007
Skąd: Łódź




Cytat
Szukałem czegoś takiego, ale nikt chyba tego nie szukał,

Pokaż, jak szukałeś.
Go to the top of the page
+Quote Post
MateuszS
post
Post #3





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
mayu11
post
Post #4





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

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


http://www.google.pl/search?q=blokowanie+t...lient=firefox-a
http://www.google.pl/search?hl=pl&safe...ila+replace+php
http://www.google.pl/search?hl=pl&safe...mp;aq=f&oq=


{Fatal error: Call to undefined function: str_split() in ----/func.php on line 14}


$array = str_split($email[0]);


// Wersja PHP 4.4.9
Dostępne w PHP 5 (IMG:style_emoticons/default/sad.gif)

Ten post edytował mayu11 14.03.2010, 22:27:13
Go to the top of the page
+Quote Post
thek
post
Post #5





Grupa: Moderatorzy
Postów: 4 362
Pomógł: 714
Dołączył: 12.02.2009
Skąd: Jak się położę tak leżę :D




No to użyj czegoś innego zamiast str_split. Choćby preg_replace zamieniające na x wszystko oprócz kropki (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
Fifi209
post
Post #6





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
mayu11
post
Post #7





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

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


  1. function x_it($email)
  2. {
  3. $email = explode('@', $email);
  4. $m1 = $email[0];
  5. $m2 = $email[1];
  6. $len = strlen($m1);
  7. while($len > 0){
  8. $newEmail .= " *";
  9. $len = $len - 1;
  10. }
  11. return $newEmail."@".$m2;
  12. }


Zrobiłem to już innym sposobem...
Dla przyszłych pokoleń.

Kropki już mam gdzieś...
Go to the top of the page
+Quote Post
thek
post
Post #8





Grupa: Moderatorzy
Postów: 4 362
Pomógł: 714
Dołączył: 12.02.2009
Skąd: Jak się położę tak leżę :D




Zamiast używać while spróbuj z gotową funkcją:
  1. str_repeat( '*', $len );
Go to the top of the page
+Quote Post

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: 29.09.2025 - 12:13