PHP Login System with Admin Features

Would you like to react to this message? Create an account in a few clicks or log in to continue.
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


3 posters

    Adding date of birth field

    Dorji
    Dorji


    Number of posts : 25
    Registration date : 2009-03-30

    Adding date of birth field Empty Adding date of birth field

    Post  Dorji Mon Mar 30, 2009 11:46 pm

    Help me with date of birth field....
    I have created dob field in database. Since there are mysql takes date formate in yyyy-mm-dd format. and the dob filled by the user from form is of 3 (which is drop down list. i am have having trouble with combining these three variable from the form.

    PLEASE HELP ME.
    Linchpin311
    Linchpin311


    Number of posts : 220
    Age : 38
    Localisation : Long Island
    Registration date : 2007-05-14

    Adding date of birth field Empty Re: Adding date of birth field

    Post  Linchpin311 Tue Mar 31, 2009 1:41 am

    why not just check their values in session.php and if they check out, format them there. you can put them in a variable once they are formatted to your liking then you can pass that variable to database.php and insert it into the database.
    Dorji
    Dorji


    Number of posts : 25
    Registration date : 2009-03-30

    Adding date of birth field Empty Re: Adding date of birth field

    Post  Dorji Wed Apr 01, 2009 9:08 am

    hi here is the code but is doesnt seem to work help!!
    From option in update user
    Code:
    <select name="date">
    <?
    for($index=1; $index <= 31; $index++)
    echo "<option value='$index'>$index</option>";
    ?>
    </select>

    <!-- generate a list of years to select -->

    <select name="year">
    <?
    for($index=1995; $index >=1900 ; $index--)
    echo "<option value='$index'>$index</option>";
    ?>
    </select>
    then in process.php under function procEditAccount()
    i have added
    Code:
    $retval = $session->editAccount($_POST['curpass'], $_POST['newpass'], $_POST['email'],$_POST['date'],$_POST['month'],$_POST['year']);
    then in session.php under function editAccount() i broght those values
    and i am struck in it while combining those three values into one
    when i combine without a function during it works well. but with function the value is not entering
    thanks
    Linchpin311
    Linchpin311


    Number of posts : 220
    Age : 38
    Localisation : Long Island
    Registration date : 2007-05-14

    Adding date of birth field Empty Re: Adding date of birth field

    Post  Linchpin311 Wed Apr 01, 2009 8:26 pm

    i dont have nearly enough information about what you are trying to do or what you say isnt working to adequately advise you on a course of action...

    i understand you wish to give your users the ability to edit their date of birth via the procEditAccount function but i really need to know exactly what isnt working for you in order to find a way to fix it. without seeing the full picture, i can say that what you posted looks good but without seeing your edits to session.php (and possibly to database.php) i cant tell whats going wrong.

    why dont you post some code from these files and maybe some of the error messages php is giving you, then we can take it from there.
    Dorji
    Dorji


    Number of posts : 25
    Registration date : 2009-03-30

    Adding date of birth field Empty Re: Adding date of birth field

    Post  Dorji Sat May 02, 2009 10:06 pm

    well finally i got my code work i am post for you all
    step 1
    Make a column in users table
    Code:
    ALTER TABLE `users` ADD `dob` DATE NOT NULL ;

    add the code below to the register.php
    Code:
    <tr>
                         <td width="110"><p><b>Date of Birth:</b></p></td>
                            <td><p>
    <select name="month"><option value="0" Selected>Select</option>
    <option value="1">January</option>
    <option value="2">February</option>
    <option value="3">March</option>
    <option value="4">April</option>
    <option value="5">May</option>
    <option value="6">June</option>
    <option value="7">July</option>
    <option value="8">August</option>
    <option value="9">September</option>
    <option value="10">October</option>
    <option value="11">November</option>
    <option value="12">December</option>
    </select>

    <!-- generate a list of available days in a month, 1 to 31 -->

    <select name="date">
    <option value="0" selected>--</option>
    <?
    for($index=1; $index <= 31; $index++)
    echo "<option value='$index'>$index</option>";
    ?>
    </select>

    <!-- generate a list of years to select -->

    <select name="year">
    <option value="0" selected>----</option>
    <?
    for($index=1995; $index >=1900 ; $index--)
    echo "<option value='$index'>$index</option>";
    ?>
    </select></p>
    </td><td><p> <?echo $form->error("date"); ?><p></td>

                         </tr>


    Now in process.php under proregister() function add.
    Code:

    $retval = $session->register($_POST['user'], $_POST['pass'], $_POST['email'],$_POST['sname'],$_POST['year'],$_POST['month'],$_POST['date']);
         
    three field date,month and year.


    Now in session.php
    add following line under register() function.

    Code:
    function register($subuser, $subpass, $subemail,$year,$month,$date){
    ...
    some code
    ..
     $field="month";
        if($month == 0 || $date== 0 || $year==0){
            $form->setError($field, "* Please Select Birth Date");
            }
    /*Add above line above */
    /* Email error checking */
    ...
    Some code
    ..

    /*add this  line as shown*/

          /* Errors exist, have user correct them */
          if($form->num_errors > 0){
            return 1;  //Errors with form
          }
          /* No errors, add the new account to the */
        else{ $date2=$year.'-'.$month.'-'.$date;

            if($database->addNewUser(md5($subemail), md5($subpass), $subemail,$date2)){

    /*some code*/


    Now in database.php add the following lines in addNewUser().
    Code:

      function addNewUser($username, $password, $email,$date){
    $q = "INSERT INTO ".TBL_USERS." VALUES ('$username','$sname', '$password', '0', $ulevel, '$email','$date', $time)";


    Thats all
    michaelsam
    michaelsam


    Number of posts : 4
    Registration date : 2009-02-26

    Adding date of birth field Empty don't works for me

    Post  michaelsam Fri Aug 28, 2009 3:17 pm

    i tried many things, but this script don't works for me
    every time i get a error with the date (day) at registration
    my order is day month year at registration
    when i delete the day i get an error with the month

    so what is wrong can you help me please ?
    michaelsam
    michaelsam


    Number of posts : 4
    Registration date : 2009-02-26

    Adding date of birth field Empty Re: Adding date of birth field

    Post  michaelsam Sat Aug 29, 2009 8:22 am

    i got this workin now too
    the same solution as with the other
    the order of asking for in process.php and session.php

    [code]..,$subdate, $submonth, $subyear, $subgender, $subaccept_terms, $subnumLogins){[/code}]

    Sponsored content


    Adding date of birth field Empty Re: Adding date of birth field

    Post  Sponsored content


      Current date/time is Fri May 17, 2024 5:44 am