Welcome to WebmasterWorld Guest from 54.167.86.211

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Confirmation email link without a database

Email stored in temp file, then saved to new on confirmation

     
3:11 am on Jun 8, 2012 (gmt 0)

Junior Member

5+ Year Member

joined:Jan 4, 2011
posts: 73
votes: 0


I realize that this question has been asked many times, but I've yet to find a flatfile version.

I'm looking for a way to achieve this:

Scenario:

A person submits their email address via a form.

The email is then stored in flatfile database (.txt)

The person then gets an auto-reply email with a link to confirm their email address.

Upon confirming after clicking the link, their email address is saved to a new file (confirmed_emails.txt for example).

Is this possible without the use of a SQL/similar datase, and how can I achieve this?

Note: SQL or other database option, is not an option unfortunately.
9:36 am on June 8, 2012 (gmt 0)

Administrator from US 

WebmasterWorld Administrator incredibill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 25, 2005
posts:14624
votes: 88


It's quite trivial really.

Write the original contents in a file named email_address.txt and when they confirm it rename it to confirmed_email_address.

I'd probably use an MD5 version of the email address to avoid the special characters that can be in email addresses that can cause trouble.
3:52 pm on June 8, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 0


The tools you will use are PHP mail() [php.net] and file_get_contents() [us2.php.net] or if you're on an old version of PHP, fopen() [us2.php.net] and related functions described in See Also section.

You'd likely have two scripts, one to initiate the mail and store the email in the first file, one to receive the input from the email link.

I would also suggest storing this file in a location inaccessible from the web and only from your script to avoid someone stumbling on it and mining your email addresses.
1:10 am on June 11, 2012 (gmt 0)

Junior Member

5+ Year Member

joined:Jan 4, 2011
posts: 73
votes: 0


What would an inaccessible folder be, one such as cgi-bin maybe?
4:11 pm on June 11, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 0


Generally no. cgi-bin is usually for CGI executables or scripts. For example, on some systems perl scripts will only execute if they reside in the cgi-bin directory, but it's still accessible via the web.

It depends on the setup. Your "visible" (from the web) might reside in public_html, so you possibly have

_private
_vti_bin
_vti_cnf
_vti_pvt
_vti_log
_vti_txt
cgi-bin
images
includes
somescript.php
index.php

Of those, only "_private" is a viable location within the "public_html" directory to store such files. It's not browsable, that's why it's "private."

Even that may have issues, another approach might be to store the file somewhere **outside** public_html, if you can and are allowed.

This is just one setup, like I said it depends on the system.
4:37 pm on June 11, 2012 (gmt 0)

Junior Member

5+ Year Member

joined:Jan 4, 2011
posts: 73
votes: 0


Unfortunately I don't. Is there a way to do it with .htaccess?
2:31 pm on June 12, 2012 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12533
votes: 0


You can restrict access to a directory or even a file using Apache configuration directives. See the following resources for more information:

Apache 2.2
[httpd.apache.org...]

Apache 2.4
[httpd.apache.org...]
2:42 pm on June 12, 2012 (gmt 0)

Full Member

joined:Mar 22, 2011
posts:339
votes: 0


fredfletcher wrote:
Note: SQL or other database option, is not an option unfortunately.

Not even SQLite?

--
Ryan
2:01 am on June 13, 2012 (gmt 0)

Junior Member

5+ Year Member

joined:Jan 4, 2011
posts: 73
votes: 0


@Ryan - SQLite might be an option. Am looking into it, thanks.
2:02 am on June 13, 2012 (gmt 0)

Junior Member

5+ Year Member

joined:Jan 4, 2011
posts: 73
votes: 0


Thanks for the info Coopster
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members