Solved

php password code

Posted on 2006-11-01
4
169 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
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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
split53 challenge 7 99
firstswap challenge 20 78
Using VBscript & RegEx, how can I match lines starting with Oracle word 17 59
Cygwin - GNU GPL License 1 25
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 …
This is about my first experience with programming Arduino.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

831 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