|
-
Aug 11th, 2009, 10:37 PM
#1
Thread Starter
Lively Member
Hiding Connection String, do I just change file permissions?
Hi,
I'm planning on using a script like this to display a table from my database.
What I want to know is do I simply change the permissions so the file is executable only? I don't want them to be able to read the code of the php file, but they must be able to read what it outputs.
If it is the permission settings what permissions should I use in this case?
thx all help is appreciated
Code:
<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_db", $con);
$result = mysql_query("SELECT * FROM Persons");
echo "<table border='1'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['FirstName'] . "</td>";
echo "<td>" . $row['LastName'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
-
Aug 12th, 2009, 09:11 AM
#2
Re: Hiding Connection String, do I just change file permissions?
If I'm correctly understanding what you want, then no special permissions are needed. When viewed in a browser, users will only be able to see what PHP has output, nothing else. If they use their browser's "view source" feature, all they'll see is the HTML that makes up your table.
-
Aug 12th, 2009, 04:27 PM
#3
Re: Hiding Connection String, do I just change file permissions?
I believe that you only have to change the permission in the database if a user going to have access to certain functions such as add, delete, etc inside the database.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Aug 12th, 2009, 04:47 PM
#4
Re: Hiding Connection String, do I just change file permissions?
As SambaNeko said, you dont have to worry about the world seeing your code. It is server side code, so it is all processed on the server, then the HTML is set to the browser.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|