Hi all,
in my last mail I put in the wrong code. sorry ! Here's the right one.
In my renamemail.php, I have the code for renaming an E-mail in my textfile. You click the desired checkbox and enter the new E-mail in the textfield. My problem now is, that everytime I rename an E-Mail, the New line will be droped, next to the email.
I also have problems with checking how many checkboxes are selected. "if (isset($POST['selmail[$j]'] < 1)) ". It doesn't work.
Can anyone help me , please ?
Olli
here's the code:
The Textfile:
test@test.com
hello@hello.com
no@yes.com
This is mailreader.php
<?PHP
$reader = "emails.txt";
$mails = file($reader);
for($i=0; $i<count($mails); $i++)
{
print "<input type=checkbox name=semails[$i] value=>$mails[$i]"."<br>";
}
This is _renamemail.php
include ("mailreader.php");
for($j=0; $j<count($mails); $j++)
{
if(isset($POST['renmail']))
{
if (isset($semails[$j]) < 1)
{
if(!empty($newmail))
{
$renamingMail = $mails[$j];
}
}
else
{
print "Too much selected";
}
}
}
print $renamingMail;
$renString = file_get_contents ($reader);
$search = $av = preg_replace("/$renamingMail/", $_POST['newmail'], $renString);
$fp = fopen($reader, "w+");
fwrite($fp, $search);
fclose($fp);