Hey guys, I have a little problem. I'm making a new website using PHP and MySQL. On my page, I don't want the login information to connect to the MySQL database viewable when visitors view the page source. Here is my exact set up, only the names and everything else is renamed to random joke stuff: Code: <HTML> <HEAD> <TITLE> Our List of Jokes </TITLE> <HEAD> <BODY> <?php // Connect to the database server $dbcnx = @mysql_connect("localhost", "root", "mypasswd"); if (!$dbcnx) { echo( " Unable to connect to the " . "database server at this time.</P>" ); exit(); } // Select the jokes database if (! @mysql_select_db("jokes") ) { echo( " Unable to locate the joke " . "database at this time.</P>" ); exit(); } ?> Here are all the jokes in our database: </P> <BLOCKQUOTE> <?php // Request the text of all the jokes $result = mysql_query( "SELECT JokeText FROM Jokes"); if (!$result) { echo(" Error performing query: " . mysql_error() . "</P>"); exit(); } // Display the text of each joke in a paragraph while ( $row = mysql_fetch_array($result) ) { echo(" " . $row["JokeText"] . "</P>"); } ?> </BLOCKQUOTE> </BODY> </HTML> As you can see, someone views the page source and has the location, user, and password for the MySQL database written right there for them, how can I change or hide this? Thanks in advance!
Just to comment on this (Even if you figured it out): I don't see why it would be. PHP is processed server-side, none of that PHP on the page would be sent to the browser, and would not be in the source on a loaded webpage..
No problem If you need any other PHP code help feel free to ask me My job is coding PHP portion websites atm.