1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Encryption - decryption of server data in php, mysql

Discussion in 'Databases' started by Jaden Alvin, Sep 9, 2013.

  1. #1
    Hello Guys!

    Need help with php mysql database, i want to encrypt the data store in the database but till now i'm just able to encrypt the user id and pwd, so help me with this "I want to encrypt and decrypt the data stored in database". And guide me if i'm trying something wrong.

    Thanks
     
    Jaden Alvin, Sep 9, 2013 IP
  2. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #2
    you have encrypted userid? this is a bit confusing.
    please elaborate. what are you trying to do?
     
    bartolay13, Sep 10, 2013 IP
    Nigel Lew likes this.
  3. Nigel Lew

    Nigel Lew Notable Member

    Messages:
    4,642
    Likes Received:
    405
    Best Answers:
    21
    Trophy Points:
    295
    #3
    Exactly, first the NSA can already decrypt it lol... and 2, off the top of my head you cant print the output from anything without said decryption layer, which in your case, will render this convo useless.

    You can not decrypt and serve stuff on the fly in any language from JS to C# without it being entirely not secure.

    Nigel
     
    Nigel Lew, Sep 10, 2013 IP
  4. Jaden Alvin

    Jaden Alvin Active Member

    Messages:
    89
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    78
    #4
    <?php
    function encrypt($string)
        {
        $string = str_rot13($string);
        $string = strtolower($string);
        $string = str_replace('a','1',$string);
        $string = str_replace('b','2',$string);
        $string = str_replace('c','3',$string);
        $string = str_replace('d','4',$string);
        $string = str_replace('e','5',$string);
        $string = str_replace('f','6',$string);
        $string = str_replace('g','7',$string);
        $string = str_replace('h','8',$string);
        $string = str_replace('i','9',$string);
        $string = str_replace('j','0',$string);
        $string = md5($string);
        $string = str_rot13($string);
        $string = str_replace('k','1',$string);
        $string = str_replace('l','2',$string);
        $string = str_replace('m','3',$string);
        $string = str_replace('n','4',$string);
        $string = str_replace('o','5',$string);
        $string = str_replace('p','6',$string);
        $string = str_replace('q','7',$string);
        $string = str_replace('r','8',$string);
        $string = str_replace('s','9',$string);
        $string = str_replace('t','0',$string);
        $string = md5($string);
        $string = str_rot13($string);
        $string = str_replace('u','1',$string);
        $string = str_replace('v','2',$string);
        $string = str_replace('w','3',$string);
        $string = str_replace('x','4',$string);
        $string = str_replace('y','5',$string);
        $string = str_replace('z','6',$string);
        $string = md5($string);
        $string = str_rot13($string);
        $string = str_replace('a','>',$string);
        $string = str_replace('b','<',$string);
        $string = str_replace('c','@',$string);
        $string = str_replace('m','$',$string);
        $string = str_replace('j',';',$string);
        $string = str_replace('h','[',$string);
        $string = str_replace('l',']',$string);
        $string = md5($string);
        $string = str_rot13($string);
        $string = substr($string,3,15);
        return $string;
        }
        echo encrypt('johncena');
    
    ?>
    PHP:
    The above code is for encryption, which i'm following. But the output of this is in Encrypted form, i want decryption code to decrypt the data for end user.
     
    Jaden Alvin, Sep 10, 2013 IP