Decode mysql with php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hyper
    Confirmed User
    • Mar 2002
    • 5294

    #1

    Decode mysql with php

    i can encode this into a blob on my table

    but how the fuck do i decode it?

    $string = "insert into user (username, passwd, email, verify,prefs)values ('$username', ENCODE('$password', 'ba'), '$email','$code','$prefs')";
    $result = mysql_query($string);
  • psyko514
    See sig. Join Epic Cash.
    • Oct 2002
    • 22366

    #2
    why would you put that into a blob?

    Bad Girl Bucks
    - 50% Revshare through CCBill.
    Promote BrandyDDD, Pixie's Pillows, Action Allie and more!

    Phoenix Forum Pics | Webmaster Access Montreal pics
    email: psyko514(a)gmail.com | icq: 214-702-014

    Comment

    • hyper
      Confirmed User
      • Mar 2002
      • 5294

      #3
      the MySQL encode() function returns a binary string, which needs to be stored in a BLOB column type

      Comment

      • psyko514
        See sig. Join Epic Cash.
        • Oct 2002
        • 22366

        #4
        why use encode()? why not md5() or mcrypt()?

        anyways, you have to use the decode() function, but it needs the result of encode()

        DECODE (encrypted_password, pass_string)

        Bad Girl Bucks
        - 50% Revshare through CCBill.
        Promote BrandyDDD, Pixie's Pillows, Action Allie and more!

        Phoenix Forum Pics | Webmaster Access Montreal pics
        email: psyko514(a)gmail.com | icq: 214-702-014

        Comment

        • hyper
          Confirmed User
          • Mar 2002
          • 5294

          #5
          because i wanted to echo their current password and give them the option to change it, but i guess i will just give them the option to change it without displaying their current password

          Comment

          • Nysus
            Confirmed User
            • Aug 2001
            • 7817

            #6
            Use md5

            Cheers,
            Matt
            What name is pr0 / Untouched Markets using these days? Untouched Markets - pr0 - Refund My Money Now

            Someone owes me $2,000 because they didn't do any work that was paid for *pointing at pr0 / William / UntouchedMarkets*

            See http://www.gfy.com/showthread.php?p=16744521 and for more detailed see http://www.gfy.com/showthread.php?t=948645

            Comment

            • hyper
              Confirmed User
              • Mar 2002
              • 5294

              #7
              Originally posted by Nysus
              Use md5

              Cheers,
              Matt
              md5 cant be decoded ..
              just like the password() function

              goes in but cant come out

              Comment

              • psyko514
                See sig. Join Epic Cash.
                • Oct 2002
                • 22366

                #8
                I don't see why you'd show them their password and then offer to change it, unless the password is randomly generated?

                Bad Girl Bucks
                - 50% Revshare through CCBill.
                Promote BrandyDDD, Pixie's Pillows, Action Allie and more!

                Phoenix Forum Pics | Webmaster Access Montreal pics
                email: psyko514(a)gmail.com | icq: 214-702-014

                Comment

                • hyper
                  Confirmed User
                  • Mar 2002
                  • 5294

                  #9
                  well here is the deal

                  im writing the script so when they signup they choose their own password, but if they lose their password it generates one randomly.
                  So Then I wanted to Display the generated password and let them change it to something else ..
                  but i will just let them change it , by typing in a new password , then updating the table .. just like it did when they signed up

                  Comment

                  • SilverTab
                    Confirmed User
                    • Nov 2001
                    • 5060

                    #10
                    Yeah md5 is one-way encoding...why not use crypt() ?
                    mmm my sig was too big... no more cool animation
                    but hey still! need php? ICQ: 94586959

                    Comment

                    • Lane
                      Will code for food...
                      • Apr 2001
                      • 8496

                      #11
                      why use encoding if its gonna be decodable? it doesnt really provide security then.

                      Comment

                      • Lane
                        Will code for food...
                        • Apr 2001
                        • 8496

                        #12
                        Originally posted by hyper
                        well here is the deal

                        im writing the script so when they signup they choose their own password, but if they lose their password it generates one randomly.
                        So Then I wanted to Display the generated password and let them change it to something else ..
                        but i will just let them change it , by typing in a new password , then updating the table .. just like it did when they signed up
                        generate the new pass.. encrypt in with a one-way algorithm, put it in the database, and also email it to them (or display it on the page or whatever) .. there you have it, you have given them the new pass and its also one-way encrypted in the database.. they now need to enter the new pass to be able to change it to something else..

                        thats the common way of doing it

                        ...or during the reset process, you can have them choose what pass to reset it to..

                        Comment

                        • hyper
                          Confirmed User
                          • Mar 2002
                          • 5294

                          #13
                          Originally posted by Lane


                          generate the new pass.. encrypt in with a one-way algorithm, put it in the database, and also email it to them (or display it on the page or whatever) .. there you have it, you have given them the new pass and its also one-way encrypted in the database.. they now need to enter the new pass to be able to change it to something else..

                          thats the common way of doing it

                          ...or during the reset process, you can have them choose what pass to reset it to..
                          thanx lane i will do that.. just allow them to change it o a familiar password once they log in

                          Comment

                          Working...