PHP login form

Results 1 to 13 of 13
  1. #1
    The baddest. Max98 is offline
    MemberRank
    Nov 2011 Join Date
    284Posts

    PHP login form

    Hey guys,
    i've been working on mYsql on a project and i had an idea, why not use my mYsql login code to mSsql so it fit flyff?

    The php's are fully explained for php newbe.
    This took me a little time to do.

    Updated:
    Security, AntiSQL injection.
    Auth.

    Download


    Have fun using it!
    Last edited by Max98; 07-07-12 at 12:31 AM.


  2. #2
    Trust your senses Gravious is offline
    MemberRank
    Sep 2009 Join Date
    NetherlandsLocation
    713Posts

    Re: PHP login form

    Now make it safe, clean and fix the indent. You could also fit this in one file or use a class.

  3. #3
    The baddest. Max98 is offline
    MemberRank
    Nov 2011 Join Date
    284Posts

    Re: PHP login form

    Quote Originally Posted by Gravious View Post
    Now make it safe, clean and fix the indent. You could also fit this in one file or use a class.
    I will do the class and one file later, now i've done the safe part.
    Updated.

  4. #4
    Not working on UnitedFlyf Mootie is offline
    MemberRank
    Apr 2009 Join Date
    1,589Posts

    Re: PHP login form

    Still injectable if I'm reading the preg string right. You need to filter ', or you can just do this:


    PHP Code:
    public function Clean($var)
    {
        
    $unpacked unpack('H*hex'$var);
        
    $hex '0x' $unpacked['hex']; 
        if(
    $hex == "0x")
            
    $hex "0x00"// null to avoid syntax error
        
    return $hex;
    }

    // optional alphanumeric check:
    if(preg_match("/[^a-z0-9]/"""$_POST['username']) > 0)
    {
    // notify user that username must be alphanumeric
    exit;
    }

    $usernameClean(preg_replace("/[^a-z0-9]/"""$_POST['username']));
    $encryptedpw Clean(md5($hash $_POST['password']));

    $get01 mssql_query("SELECT * FROM [ACCOUNT_TBL] WHERE account=$username");
    $row01 mssql_fetch_assoc($get01);

    $get02 mssql_query("SELECT * FROM [ACCOUNT_TBL_DETAIL] WHERE account=$username");
    $row02 mssql_fetch_assoc($get02); 

  5. #5
    The baddest. Max98 is offline
    MemberRank
    Nov 2011 Join Date
    284Posts

    Re: PHP login form

    Quote Originally Posted by mootie View Post
    Still injectable if I'm reading the preg string right. You need to filter ', or you can just do this:


    PHP Code:
    public function Clean($var)
    {
        
    $unpacked unpack('H*hex'$var);
        
    $hex '0x' $unpacked['hex']; 
        if(
    $hex == "0x")
            
    $hex "0x00"// null to avoid syntax error
        
    return $hex;
    }

    // optional alphanumeric check:
    if(preg_match("/[^a-z0-9]/"""$_POST['username']) > 0)
    {
    // notify user that username must be alphanumeric
    exit;
    }

    $usernameClean(preg_replace("/[^a-z0-9]/"""$_POST['username']));
    $encryptedpw Clean(md5($hash $_POST['password']));

    $get01 mssql_query("SELECT * FROM [ACCOUNT_TBL] WHERE account=$username");
    $row01 mssql_fetch_assoc($get01);

    $get02 mssql_query("SELECT * FROM [ACCOUNT_TBL_DETAIL] WHERE account=$username");
    $row02 mssql_fetch_assoc($get02); 
    Your code just return me Hex codes..
    Code:
    0x74657374
    0x6d61783938

  6. #6
    Valued Member Objected is offline
    MemberRank
    Jun 2012 Join Date
    115Posts

    Re: PHP login form

    Good job releasing something that everyone already has.

  7. #7
    Not working on UnitedFlyf Mootie is offline
    MemberRank
    Apr 2009 Join Date
    1,589Posts

    Re: PHP login form

    Quote Originally Posted by Max98 View Post
    Your code just return me Hex codes..
    Code:
    0x74657374
    0x6d61783938
    Don't single quote the variable and it'll work fine.

  8. #8
    Flyff Developer ShadowDragon is offline
    MemberRank
    Apr 2009 Join Date
    1,916Posts

    Re: PHP login form

    Quote Originally Posted by Max98 View Post
    Your code just return me Hex codes..
    Code:
    0x74657374
    0x6d61783938
    I had this problem before as well, but it was because I didn't understand how MSSQL works with hex strings. If you input something to an MSSQL query in hex form, WITHOUT quotes or single quotes around it, it will convert the hex to whatever data type corresponds to the field it's being placed in. Just remove the quotes around it, and it will work.

  9. #9
    The baddest. Max98 is offline
    MemberRank
    Nov 2011 Join Date
    284Posts

    Re: PHP login form

    Quote Originally Posted by Objected View Post
    Good job releasing something that everyone already has.
    At last, i'm doing sumthing, not like you, never realsed something. (idk if you did but anyway)

  10. #10
    Trust your senses Gravious is offline
    MemberRank
    Sep 2009 Join Date
    NetherlandsLocation
    713Posts
    Quote Originally Posted by Max98 View Post
    At last, i'm doing sumthing, not like you, never realsed something. (idk if you did but anyway)
    Let's ignore your English right here.
    Who cares about what someone releases? I only made a guide about PartyDungeon a year ago and posted that; my lack of releases does not conclude that I am not doing something.

    Also, he does do a lot of PHP coding, not for everyone to leach, unlike your slightly modified Resource Files and Source.

  11. #11
    Valued Member Objected is offline
    MemberRank
    Jun 2012 Join Date
    115Posts

    Re: PHP login form

    Quote Originally Posted by Max98 View Post
    At last, i'm doing sumthing, not like you, never realsed something. (idk if you did but anyway)
    Cute.

    Comparison v1
    Rankings Script (Old)
    Register GUI Beta
    User Control Panel v1
    GM Check Script

  12. #12
    The baddest. Max98 is offline
    MemberRank
    Nov 2011 Join Date
    284Posts

    Re: PHP login form

    @Gravious & Ojected
    Meh.
    My English?
    I will make it good when i want to.

  13. #13
    Member zirkzen is offline
    MemberRank
    Jun 2009 Join Date
    50Posts

    Re: PHP login form

    It's pretty basic, and from here on you could add more features after login, if you plan to work on it more. I did something similar with a login form, securing it after 5 login attempts with an ip ban, just for practice, that's how you get better, practice.
    Last edited by zirkzen; 14-07-12 at 11:54 AM.



Advertisement