Registering email addresses

Hello

I have been asked to design a site that includes a simple registration system. Essentially the customer wants a few general entry pages but when his viewers try to access specific product pages he wants to have a means to register them/intercept them with a view to capturing their email address (so email needs to be validated). He can then assess wether the viewers are new customers or competitors peeking at his wares.

Is there an action or script that does this simply? First up, I am a PHP novice and although I have spent all morning messing about with a script that looked possible it refuses to work for me. Probably some bad setting in the config file but I’m poking around in the dark really. I would like to understand it, or at least understand where I’m going wrong and generally working within Freeway I find I can see the logic. External scripts tend to have very brief instructions and assume php savviness.

Would a form be best - but then how do I get it to validate the email address for me?

Any suggestions, references to other threads etc much appreciated.

Pete

On 29 Nov. 2007, 1:34 pm, petemac wrote:

Hello

I have been asked to design a site that includes a simple
registration system. Essentially the customer wants a few general
entry pages but when his viewers try to access specific product pages
he wants to have a means to register them/intercept them with a view
to capturing their email address (so email needs to be validated). He
can then assess wether the viewers are new customers or competitors
peeking at his wares.

Is there an action or script that does this simply? First up, I am a
PHP novice and although I have spent all morning messing about with a
script that looked possible it refuses to work for me. Probably some
bad setting in the config file but I’m poking around in the dark
really. I would like to understand it, or at least understand where
I’m going wrong and generally working within Freeway I find I can see
the logic. External scripts tend to have very brief instructions and
assume php savviness.

Would a form be best - but then how do I get it to validate the email
address for me?

Any suggestions, references to other threads etc much appreciated.

Pete

Checking an e-mail address has to be one of the most-solved problems on the net. It’s deceptively slippery, though, and most checkers get some part of it wrong in one way or another, most usually bouncing a real address.

Here’s the one I use, not guaranteed, but usable in most cases:

function valid_email($strEmail) { 
	if(eregi("^[a-z0-9._-]+@+[a-z0-9._-]+.+[a-z]{2,6}$", $strEmail)) {
	return TRUE; 
	}else{
	return FALSE; 
	}
} //end function valid_email	
//usage: if(valid_email($email)) do_something();

As far as registration goes, what do you want to do with these addresses, and how do you want to store them? If you could provide a little more detail about this, I would be happy to suggest a solution.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks Walt

One way or another my customer wants to store valid addresses for his
future reference. He doesn’t want to collect a load of input
gibberish so the addresses need to check out before allowing the
viewer any further.

I’m happy to be advised about the nature of the storage. A database
on the server? Email return to an info@ address which generates an
auto reply with login details…(although that would probably be a
fixed message and easy to subvert)? I imagine there are a variety of
solutions but simplicity is the essence. The site is being built from
the ground up so I would like to incorporate a solution now rather
than bolt it on later. Does this answer your question…?

Where would you place your example code in a Freeway document?

Pete

On 29 Nov 2007, at 14:49, waltd wrote:

On 29 Nov. 2007, 1:34 pm, petemac wrote:

Hello

I have been asked to design a site that includes a simple
registration system. Essentially the customer wants a few general
entry pages but when his viewers try to access specific product pages
he wants to have a means to register them/intercept them with a view
to capturing their email address (so email needs to be validated). He
can then assess wether the viewers are new customers or competitors
peeking at his wares.

Is there an action or script that does this simply? First up, I am a
PHP novice and although I have spent all morning messing about with a
script that looked possible it refuses to work for me. Probably some
bad setting in the config file but I’m poking around in the dark
really. I would like to understand it, or at least understand where
I’m going wrong and generally working within Freeway I find I can see
the logic. External scripts tend to have very brief instructions and
assume php savviness.

Would a form be best - but then how do I get it to validate the email
address for me?

Any suggestions, references to other threads etc much appreciated.

Pete

Checking an e-mail address has to be one of the most-solved
problems on the net. It’s deceptively slippery, though, and most
checkers get some part of it wrong in one way or another, most
usually bouncing a real address.

Here’s the one I use, not guaranteed, but usable in most cases:

function valid_email($strEmail) {
if(eregi(“[1]+@+[a-z0-9._-]+.+[a-z]{2,6}$”,
$strEmail)) {
return TRUE;
}else{
return FALSE;
}
} //end function valid_email
//usage: if(valid_email($email)) do_something();

As far as registration goes, what do you want to do with these
addresses, and how do you want to store them? If you could provide
a little more detail about this, I would be happy to suggest a
solution.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


  1. a-z0-9._- ↩︎

On Nov 29, 2007, at 10:42 AM, Pete MacKenzie wrote:
Thanks Walt

