Hi,
I am an absolute php newbie falling over my feet trying to accomplish the following :
1) making a subscribe list through a flash form with php - Data gets written into a new line in a text file ("mailing.txt")
2) This is the hard part : Checking IF address is in the list if NOT : Data gets written ELSE : Status says no !
This is the code so far - Made with help of friendly PHP coders 😃 :
<?php
$email=stripslashes($HTTP_POST_VARS['email']);
$fd = fopen ("mailing.txt", "r");
while (!feof ($fd)) {
$address = fgets($fd, 4096);
if ($address==$email){
print("Address no good - already in here !");
print("<a href='index.htm'> Back to form !</a>");
$error=true;
}
if($error) break;
}
fclose ($fd);
if(!$error){
$fd = fopen("mailing.txt", "a");
$item=$email."\n";
fwrite($fd, $item);
fclose($fd);
print("Address approved");
print("<a href='index.htm'> Back to form !</a>");
}
?>
PROBLEM : the email - Check doesnt work 🙁
Heres a working example (in Danish but still)
http://www.sedjanka.dk/phptoflash/
I know I have read/write access since I can Write the address, But i'll be d ... if can figure out why the other stuff doesnt cut it !
When all this (hopefully) works out i'll need an unsubscribe routine as well ($fd = fopen("mailing.txt", "r"); //and some clever bit that finds the emailaddress from the form and deletes it