473,804 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HOw to prevent simple View source to retrieve password

Can anyone tell me how i can prevent that users can see my connection string
to mysql database?

Using my browser i could easely use the function: view source.....show ing
the html/php code.

IF the file includes the connection string than anyone could see my database
name and password.....

How can i prevent this??

Please help.
Mark
Mar 8 '06 #1
4 4886
Mark@home wrote:
Can anyone tell me how i can prevent that users can see my connection string
to mysql database?

Using my browser i could easely use the function: view source.....show ing
the html/php code.
What?! If you are using the browser's view source command to see the PHP
code, then your web server is not set up properly. PHP code should be
interpreted on the server side, and hidden from the client at all times.
IF the file includes the connection string than anyone could see my database
name and password.....

How can i prevent this??


Be sure that you are storing that file outside your document root for
the site. If you can't do that, then be sure that you have the file
named in a way where the web server will parse it as a PHP type (ie.
db-details.php)

There are many options, these are just the easiest ones.
Mar 8 '06 #2
Mark@home wrote:
Can anyone tell me how i can prevent that users can see my connection string
to mysql database?

Using my browser i could easely use the function: view source.....show ing
the html/php code.

IF the file includes the connection string than anyone could see my database
name and password.....

How can i prevent this??

Please help.
Mark


If view source shows any PHP code, then there's a configuration problem
with your server. When a user visits one of your PHP pages, the server
should execute the PHP and send the generated HTML to the client, so the
client can never see the PHP code at all.

Are you storing the password in a PHP file with an .inc extension? If
so, simply rename your .inc files to .php so the client can never see
your PHP code.
Mar 8 '06 #3
Your php code isn't visible to the html end user. If it is, the code isn't
inside php tags

"Mark@home" <do******@home. nl> a écrit dans le message de news:
61************* **************@ news1.tudelft.n l...
Can anyone tell me how i can prevent that users can see my connection
string
to mysql database?

Using my browser i could easely use the function: view source.....show ing
the html/php code.

IF the file includes the connection string than anyone could see my
database
name and password.....

How can i prevent this??

Please help.
Mark


Mar 8 '06 #4
On Wed, 08 Mar 2006 17:37:41 +0100, Bob Bedford wrote:
"Mark@home" <do******@home. nl> a écrit dans le message de news:
61************* **************@ news1.tudelft.n l...
Can anyone tell me how i can prevent that users can see my connection
string
to mysql database?

Using my browser i could easely use the function: view
source.....show ing the html/php code.
Your php code isn't visible to the html end user. If it is, the code
isn't inside php tags


[top posting fixed]

It is not the <?php...?> marks that do it. Most web servers decide (a)
what type of data is in a file, and (b) what to do with it (PHP processing
in only one option here) based on the file's name. This can include the
directory part, the file extension or whatever.

For example, my local server treats everything in /cgi-bin or anything
ending .cgi as a program to execute and everything ending .php as
requiring PHP processing. The rules are usually set by the system
administrator and *may* be alterable by users on a per-directory basis.

--
Ben.
Mar 8 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
7906
by: john brown | last post by:
I'm using the following code to retrieve a web page. It seems that I'm able to pass the username and password to the web page, but it does nothing. Looking at the source code of the web page it asks for an "OnClick", which I figure refers to the "enter" button, (there's also a reset button after the "enter" button.) I do I go about send the information and finalizing it with the "OnClick" or "enter" button in the page. Here's the...
14
5379
by: Ludwig77 | last post by:
I read that there are some tags that can be entered in a web page's meta tags in order to prevent web bot searching and indexing of the web page for search engines. What is the tagging that I would need to use?
1
1990
by: Lorenzo | last post by:
Hi i'm writing some code that retrieve the html source code of an asp page. The problem is that if i go directly to this page the browser redirect me to a login page where are two textbox in a html form. <form action="/admin/login.asp?aktion=login" method="POST" name="login"> <table border="2" align="center"> <tr> <td> <b>Username:</b>
3
2386
by: Elliot Rodriguez | last post by:
Hi: I am writing a WinForm app that contains a DataGrid control and a StatusBar control. My goal is to update the status bar using events from a separate class, as well as some other simple things. The method I am writing queries a large dataset. As part of my feedback to the user, I am updating the status bar when the connection is made and the dataset is actually retrieved. The dataset retrieval method I have placed on a separate...
3
3237
by: Ryu | last post by:
Hi, May I know how to prevent Javascript from being dlownloaded when the user saves at "View Source"? I have added "js" at IIS's application configuration's mapping and i have added the following at web.config: But the javascript is still being downloaded. Please help <httpHandlers> <add verb="*" path="../ig_common.js" type="System.Web.HttpForbiddenHandler"/>
5
4138
by: Diane Truyens | last post by:
Hi, I have a form with textboxes, a search button and a gridview. The textboxes are filled with default values so that the gridview should return all rows but not before the user has had the chance to change some of the textboxes and has clicked the search button. How can I avoid the gridview displaying all rows before the search button was clicked? Any Ideas? Thanks Diane
3
5649
by: Phillip Vong | last post by:
I'm new and trying to learn. This is in VB.NET 2. I have a simple page with one Textbox1, one Label1 and one Button1. The on_click Button one goes and get's a simple data from the SQL db with the parameter from Textbox1. What do I add to this code below to say that Label1 equals the result of my Select statement? CroftUser being the result. Thanks! Newbie ------------------------------- Protected Sub Button1_Click(ByVal sender As...
0
2404
by: Jacob Donajkowski | last post by:
Once the user logs in I want to have the users switch from the Roster View to the Profile View and enter their profile infomation and save it. Then the next time they login and go to the Profile View I want the form populated from there profile on the sql server. The code to save the profile works fine. But when the user logs back in they data doesn't load back to the form. The multiview is located inside the LoginView's Logged-In View ....
8
5133
by: Mark Reed | last post by:
I have an Apache 2.2.8 server all set up with mod_authnz_ldap to authenticate via LDAP user/password pairs. It's all SSL to the web server, SSL between the web server and LDAP, so it's pretty secure even though it's Basic auth. By the time the PHP script runs, the user has already authenticated and the PHP code can trust the value of PHP_AUTH_USER. So, how can I NOT have PHP_AUTH_PW set? I'd kinda rather not have people's passwords...
0
10603
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10353
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10099
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7643
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4314
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3836
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3003
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.