Results 1 to 12 of 12

Thread: [RESOLVED] login form (remember me?)

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Resolved [RESOLVED] login form (remember me?)

    i'm making a login form right now that has the option to remember the visitors details using cookies, now the problem is i have no clue how to get the data from the checkbox to see if its checked or not, how to do this?

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: login form (remember me?)

    PHP Code:
    <?php
      
    if(isset($_POST['box'])){
        echo 
    "the checkbox was checked";
      }else{
        echo 
    "the checkbox was not checked";
      }
    ?>
    <form method="post">
      check this --> <input type="checkbox" name="box" />
      <input type="submit" value="go" />
    </form>
    if you can't figure it out from looking at this example, run it on your server and try it out.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: login form (remember me?)

    no i can...

    this is what i did... i believe i made a mistake somewhere with the cookies...

    i'll look at this again tomorrow, getting kinda late.

  4. #4
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: login form (remember me?)

    Quote Originally Posted by Justa Lol View Post
    no i can...

    this is what i did... i believe i made a mistake somewhere with the cookies...
    Post your code so kows or someone can check your code and see if anything is wrong.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: login form (remember me?)

    no, i'll need to try it my self before i post any code...

    i'll update on this post.

    edit: i misplaced the variables when i set the cookies, so it set twice the username instead of username and password, but i got it under control now. thanks for the replies.
    Last edited by Justa Lol; Feb 10th, 2010 at 07:49 AM.

  6. #6
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: [RESOLVED] login form (remember me?)

    Don't set cookies with a username and password.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  7. #7
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: [RESOLVED] login form (remember me?)

    Apologies, I pressed send a little early. Putting a user name and password into a cookie is bad practice because anothe user could view the information.

    If you are storing a password, ensure you encrypt it / hash it. If you are hashing it make sure you prepend a append some salt.

    e.g. md5($password . $salt);
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  8. #8
    Hyperactive Member
    Join Date
    May 2008
    Location
    >> ( ҉ )
    Posts
    413

    Re: [RESOLVED] login form (remember me?)

    Why can't use cookies?
    PHP Code:
    setcookie("RememberUsername"$_POST['Username'], time()+86400
    Textfield text =
    PHP Code:
    <?php echo $_COOKIE['RememberUsername']; ?>
    I think that this would work too.

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: [RESOLVED] login form (remember me?)

    Quote Originally Posted by visualAd View Post
    Putting a user name and password into a cookie is bad practice because anothe user could view the information.
    could you explain me how another user would view the cookie?

  10. #10
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: [RESOLVED] login form (remember me?)

    There are several ways:

    1. The user leaves the computer unlocked and accessible to others. E.g. at a work place or having just used a public computer. Another individual can then view the cookies in plain text to find the password.
    2. After setting the cookie the password will be sent to the sever every time the user requests a page on the web site. This will make the password more vulnerable in the event of a man in the middle attack which can be easily orchestrated on a public computer or via a proxy server.
    3. In the event that your users PC or laptop is stolen or mislaid, the cookie files / cache could be read directly off the disk along with the site for which they are valid.


    You could argue that your site does not contain any sensitive information so it is not worth the extra effort to encrypt or protect the password. However, it is common place for the average Internet bod to use the same password for e-banking, porn sites and forums.

    You could also argue that you have a moral (possibly legal - dependant on what your site does and where it is host) duty to protect your users data.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: [RESOLVED] login form (remember me?)

    good point... i believe i need to update my cookies xD

    but this makes cookies never secure, because md5 can be decrypted, here.

  12. #12
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: [RESOLVED] login form (remember me?)

    uhh. you seem to be a little confused. no, it cannot be decrypted.

    just to be clear to anyone else reading -- I am not putting more trust in MD5 than I should. it has been shown to have flaws (and it has even been cracked), but MD5 is still a one-way hash. it cannot be decrypted.

    the website you linked to is simply storing a bunch of MD5 hashes that they have created themselves (and probably that have been submitted by some of their users using the "encrypt" form) in a database; when you look up a hash to be "decrypted" it just checks if it exists in the database. the following hash that I just created, for example, does not get "decrypted":
    Code:
    e27ff59e2284f263f624ad1ee2f0a691
    and if you think this makes MD5 insecure, then by using that logic you're also saying that every single hashing algorithm is insecure. if you have a database full of SHA256 hashes that represent simple dictionary words, common passwords, or strings submitted by users, then you might have an exhaustive list of potential hashes. it still doesn't let you decrypt anything, though. anyone who has a four letter password that exists in a dictionary is looking to get hacked, anyway.

    oh, and not to even mention salts! that totally defuncts that website you linked to.
    Last edited by kows; Feb 14th, 2010 at 01:51 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width