Solved

php password code

Posted on 2006-11-01
4
173 Views
Last Modified: 2010-05-18
Hi

I have a form in php and have a field which is an access code.

I only want the form to send email if say the code BFHTUJM65
is exact in the access code field if not error displayed in the field.

THanks
0
Comment
Question by:buster808
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 2

Expert Comment

by:eheimer
ID: 17866891
If I understand correctly, you want a form that will allow the user to enter an email address, subject, message, and authorization code.  When the form is submitted the email will only be sent if the authorization code is correct, otherwise an error will be displayed.  Is that correct?  Maybe you can post the form that you have.
0
 
LVL 3

Accepted Solution

by:
royce2020 earned 500 total points
ID: 17877925
well, if you're not too fussed about security, you could just have something like "if $passCode ==  'BFHTUJM65' sendEmail()" in your PHP code. No one without access to your PHP files will be able to see it (it won't show in the generated HTML code if a user veiws the source), but somone with a packet sniffer/catcher could intercept it and use it (it's being sent to the PHP server in plain text inside the POST request after all) but this is a bit beond a standard user.

I myself would use one way encription. Encript your pass code in a tempory PHP file with the code:
echo crypt('BFHTUJM65', '$2a$07$rasmuslerd...........$')
This will printout the encripted pass code sometghing like :  
 $2a$07$rasmuslerd............nIdrcHdxcUxWomQX9j6kvERCFjTg7Ra
next, in your actual web code put the line:
if crypt(passcode, '$2a$07$rasmuslerd...........$') == "$2a$07$rasmuslerd............nIdrcHdxcUxWomQX9j6kvERCFjTg7Ra" sendEmail()

Hope that's answered your question
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Starting up a Project

734 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