Page 1 of 1

Email script.

Posted: Fri Jul 18, 2003 1:28 pm
by Goober
Hello,

I'm currently making a really weird email script, there is no need for me to go into great detail, so I won't. I wish to have the contents of the email that is sent in a txt file. Is this possible?

Thanks,
Joe

weird email

Posted: Fri Jul 18, 2003 5:17 pm
by easyteck
I assume that you know how to get the email data into a string...

So you can use something like:

Code: Select all

<?php
		if ( !file_exists ( $file_name ) )
		{
			$fp = fopen( $file_name, "a" );
			fputs ( $fp, $data_string );
		}
		fclose( $fp );

?>
This creates a new file with the $file_name path + name and inserts the $data_string into!.

cheers!

don pool

Posted: Sat Jul 19, 2003 9:40 pm
by Goober
hmmm...

Let me rephrase what I ment. I wish to put the contents of a text file into a variable. Is that possible?

I'm also creating a login script. When someone tries to view a page, I wish to check to see if the person is authorized, if not, then be sent directly to the login page, without seeing anything on the page that he was trying to view. This would mean that redirects can't work, because you can see the page you are trying to view for a minimum of one second. Any theories or facts?

Joe

...

Posted: Sun Jul 20, 2003 10:07 pm
by kettle_drum
Simply open the txt file and read the data into a string.

And then for your login. Check to see if the user is logged in before anything is sent to the page and set a varible to true if they are, then just do:

Code: Select all

if($user_logged_in)&#123;
   #
   #this is my secret member area only :)
   #
&#125;else&#123;
   echo "You are being redirected";
   #
   #redirect code
   #
&#125;
As long as you only print the data within the if statement then un-authorised users wont see anything.

Posted: Sun Jul 20, 2003 10:13 pm
by Goober
You're a genius. You make me feel stupid. I love you.

Posted: Mon Jul 21, 2003 3:18 am
by twigletmac
Moved to PHP - Normal -> the PHP - Advanced forum is not intended for 'how to' questons.

Mac