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


    Changing username to email

    Share
    avatar
    NLMAV

    Number of posts : 2
    Registration date : 2009-03-19

    Changing username to email

    Post  NLMAV on Thu Mar 19, 2009 4:10 pm

    Hey everybody!

    I've got the script running, great work! But I would like to let visitors register there normal name, and login with there email en password. So basicly I want 'email' to replace the function of 'username'. Any tips? Or do I just have to go line by line..?

    Best regards
    avatar
    Linchpin311

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

    Re: Changing username to email

    Post  Linchpin311 on Thu Mar 19, 2009 7:01 pm

    this is kinda coming off the top of my head, i didnt test it or anything (but it sounds like a good idea when i say it out loud!), but maybe in register.php remove the username part so you are just left with email and password. you should probably create a hidden field called user in register.php just to fool process.php and session.php

    then moving into session.php check out the function register. i would remove that whole /* Username error checking */ section cause we now have no username to check. then close to the bottom of that function you should see a line that says
    Code:
          /* No errors, add the new account to the */
          else{
            if($database->addNewUser($subuser, md5($subpass), $subemail)){
                if(EMAIL_WELCOME){
                  $mailer->sendWelcome($subuser,$subemail,$subpass);
                }
                return 0;  //New user added succesfully
            }else{
                return 2;  //Registration attempt failed
            }
          }
    i would edit that so it says
    Code:
          /* No errors, add the new account to the */
          else{
            if($database->addNewUser($subemail, md5($subpass), $subemail)){
                if(EMAIL_WELCOME){
                  $mailer->sendWelcome($subemail,$subemail,$subpass);
                }
                return 0;  //New user added succesfully
            }else{
                return 2;  //Registration attempt failed
            }
          }
    this will enter the users email address in the user and email fields of the database. it will also send out a properly formatted welcome email if you turned that feature on.

    now if i havent forgotten anything (which is totally possible, stop me if something doesnt sound right), you should be able to log with your username... which is also your email address!


    i will test this out later tonight or tomorrow, but in the mean time if you want to check it out let me know what this does for you.


    _________________
    in the end, the universe tends to unfold as it should...

    Also note that it is your responsibility to die() if necessary.
    avatar
    NLMAV

    Number of posts : 2
    Registration date : 2009-03-19

    Re: Changing username to email

    Post  NLMAV on Thu Mar 19, 2009 8:39 pm

    Hey Linchpin311,

    Thank you for your quick reply! I'm going to try your solution tomorrow! I keep you posted!

    Best regards
    avatar
    Dorji

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

    Remove following lines

    Post  Dorji on Tue Mar 31, 2009 12:14 am

    Remove from the userinfo.php

    !eregi("^([0-9a-z])+$", $req_user) ||



    where is it check the username whether it is Alphanumric or not. Since email ID conatins @ rate of Symbol it will give an error massage
    "username not registered"


    Thainks...

    Sponsored content

    Re: Changing username to email

    Post  Sponsored content


      Current date/time is Tue Sep 19, 2017 9:25 am