One way or another my customer wants to store valid addresses for his
future reference. He doesn’t want to collect a load of input
gibberish so the addresses need to check out before allowing the
viewer any further.

Of course. The code I posted would not guarantee that the address was real, just that it “looked like” a real address. It will pass happily on anything in the form of [any alphanumeric character or dot] [an at-sign] [two or more strings separated by at least one dot, the last of which must be between two and six characters in length]. So without any form of email verification, like, say, the system you had to pass through in order to register for this forum, you could collect a lot of example of the type: asdfasdf.asdf @ asdfasdf.asdfasdf.xxx

If you really want to collect real addresses as the barrier to entry, then you need to do something where the instructions for download are sent to the visitor, and you rotate the keys so that they can’t be abused.

You can take this part as seriously as you need to. It really depends a lot on the type of content you are protecting whether you go this far at all. I went a long way in protecting this forum, because the e-mail addresses collected here are like crack to the spam addicts of the world.

I’m happy to be advised about the nature of the storage. A database
on the server? Email return to an info@ address which generates an
auto reply with login details…(although that would probably be a
fixed message and easy to subvert)? I imagine there are a variety of
solutions but simplicity is the essence. The site is being built from
the ground up so I would like to incorporate a solution now rather
than bolt it on later. Does this answer your question…?

Exact implementation would depend a lot on how many contacts you expect to gather. A plain text file on the server somewhere could be written to by a simple PHP process, adding a new line with each address. Your client could FTP that down periodically and look to see if there are any new addresses. Or, that same process could send a simple e-mail to your client after each successful posting. Filter on the subject line (in the Mail application) and you could put all such messages in a new in-box on your computer for safe-keeping. If you are getting thousands of these, then a full-blown database solution would be warranted.

Where would you place your example code in a Freeway document?

If you wanted to make a single page invisible unless someone came to it from your form page and entered a real e-mail address, you could do the following:

  1. Make a new page in Freeway, and change the filename of the page to whatever.php.

  2. In Page>HTML Markup move to the Before HTML section and add the following code:

     <?php
     //paste in the function here, minus the start and end php tags
     $email = $_POST['email'];
     if( ! valid_email($email)){
         header('Location: your_form_page.php?error=That+did+not+look+like+a+real+e-mail+address!');
         exit;
     }
     ?>
    
  3. Now make “your_form_page.php”. Name the file whatever you want, just be sure to use the same name in your protected page script. On this page, in the same Before HTML part of the page markup dialog, enter this:

     <?php $error = (isset($_GET['error'])) ? $_GET['error'] : ''; ?>
    

    Make sure that your form on the form page points to your secure page, using a method of POST, and that your e-mail address field is named email.

    Somewhere on the page, add a Markup Item where you want the error message to appear if needed. Paste this into that field: <?=$error?>

  4. Test it out. You should be redirected back to the form if you try entering a “bad” address.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks for your time Walt

If you really want to collect real addresses as the barrier to
entry, then you need to do something where the instructions for
download are sent to the visitor, and you rotate the keys so that
they can’t be abused.

You can take this part as seriously as you need to. It really
depends a lot on the type of content you are protecting whether you
go this far at all. I went a long way in protecting this forum,
because the e-mail addresses collected here are like crack to the
spam addicts of the world.

Exact implementation would depend a lot on how many contacts you
expect to gather.

I suspect not a huge amount. It’s a specialist field (well, it’s a
company that sells grass seed so literally deals with fields - from a
terminology point of view this could get complicated!). The content
will be product varieties etc. Not very sensitive info but worth
monitoring who is looking at it.

Or, that same process could send a simple e-mail to your client
after each successful posting. Filter on the subject line (in the
Mail application) and you could put all such messages in a new in-
box on your computer for safe-keeping.

Ultimately this sounds like the sort of system that my client could
handle without too much head scratching. The key seems to be getting
the validation from the enquirers computer so that if they want a
quick response they couldn’t just put in their mum’s address to fool
the system. Of course this is where it gets into complicated (for me)
coding. I’m sure there’s an out-of-the-box solution that I would
master eventually. I got half way with the script i mentioned but
something hasn’t gelled and the registration window doesn’t appear.
Ho hum.

If you wanted to make a single page invisible unless someone came
to it from your form page and entered a real e-mail address, you
could do the following:

  1. Make a new page in Freeway, and change the filename of the page
    to whatever.php.

  2. In Page>HTML Markup move to the Before HTML section and add the
    following code:

     <?php
     //paste in the function here, minus the start and end php tags
    

