Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to hide email script 3

Status
Not open for further replies.

deecee

Technical User
Aug 25, 2001
1,678
US

you can enter your email and then the form is processed through
but you can go straight to
how can i make it so that you can only go to the email page if you enter your email because I still get emails if i just type
Is it even possible to deny access to the page unless there is a variable passed on [soapbox]
sleep is good
 
I'd suggest getting to work first, then worry about restricting it.

To restrict it you have several options depending on just how tight you want it.

The first, just use sleipnir's tip from above
if (array_key_exists(....))
on one of your form fields... if you're using querystrings however, this might be a little too easy to get by, so then session variables are your best bet...

but first just get it to work with properly formed data, then worry about people sneaking in.

-Rob
 
slep i think im getting array_key_exists

and sky thanks for that tip on debugging, the parser is fine when i check to see if the variables were being passed, now i just have to go back and see how i can get slep method to work

one question how would i use array_key exists for multiple

if (array_key_exists('email', $_POST) || array_key_exists('firstName', $_POST)...etc

is this right, and does this check that all the inputs are entered or just 1? [soapbox]
sleep is good
 
so how would i check for multiple keys? [soapbox]
sleep is good
 
The way you did in your question.

But keep in mind, if you are testing $_POST, then you don't need to test all of them -- just test for one field that will always be sent on a submit, like a field of type text. Don't test against a checkbox, which will not necessarily be sent each time.

If that field exists, then a form was submitted. Then you can go about checking whether the data in all the fields is well-formed. Want the best answers? Ask the best questions: TANSTAAFL!
 
lol i dont even know how to ask this hehe...

well formed?

[hammer] [soapbox]
sleep is good
 
The short answer: its format conforms to your expectations or requirements.

You have an field named "email_address" on an HTML form in which the user is supposed to enter an email address.

The user enters "foo" and submits. %_POST['email_address'] will exist. However, the data it contains is not well-formed for your purposes -- it isn't a valid email address (ignoring that fact that most mail servers would probably deliver the message if there were a user "foo" configured locally).

An entry of "foo@bar.com" is a well-formed datum for an email address.

Please note that well-formed is not the same thing as valid. A well-formed email address does not have to exist. An address will be valid if and only if it is both well-formed and the address can be used to deliver a message. Want the best answers? Ask the best questions: TANSTAAFL!
 
Or another example:

A is hitting on B in a bar. B wants to get rid of A, but doesn't want to make a scene. A asks B for his/her phone number. B writes a number down, hands it to A, then leaves the bar. A glances at the number before his puts it in his/her pocket, noting that it has all the right digits in all the right places.

B has given A a well-formed telephone number.

However, when the next morning A calls that number, he/she discovers to his/her dismay that the number will only connect him/her to a phone-company recording which states that the telephone number dialed is not in service.

We all now know that B has given A a well-formed but invalid telephone number. Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top