Zubrag.com
September 16, 2019, 06:44:02 AM *
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] 2
  Print  
Author Topic: How to Add to the signup form  (Read 24089 times)
timholt
Newbie
*
Posts: 8


« on: January 21, 2008, 09:57:35 AM »

I have added a mailing address to the form and users.def but it will not report to users.php. and manager.php, what do I need to do.

Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #1 on: January 21, 2008, 11:39:11 AM »

Hi. Could you post your users.def contents here?
Logged
timholt
Newbie
*
Posts: 8


« Reply #2 on: January 21, 2008, 12:14:39 PM »

Here you go Zubrag,

Login,STRING,15
Password,STRING,15
Email,STRING,30
Mailing Address,30
City,30
State,2
Zip Code,5
Redirect URL,STRING,40
Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #3 on: January 21, 2008, 01:04:42 PM »

Each column you add should have data type specified. Like STRING, TEXT, etc. Your fixed definition file would look like this:

Login,STRING,15
Password,STRING,15
Email,STRING,30
Mailing Address,STRING,30
City,STRING,30
State,STRING,2
Zip Code,STRING,5
Redirect URL,STRING,40
Logged
timholt
Newbie
*
Posts: 8


« Reply #4 on: January 21, 2008, 03:08:39 PM »

Thanks Zubrag,
Now I have a column for each in manager.php but it's blank. It's not posting the addtional info to manager its just blank. Below is my signup_form.php, is it correct?

<form method="post">
      <img src="/protect/signup.jpg" align="left"><h3><font color="CC9966">HPT Archives Registration</h3></font>
      <font color="red"><?php echo $this->error; ?></font><br />
      Login:<br /><input type='input' name='access_login' value='<?php echo $this->login ?>'/><br />Password:<br />
      <input type="password" name="access_password" />
  <?php if (USE_EMAIL && !LOGIN_AS_EMAIL) echo "<br />Email:<br /><input type='input' name='access_email' value='$this->email' />"; ?><br />
      Mailing Address:<br /><input type='input' name='address' value='<?php echo $this->address ?>' /><br />
     City:<br /><input type='input' name='city' value='<?php echo $this->city ?>' /><br />
     Zip Code:<br /><input type='input' name='zip'value='<?php echo $this->zip ?>' /><br />
     State:<br /><input type='input' name='state'value='<?php echo $this->state ?>' /><br />
     <p></p>
      <input type="submit" name="access_submit" value="Sign up" />
    </form>
Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #5 on: January 23, 2008, 09:11:51 AM »

Hi. Adding fields on the signup form does not automatically get them filled in database (i.e. what you see in manager.php)

In order to save them, you'll have to update following code in signup.php

function parse_user_input() {
    $this->login = isset($_POST['access_login']) ? $_POST['access_login'] : '';
    $this->pass = $_POST['access_password'];
    $this->email = LOGIN_AS_EMAIL
                 ? $this->login
                 : (isset($_POST['access_email']) ? $_POST['access_email'] : '');
    $this->city = $_POST['city'];
    $this->zip = $_POST['zip'];
    ... same for other fields you want to be saved from signup.php


Code in bold should be added

Also, following code needs to be updated with your new fields:

    fputs($fusers, "\n" . $this->login. ',' . $this->pass . ',' . $this->email . ',' . $this->city . ',' . $this->zip);

Does this help?
Logged
timholt
Newbie
*
Posts: 8


« Reply #6 on: January 23, 2008, 04:01:55 PM »

Thanks!!

My add ons work perfectly now!
This is a great script and we appreciate all the support.

Thanks again...
Logged
hawkeye0386
Newbie
*
Posts: 12


« Reply #7 on: February 05, 2008, 10:15:54 AM »

Hi Zubrag,

I am working on this right now, and I can't seem to get it to work. Here is are my files.

user.def

Login,STRING,15
Password,STRING,15
Email,STRING,30
First Name,String,30
Last Name,String,30
Redirect URL,STRING,40

signup_form.php

<form method="post">
      <p><span class="style3">User signup</span></p>
      <p><font color="red"><?php echo $this->error; ?></font><br />
         
       <font color="#BA9715" size="2" face="Verdana, Arial, Helvetica, sans-serif">Login:</font><br />
         <input type='input' name='access_login' value='<?php echo $this->login ?>'/><br />
         <font color="#BA9715" size="2" face="Verdana, Arial, Helvetica, sans-serif">Password:</font><br />
         <input type="password" name="access_password" />
         <?php if (USE_EMAIL && !LOGIN_AS_EMAIL) echo "<br />Email:<br /><input type='input' name='access_email' value='$this->email' />"; ?>
         <br>
         <span class="style4">First Name:</span><br />
        <input type='input' name='FirName' value='<?php echo $this->FirName ?>' />
        <br />
         <span class="style4">Last Name:</span><br />
        <input type='input' name='LasName'value='<?php echo $this->LasName ?>' />
        <br />

signup.php

   $this->login = isset($_POST['access_login']) ? $_POST['access_login'] : '';
    $this->pass = $_POST['access_password'];
    $this->email = LOGIN_AS_EMAIL
                 ? $this->login
                 : (isset($_POST['access_email']) ? $_POST['access_email'] : '');
   $this->FirName = $_POST['first name'];
    $this->LasName = $_POST['last name'];
   
    fputs($fusers, "\n" . $this->login . ',' . $this->pass . ',' . $this->email . ',' . $this->FirName . ',' . $this->LasName);

Can you find what I am doing wrong. Thanks!
Logged
Revenant
Newbie
*
Posts: 6


« Reply #8 on: February 10, 2008, 07:51:05 PM »

Could it be that you need an underscore for first_name, and last_name

Code:
   $this->FirName = $_POST['first name'];
    $this->LasName = $_POST['last name'];

Just a sincere guess.
Logged
hawkeye0386
Newbie
*
Posts: 12


« Reply #9 on: February 10, 2008, 10:14:46 PM »

I believe so.
Logged
Revenant
Newbie
*
Posts: 6


« Reply #10 on: February 14, 2008, 05:13:17 PM »

My login form keeps redirecting to the $fullname in the address bar on submission.  Example: www.test.com/ppa/testfirstname%20testlastname

 Huh

Please help
Logged
hawkeye0386
Newbie
*
Posts: 12


« Reply #11 on: March 18, 2008, 07:38:42 AM »

you need to make sure the word String is all caps (like this STRING)
Logged
CyndiSmith
Goddess of Reverse Engineering
Newbie
*
Posts: 4



« Reply #12 on: May 10, 2008, 04:27:24 PM »

This was a great string of posts!  I've followed carefully (and with much anxiety) and have just updated my signup page, and it seems to be working great.

THANK YOU ALL FOR THE GREAT CORRECTIONS, and for the idea in the first place.  I'll let you know how it goes.

 Cheesy Cyndi
Logged

Smiley Learning from the best!
CyndiSmith
Goddess of Reverse Engineering
Newbie
*
Posts: 4



« Reply #13 on: May 10, 2008, 07:34:56 PM »

Hi!  Thanks again for this great code…  I’m quite the NEWBIE at this, but have found your instructions very easy to follow and extremely helpful.  Here’s where I am now:

1.   The "Password Protect Advanced" program is set up and it’s working great. E-mail retrieval of username & password works great, too.

2.   I’ve added new fields to the signup form, plus I’ve added an “access code” that requires people to have that special code before they can sign up.  Hopefully, all the required code updates have been made in the user.def file, signup_form.php, and signup.php. (see code below) 

3.   After following all the instructions for adding elements to the signup form,
I am still not getting data posted to the users file (so that I can see it in managers.php). 

**When I access the management page, all the database columns are blank except for user, password – I need to capture their first and last names.


         After signing in with
         “user, password, me@cyndismith.com, firstname, lastname, TVF2008(the access code),"
           here’s what my users.php file looks like:

          <?php die(); ?>
          user1,password1,email1@user.com,http://example.com,,

          login,password,me@cyndismith.com,,


Here's my code:

user.def   (note, I don’t have any user-specific URLs that I need to assign)

    Login,STRING,15
    Password,STRING,12
    Email,STRING,30
    First Name,STRING,20
    Last Name,STRING,20
    Redirect URL,STRING,10

signup_form.php  (note, I’m also using the “access code” function, and it works great!)

     <form method="post">
      <h3>User Registration and Authentication</h3>
      <font color="red"><?php echo $this->error; ?></font>
     <br />
      Login: ( Create User Name)<br /><input type='input' name='access_login' value='<?php echo $this->login ?>'/>
     <br />
     Password:<br />
      <input type="password" name="access_password" />
      <?php if (USE_EMAIL && !LOGIN_AS_EMAIL) echo "<br />Email:<br /><input type='input' name='access_email' value='$this->email' />"; ?>
       <br>
        <span class="style4">First Name:</span><br />
        <input type='input' name='FirName' value='<?php echo $this->FirName ?>' />
       <br />
        <span class="style4">Last Name:</span><br />
        <input type='input' name='LasName'value='<?php echo $this->LasName ?>' />
       <br />
     <br />
     <span class="style4">Secret Access Code:</span><br />
      <input type='input' name='access_code'value= >
      <p>
      <input type="submit" name="access_submit" value="Sign up" />
     </p>
    </form>


signup.php:

function parse_user_input() {
    $this->login = isset($_POST['access_login']) ? $_POST['access_login'] : '';
    $this->pass = $_POST['access_password'];
    $this->email = LOGIN_AS_EMAIL
                 ? $this->login
                 : (isset($_POST['access_email']) ? $_POST['access_email'] : '');
    $this->FirName = $_POST['first_name'];
    $this->LasName = $_POST['last_name'];
   $this->code = $_REQUEST['access_code'];


function save_user() {
    // save user to database
    $fusers = fopen(USERS_LIST_FILE,'a+');
    if (!$fusers) {
      $this->error = "Cannot add user to database.";
      return false;
    }
    fputs($fusers, "\n" . $this->login. ',' . $this->pass . ',' . $this->email . ',' . $this->FirName . ',' . $this->LasName);
    fclose($fusers);


Thanks so much for helping me out on this.  The password access is wonderful - now I just have to capture the firstname & lastname in my database!

Smiley Cyndi

Logged

Smiley Learning from the best!
Pages: [1] 2
  Print  
 
Jump to:  

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