the function being the example code in your earlier post?

    $email = $_POST['email'];
    if( ! valid_email($email)){
        header('Location: your_form_page.php?error=That+did+not 

+look+like+a+real+e-mail+address!');
exit;
}
?>
3. Now make “your_form_page.php”. Name the file whatever you want,
just be sure to use the same name in your protected page script. On
this page, in the same Before HTML part of the page markup dialog,
enter this:

    <?php $error = (isset($_GET['error'])) ? $_GET['error'] :  

‘’; ?>

Make sure that your form on the form page points to your secure  

page, using a method of POST, and that your e-mail address field is
named email.

Somewhere on the page, add a Markup Item where you want the  

error message to appear if needed. Paste this into that field: <?= $error?>

  1. Test it out. You should be redirected back to the form if you
    try entering a “bad” address.

I shall have a wrestle with this and see if I can get something
working
Cheers
pete


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On Nov 29, 2007, at 12:51 PM, Pete MacKenzie wrote:

Thanks for your time Walt

I suspect not a huge amount. It’s a specialist field (well, it’s a
company that sells grass seed so literally deals with fields - from a
terminology point of view this could get complicated!).

No doubt they are outstanding in their field. :sunglasses:

The content
will be product varieties etc. Not very sensitive info but worth
monitoring who is looking at it.

Or, that same process could send a simple e-mail to your client
after each successful posting. Filter on the subject line (in the
Mail application) and you could put all such messages in a new in-
box on your computer for safe-keeping.

Ultimately this sounds like the sort of system that my client could
handle without too much head scratching. The key seems to be getting
the validation from the enquirers computer so that if they want a
quick response they couldn’t just put in their mum’s address to fool
the system.

The simplest thing would be to send the key in e-mail, that way there
would be no way to game the system.

Of course this is where it gets into complicated (for me)
coding. I’m sure there’s an out-of-the-box solution that I would
master eventually. I got half way with the script i mentioned but
something hasn’t gelled and the registration window doesn’t appear.
Ho hum.

    <?php
    //paste in the function here, minus the start and end php  

tags

the function being the example code in your earlier post?

Yes, that’s how you would test the e-mail address for well-formedness.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hello Walt

Hmmm a new development. I got the script I mentioned before to work
after a bit more hair tearing and it does incorporate a similar area
of code to your example for validating that the address is
legitimate. It also does the whole send-an-activation-key business
too. So far so good. It doesn’t directly send email info back to the
an email address but works off a MySql database - nothing special
there, what is special is my level of ignorance about the real
workings of all this. Anyway, do you have an idea how would one
access the email addresses? They are stored because I tried re-
registering and it told me the address was on record. Is this MySql
work, of which I have no clue at all? I realise we are drifting away
from actual Freeway stuff here so feel free to email me off list if
it seems appropriate.

Many thanks for your thoughts so far.
Pete
k

On 29 Nov 2007, at 18:08, Walter Lee Davis wrote:

On Nov 29, 2007, at 12:51 PM, Pete MacKenzie wrote:

Thanks for your time Walt

I suspect not a huge amount. It’s a specialist field (well, it’s a
company that sells grass seed so literally deals with fields - from a
terminology point of view this could get complicated!).

No doubt they are outstanding in their field. :sunglasses:


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

OK ignore this. I’ve found how to view the addresses in MyPHP admin.
It’s gradually coming together as one bit of knowledge thuds into
another.

I read somewhere that there is as much information in one daily issue
of the Times newspaper as a man in the 17th century would accumulate
in his whole life. Sometimes I feel like that 17C man struggling to
comprehend new concepts in a 21C world.

Pete

On 30 Nov 2007, at 08:49, Pete MacKenzie wrote:

Hello Walt

Hmmm a new development. I got the script I mentioned before to work
after a bit more hair tearing and it does incorporate a similar area
of code to your example for validating that the address is
legitimate. It also does the whole send-an-activation-key business
too. So far so good. It doesn’t directly send email info back to the
an email address but works off a MySql database - nothing special
there, what is special is my level of ignorance about the real
workings of all this. Anyway, do you have an idea how would one
access the email addresses? They are stored because I tried re-
registering and it told me the address was on record. Is this MySql
work, of which I have no clue at all? I realise we are drifting away
from actual Freeway stuff here so feel free to email me off list if
it seems appropriate.

Many thanks for your thoughts so far.
Pete
k

On 29 Nov 2007, at 18:08, Walter Lee Davis wrote:

On Nov 29, 2007, at 12:51 PM, Pete MacKenzie wrote:

Thanks for your time Walt

I suspect not a huge amount. It’s a specialist field (well, it’s a
company that sells grass seed so literally deals with fields -
from a
terminology point of view this could get complicated!).

No doubt they are outstanding in their field. :sunglasses:


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options