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 MySQL 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:
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!
Here is my exact set up, only the names and everything else is renamed to random joke stuff:
PHP:
<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( "<P>Unable to connect to the " .
"database server at this time.</P>" );
exit();
}
// Select the jokes database
if (! @mysql_select_db("jokes") ) {
echo( "<P>Unable to locate the joke " .
"database at this time.</P>" );
exit();
}
?>
<P> 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("<P>Error performing query: " .
mysql_error() . "</P>");
exit();
}
// Display the text of each joke in a paragraph
while ( $row = mysql_fetch_array($result) ) {
echo("<P>" . $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!