My Password is Shown?!

Discussion in 'MySQL' started by AhmedHan, Apr 28, 2006.

  1. AhmedHan

    AhmedHan New Member

    Joined:
    Oct 11, 2005
    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    http://www.stirve.com
    I am new at web programming. I registered to a MySQL server. I have to use a code in my PHP file like this :
    Code:
    mysql_connect("DATABASEIP", "USERNAME", "PASSWORD") or die("Can't connect to database.");
    But this method doesn't seem to be safe, because anybody can download this PHP file using a download manager program.

    Is there any way to connect my database hiding my password?
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Not actually. No one can download the PHP file unless he knows your FTP details or you allow anonymous FTP connections. So you should not allow the FTP and it will be safe as through the browser they try to fetch and it will be the final output you flushed through the HTML and nothing more.
     
  3. AhmedHan

    AhmedHan New Member

    Joined:
    Oct 11, 2005
    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    http://www.stirve.com
    Just a minute ago I tried what you said and I realized that there was no PHP code in the downloaded file.
    What is the reason we can't download a PHP file with all its contents? Is it impossible?
    And unfortunately, my web site is University supported and it allows anonymous FTP connections.
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    The actual reason is your when we make a request fro a PHP file through the explorer it send the request to the webserver for the same and as the request goes to your uni server it parses the php file and sends the output HTML as the output. You can ask for any file extension (HTML, JSP, ASP) to be parsed as PHP.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice