Zubrag.com
December 11, 2018, 07:10:39 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: More detailed sign-up procedure  (Read 7986 times)
1ststop
Newbie
*
Posts: 30


« on: September 11, 2009, 09:06:40 AM »

I've been using the standard PHP user script for a while now to protect several directories, each with its own user list (password_protect.php)

What I need now is an elaboration of this advanced script. I've tried to 'play' with it but can't seem to make it do what I want.

What I need is this:

A user comes to home page and is required to validate their email address which has already been added to a user file previously.
This bit is quite simple. I've achieved it by simply using the advanced script in a base directory. I know it could also be achieved with the basic script but I like the web 'manage.php' interface the advanced script offers as it is much easier to use overall.

From the validation of their email I need the login cookie set but I need the user info to be read from the cookie and entered into a hidden field on the next page to use as a pre-set username. On this page I need the user to be able to select the directory they wish to have as their home directory.
The pre-set username (user's email in hidden field) and directory name (selected from list) would then become thier username and password to be added to the users.php on submit


After seeing the potential of this script, I'm certain this is the one for me, but I need help with the coding as I know nothing about PHP. What I have done so far was achieved with Dreamweaver snippets or copy/paste from other code.

I really need help with this and willing to pay if the script is right. Does anyone have any ideas?

Logged
1ststop
Newbie
*
Posts: 30


« Reply #1 on: September 11, 2009, 09:12:17 AM »

What I forget to mention that the second entry of username/password would be to an additional users.php for a new sub directory, thus being independant of the first 'validation' database.
Logged
1ststop
Newbie
*
Posts: 30


« Reply #2 on: September 13, 2009, 11:00:36 AM »

OK. I have successfully set this script up to do mostly what I want it to do with just ONE exception:

I just can't get the signup to read the username from the set cookie to use as the new username.

I'm using the script's files TWICE for login_validate (admin user entry) and for main login (following user signup). Following login_validate.php the user is redirected to signup.php to create their account. It is at THIS point I want the username to AUTO ENTER from the set cookie using the validated username. The user can then enter their password and their select their chosen directory from the list and submit.

The php files as downloaded originally have hardly been changed at all except to include the new signup field (directory select).

All files with the ending of _validate.php are assosciated with the appropriate settings_validate.php etc

The file structure I am using is as below:

flatfile.inc.php
login.php
login_footer.php
login_form.php
login_form_validate.php
login_header.php
login_validate.php
manager.php
manager_validate.php
password_protect.php
password_protect_validate.php
reminder.php
reminder_footer.php
reminder_form.php
reminder_header.php
settings.php
settings_validate.php
signup.php
signup_footer.php
signup_form.php
signup_header.php
users.def
users.php
users_validate.def
users_validate.php



All relevent references within PHP have been made to relevant standard or _validate files so everything now works superbly, just as I want it to EXCEPT for the auto-enter of the validated username into the signup form.

I would really appreciate some help on this. Does ANYBODY have any ideas?

I've tried the echo $login approach but it doesn't work.

Thankyou in advance.

Logged
1ststop
Newbie
*
Posts: 30


« Reply #3 on: September 15, 2009, 04:17:47 PM »

Oh well... Since nobody was interested in helping me, I guess nobody is interested in knowing how I've solved all of my problems and now got a fully working script.

Good luck everybody. Don't ask me for help. You won't get any.
Logged
recoding
Global Moderator
Jr. Member
*****
Posts: 71


WWW
« Reply #4 on: September 21, 2009, 11:51:19 AM »

Good to hear you got it fixed, sorry that you didn't get a reply, we would like to know how you fixed this, as php is open source, as is this script it's good and proper nature to share your updates etc. But we/I understand if you do not want to Smiley
Logged

1ststop
Newbie
*
Posts: 30


« Reply #5 on: September 23, 2009, 05:32:04 AM »

Thankyou for responding recoding. I have spent hours on this script and still value the fact that I was initially able to download it free so that I could 'play' with it so I will share my resolve with you.

First of all, I realised after a while that the cookie set by the code was encrypted in MD5. I researched some tutorials on the net and learned that MD5 is one-way encryption. It can be retrieved in MD5 but it cannot be decrypted to original form.
So, I set my own.
My script requires that the user validate their email and then create their user account with the validated email address as the username of the user account. Without validating the email address they are not able to create an account. This is due to selling access to the site.

My version of the script uses two user databases. One is added to via admin only with the emails that are 'authorised' users. The other is a normal one as the script intended originally.

This is how it works...
Admin add the details to the 'authorised' users file.

A customer then validates their email address (login_validate.php) and the username (their email address) is set into the value of a new cookie called 'username' with the value $login. Code: setcookie("username", $login);
The user is then redirected to signup.php.
On the signup_form.php I added the code <?php $username = $_COOKIE["username"]; ?> to retrieve the value from the new cookie. This must be fairly early in the form's code.
The signup_form.php has the 'login' altered as a hidden field and the code print $username added as the value.
Full code: <input type='hidden' name='access_login' value='<?php print $username; echo $this-> $login?>' />

That takes care of the initial problem of recognising the validated username into the signup form.

The directory select was more difficult as the script is not able to differentiate between directories. (cannot find user database problems)
My site has a set number of 'destinations' that users would go to depending on their circumstances. I realised it was not going to be possible to do it with seperate directories so I went a bit more advanced which ultimately provided a simpler solution long-term.
All users are now redirected to the SAME home.php page which uses personalised (pre-set) information that is included within a hidden value of the signup form during their 'selection' of a destination.
This process is an entire script in itself so I won't go into it here, but suffice to say it involves  adding fields to the signup_form.php (instructions can be found on the forum) and then 'hiding' values into the selecter whch are then retrieved on the home.php page using the explode function and set into new strings for use within the personalised home.php page so each user sees only the information relevant to them.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC