Zubrag.com
September 16, 2019, 06:46:35 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]
  Print  
Author Topic: Problem Updating Database (new form fields in signup)  (Read 4644 times)
CyndiSmith
Goddess of Reverse Engineering
Newbie
*
Posts: 4



« on: May 10, 2008, 08:17:24 PM »

     (note, re-posted from http://www.zubrag.com/forum/index.php/topic,399.msg1717.html#msg1717)

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 managers 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!

 Cyndi

Logged

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

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