What is happening is the strangest thing ever, the strangest thing I ever had while coding I dunno how to explain it. Here is the source
$text=$_POST['comments'];
function ValidateEmail($email) {
$valid = true;
$findats = strrpos($email, "@");
if (is_bool($findats) && !$findats) {
$valid = false;
}
else {
$domain = substr($email, $findats+1);
$local = substr($email, 0, $findats);
$locallength = strlen($local);
$domainlength = strlen($domain);
if ($locallength < 1 || $locallength > 64) {
$valid = false;
}
elseif ($domainlength < 1 || $domainlength > 256) {
$valid = false;
}
elseif ($local[0] == '.' || $local[$locallength-1] == '.') {
$valid = false;
}
elseif ((preg_match('/\\.\\./', $local)) || (preg_match('/\\.\\./', $domain))) {
$valid = false;
}
elseif (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) {
$valid = false;
}
elseif (!preg_match('/^(\\\\.|[A-Za-z0-9_.-])+$/', str_replace("\\\\","",$local))) {
if (!preg_match('/^"(\\\\"|[^"])+"$/', str_replace("\\\\","",$local))) {
$valid = false;
}
}
}
if ($valid) {
return 1;
}
else {
return 0;
}
}
function explodeX($delimiters,$string)
{
$return_array = Array($string);
$d_count = 0;
while (isset($delimiters[$d_count]))
{
$new_return_array = Array();
foreach($return_array as $el_to_split)
{
$put_in_new_return_array = explode($delimiters[$d_count],$el_to_split);
foreach($put_in_new_return_array as $substr)
{
$new_return_array[] = $substr;
}
}
$return_array = $new_return_array;
$d_count++;
}
return $return_array;
}
$input=explodeX(Array("!"," ","#","$","%","^","&","*","(",")","=","+","{","}","]","[",";",":","'","\\","\"","|",",","/","?","<",">"),$text);
$i=0;
while($i<count($input))
{
$final=preg_split('/(.be|.fr|.eu|.com|.me|.net|.org|.info|.biz|.pro|.cc|.tv|.mobi|.tel|.am|.fm|.mu|.nu|.name|.it|.li|.lu|.ch|.nl|.me.uk|.co.uk|.org.uk|.de|.at|.re|.es|.pt|.pl|.cz|.cx|.gs|.tl|.cat|.cn|.tw|.ht|.ie|.us|.lv|.lt|.im|.fi)/', $input[$i], -1, PREG_SPLIT_DELIM_CAPTURE);
$d=0;
while($d<count($final))
{
echo $final[$d]."<br>";
$d=$d+1;
}
$i=$i+1;
}
There are some non used variables etc that I used them for some tests etc dont pay attention to them. What I want to do is to search within strings
e-mail adresses and print them. For example u enter
; <dwadawdawdaw@dasdad.com> adawdawdwd@dasdadwaw.comawdwadwdw@dasda.com things like that.
However when I input one single e-mail it works fine but when putting huge strings I
get CRAZIEST outputs ever. Example
into different pieces like ju rw loj.1982@ lo vw .fr while all the next e-mails
will be outputted normally. And some of them might get splited aswell its really confusing. If u have msn plz give to me I might be able to show you.