Solved

php password code

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

840 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