alexjewell
08-10-2006, 06:17 PM
A client of mine is keeping track of the people who visit his site by having them enter an email to view the content.
I'm taking the email and writing it to the end of a .txt document, which I include on the admin page I created.
Now, the issue is...whenn the .txt document is included, a "1" shows up emmediately after it.
I checked the .txt file and the 1 isn't in the file itself.
So that tells me two things:
one, that it's because I'm including it
and two, that it's not in the text document itself, and rather is a reaction from including the .txt document.
Here's the code to write the email:
$filename = "emails.txt";
$date = date("F j, Y");
$email = stripslashes($_POST['email']);
if (!$email) { $email = "Not Available."; }
$add = "<p>".$date." -- ".$email."</p>\n\n";
$add2 = @file_get_contents($filename).$add;
$file = @fopen($filename, "w+");
@fwrite($file, $add2);
@fclose($file);
And here's the code to include the emails:
$username = "adminexample";
$password = "passwordexample";
$self = "index.php?page=logged_emails";
if ($_POST['username'] != $username || $_POST['password'] != $password) {
echo $loginwrap.$self.$loginwrapbot;}
else{
echo
include ("emails.txt");}
$loginwrap and $loginwrapbot are just parts of the form to login, and the styling around the form.
Anyone know why the mysterious "1" shows up??
I'm taking the email and writing it to the end of a .txt document, which I include on the admin page I created.
Now, the issue is...whenn the .txt document is included, a "1" shows up emmediately after it.
I checked the .txt file and the 1 isn't in the file itself.
So that tells me two things:
one, that it's because I'm including it
and two, that it's not in the text document itself, and rather is a reaction from including the .txt document.
Here's the code to write the email:
$filename = "emails.txt";
$date = date("F j, Y");
$email = stripslashes($_POST['email']);
if (!$email) { $email = "Not Available."; }
$add = "<p>".$date." -- ".$email."</p>\n\n";
$add2 = @file_get_contents($filename).$add;
$file = @fopen($filename, "w+");
@fwrite($file, $add2);
@fclose($file);
And here's the code to include the emails:
$username = "adminexample";
$password = "passwordexample";
$self = "index.php?page=logged_emails";
if ($_POST['username'] != $username || $_POST['password'] != $password) {
echo $loginwrap.$self.$loginwrapbot;}
else{
echo
include ("emails.txt");}
$loginwrap and $loginwrapbot are just parts of the form to login, and the styling around the form.
Anyone know why the mysterious "1" shows up??