Hi there,
I have a problem getting a script to check a text file for an email.
This is what I have:
<?php
$email = 'user@domain.com';
// Check Subscription Status for General & Shop
$newfile = fopen("/files/email.list", "r");
while(!feof($newfile))
{
$duplicate = fgetss($newfile, 255);
// is email address submitted already on file?
if(eregi("$email", $duplicate))
{
print("<p><strong>You are subscribed as $email </p>");
}
}
?>
The problem is that I would like to include an else statement but cant do it without errors and strange results.
I tried
while(!feof($newfile))
{
$duplicate = fgetss($newfile, 255);
// is email address submitted already on file?
if(eregi("$email", $duplicate))
{
print("<p><strong>You are subscribed as $email </p>");
}
else
{
print("<p><strong>$email is not subscribed to this list </p>");
}
}
But that started off some crazy looping. It didnt like it at all. I cant use exit; as I have other code that needs to be processed after this script.
Hows it done?
M