Solved

Writing to a File?

Posted on 2002-07-20
2
161 Views
Last Modified: 2006-11-17
I'm having troubles writing to a file!  Weird.

I have this little routine going :

$dataFile = "http://mydomain.com/upgrademaillist.txt";

if(strstr($emailAddress,'@') && strstr($emailAddress,'.')) {
     $fd = fopen("$dataFile", "a");
     fwrite($fd, "$emailAddress");
     outputStatus("Sign-Up Successful...","Thank you for signing up for our upgrade newsletter.<p>You will be notified via this submitted email address as soon as we have completed the upgrade.<p>Submitted Mail Address : $emailAddress");
     fclose($fd);
} else {
     outputStatus("Sign-Up Error...","That email address does not seem to be valid.<p>Please try again...");
     exit;
}

There is various error checking before, and that all seems to be working fine.... if all the errors result in a PASS, then the above routine get's executed... I get the SUCCESS message, saying that the mail address has been recorded... but, the data file remains empty.

Any ideas?
0
Comment
Question by:nicey
2 Comments
 
LVL 32

Accepted Solution

by:
Batalf earned 75 total points
ID: 7167258
Maybe you could try to change the link to your file.

Instead of

$dataFile = "http://mydomain.com/upgrademaillist.txt";,

try:

$dataFile = "upgrademaillist.txt"; or the relative path to the file.

Batalf
0
 
LVL 1

Author Comment

by:nicey
ID: 7167270
Of course!!!

Done it... how stupid of me in the first place. :-D

I knew a fresh face would pick out the error.

Cheers mate. ;-)
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now