ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am coding a registration page for my brother's web site.
A user submits registration details, and when he clicks submit an email is sent to him so he can verify his registration.
In the body of the email there is a link for the user to click to verify the registration.
What is the most common way of handling this situation? Right not I just have a link which passes the parameters username and password, where the password is encrypted. However, these details I feel should not be visible or obvious.
That's funny, I just thought of doing something like that.
My only reservation would be that perhaps more than one user gets the same random string? I know this would be highly unlikely, but is it possible?
I'm not quite what part of the security you are worried about. I assume your brother has to enter the admin username and password to confirm the details?
When the user clicks the link in the email, it takes him to a page which shows a message that his account is activated.
This page will also contain the PHP code which activates his username in the database, by simply changing a value in one of the fields.
Well, I'm not sure if you already know this, but in order to get a URI argument you have to use $_GET (e.g. $_GET['user']) but since you encrypted the entire query you'll have to do this manually. I don't know how you used the crypt() function, but maybe something like this will help
Code:
$userinfo = $_SERVER['QUERY_STRING']; // Replace here code to decrypt var
$parsedata = preg_split("/(user|&password)=/i", $userinfo, -1, PREG_SPLIT_NO_EMPTY);
$user = ereg_replace("[^A-Za-z0-9]", null, $parsedata[0]);
$pass = $parsedata[1];
I'm not sure if this code will be safe enough for you. It does split the query based on literals, but it is case-insensitive. It also checks the username for invaild characters (only letters and numbers are allowed).
Examples
Request: /test2.php?user=d&avid&password=12&345
Output:
query = user=d&avid&password=12&345
user = david
password = 12&345
Request: /test2.php?user=david+4&password=12&345&&&password=123&^4
query = user=david+4&password=12&345&&&password=123&^4
user = david
password = 12&345&&
Hope this points you in the right direction!
Last edited by guardian653; 06-26-2009 at 10:25 PM.
Originally posted by jacksmash I am coding a registration page for my brother's web site.
A user submits registration details, and when he clicks submit an email is sent to him so he can verify his registration.
In the body of the email there is a link for the user to click to verify the registration.
What is the most common way of handling this situation? Right not I just have a link which passes the parameters username and password, where the password is encrypted. However, these details I feel should not be visible or obvious.
I'm wondering if there is a better way?
Thanks for any help!
I did this before by getting the time of the registration and using the long value of the time as a temporary registration ID.
You can hash the users password and store it in a temporary table along with the users other information and then just move it when the email address has been verified.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.