PHP Login System with Admin Features

This forum was created to talk about the PHP Login System with admin features created by jpmaster77 on evolt's website

    Adding new fields Part 2


    Number of posts : 63
    Registration date : 2007-05-13

    Adding new fields Part 2

    Post  Fred-Eric on Wed Feb 25, 2009 4:06 pm

    This post is the step 2 for adding new input in form register.

    Then after having added new fields into the login system, it's time to view those change when we are logged:

    1- open userinfo.php for editing, modified the form to show new input field creation

    /* Firstname */
    echo "<b>Firstname:</b> ".$req_user_info['firstname']."<br>";

    2- open useredit.php for editing, modified the form to show new input field creation

    <td><input type="text" name="firstname" maxlength="32" value="
    if($form->value("firstname") == ""){
      echo $session->userinfo['firstname'];
      echo $form->value("firstname");
    <td><? echo $form->error("firstname"); ?></td>

    3- open process.php for editing, add arguments for $session->editaccount class function.

        * procEditAccount - Attempts to edit the user's account
        * information, including the password, which must be verified
        * before a change is made.
      function procEditAccount(){
          global $session, $form;
          /* Account edit attempt */
          $retval = $session->editAccount($_POST['curpass'], $_POST['newpass'], $_POST['email'],  $_POST['firstname']);

          /* Account edit successful */
            $_SESSION['useredit'] = true;
            header("Location: ".$session->referrer);
          /* Error found with form */
            $_SESSION['value_array'] = $_POST;
            $_SESSION['error_array'] = $form->getErrorArray();
            header("Location: ".$session->referrer);

    4- open session.php for editing, add arguments to the function

        * editAccount - Attempts to edit the user's account information
        * including the password, which it first makes sure is correct
        * if entered, if so and the new password is in the right
        * format, the change is made. All other fields are changed
        * automatically.
      function editAccount($subcurpass, $subnewpass, $subemail, $subfirstname){


    4.1- Validate errors

    /*Firstname error checking */
     $field = "firstname";     
    if(!$subfirstname || strlen($subfirstname = trim($subfirstname)) == 0){       
      $form->setError($field, "* firstname not entered");     
      $subfirstname = stripslashes($subfirstname);

    4.2- Update the DataBase with the new informations

    /* Change Email */

    that's it...

    video tutorial

    Number of posts : 25
    Registration date : 2009-10-11

    Re: Adding new fields Part 2

    Post  mattastic on Mon Oct 12, 2009 10:45 am

    i had a slight problem figuring everything out but i got it to work, great tutorial

      Current date/time is Sat Feb 16, 2019 9:29 pm