Encrypting PHP code

Discussion in 'PHP' started by blueparukia, Mar 5, 2008.

  1. #1
    Basically I want to connect to a remote database, and for obvious reasons I don't want users seeing my db name and password.

    I know scripts such as VBSEO do it. So how to?
     
    blueparukia, Mar 5, 2008 IP
  2. DomainCo.US

    DomainCo.US Well-Known Member

    Messages:
    2,124
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    100
    #2
    you can try ioncube...
     
    DomainCo.US, Mar 5, 2008 IP
  3. blueparukia

    blueparukia Well-Known Member

    Messages:
    1,564
    Likes Received:
    71
    Best Answers:
    7
    Trophy Points:
    160
    #3
    Do you need to run the ioncube scripts on your server, or is it a one type encrypt/decrypt kinda thing?

    EDIT: Looked into it, and I ain't paying to encode one line of PHP for a non profit script.
     
    blueparukia, Mar 5, 2008 IP
  4. decepti0n

    decepti0n Peon

    Messages:
    519
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Why would they need to connect to the database?

    An alternate way to do it would be to use something they know (such as a user/pass when they sign up with you). Send that back to your server, and on the page they request, output whatever you need from the database (etc).

    Or even use something simple like
    file_get_contents('http://you.com/request/username/password');
    PHP:
    (or even go further and instead of using a password, use some sort of key for their account. There'd be a lot of security issues allowing other people access your db.
     
    decepti0n, Mar 5, 2008 IP
  5. DomainCo.US

    DomainCo.US Well-Known Member

    Messages:
    2,124
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    100
    #5
    ioncube have free service...
     
    DomainCo.US, Mar 5, 2008 IP
  6. bpasc95

    bpasc95 Active Member

    Messages:
    196
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    70
    #6
    Are you going to be reading and writing from the database, or just reading data?

    If you are just reading data, you could create a MySQL user that only has read access to your DB. That way the user and corresponding data would be isolated to your client.

    -Bing
     
    bpasc95, Mar 5, 2008 IP
  7. blueparukia

    blueparukia Well-Known Member

    Messages:
    1,564
    Likes Received:
    71
    Best Answers:
    7
    Trophy Points:
    160
    #7
    bpasc, nice and simple does the trick - thanks :)

    BP
     
    blueparukia, Mar 5, 2008 IP
  8. ioncube

    ioncube Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Keep in mind that PHP is opensource, as are all of the libraries that is uses, and therefore insecure by design. Granted this is not quite as easy as seeing the details staring you in the face from unprotected code, but to expose the username and password for your database someone merely needs to intercept the database connection function in the MySQL library. This is a trivial one line edit to the PHP core, and a rebuild of PHP and a run of the scripts will reveal the information. The same goes for any standard library functions in PHP.

    Because of the potential risk you should assume that someone with malicious intent does have the details, and design your system accordingly so that it either doesn't matter, or that any potential damage that could be caused is minimal and non-catastrophic as you are otherwise sitting on a time bomb.
     
    ioncube, Mar 22, 2008 IP
  9. LimeBlast

    LimeBlast Peon

    Messages:
    81
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #9
    PHP code is NERVER made public, when a user acces the page php generates only the layout in html and the DB connections are not send to the users computer! Just dont do echo $db_name . $db_pass and you will be fine!
     
    LimeBlast, Mar 23, 2008 IP
  10. blueparukia

    blueparukia Well-Known Member

    Messages:
    1,564
    Likes Received:
    71
    Best Answers:
    7
    Trophy Points:
    160
    #10
    Yes, but if I am providing the script for download.....
     
    blueparukia, Mar 23, 2008 IP
  11. Freewebspace

    Freewebspace Notable Member

    Messages:
    6,213
    Likes Received:
    370
    Best Answers:
    0
    Trophy Points:
    275
    #11
    I always include my database username and passwords in my custom made php script,whether any one will be able to see it?(But php code can't be seen by a user)
     
    Freewebspace, Mar 24, 2008 IP