Hi!
I got a problem with the in_array() function when the haystack is an class-array.
I'm only get a match with value at first position in the array.
What i'm doing wrong?
The print_r() function seems to print what I expect.
class excludeMail
{
var $mailadresses = array();
function excludeMail($file = "", $file_name = "", $file_size = "", $file_type = "")
{
if ($file<>"none" AND $file_name != "")
{
echo $file_name."<br>";
echo $file_size."<br>";
echo $file_type."<br>";
if ($file_size > 3000000)
{
echo "Filen ".$file_name." är för stor. Uppladdningen har avbrutits<p>";
}
if ($file_type != "text/plain")
{
echo "Filen ".$file_name." är i fel textformat. Uppladdningen har avbrutits<p>";
}
if(!@copy($file, $path.$file_name))
{
echo "Problem med att ladda upp filen ".$file_name.". Uppladdningen avbröts!<p>";
}
$filename = $path.$file_name;
$fd = fopen($filename, "r");
$contents = fread($fd, filesize($filename));
fclose($fd);
$this -> mailadresses = explode("\r", $contents);
}
}
function checkadress($mail)
{
if(is_array($this -> mailadresses)) {
print_r( $this -> mailadresses);
if(in_array($mail , $this -> mailadresses)) {
return false;
} else {
return true;
}
} else {
return true;
}
}
}
/Per-Erik