473,399 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Restrict access to php script

2
Hi All,

I have a simple php script:

[PHP]
Header("content-type: application/x-javascript");
$serverIP=$_SERVER['REMOTE_ADDR'];
echo "document.write(\"Your IP address has been <font color='red'>tracked and logged:</font> <b>" . $serverIP . "</b>\")";
[PHP]

That is called via javascript, "script type="text/javascript" src="ip.php"></script>", in order to discourage folder-peekers on my site.

But the following text:

document.write("Your IP address has been <font color='red'>tracked and logged:</font> <b>xxx.xxx.xxx.xx</b>")

...shows when you call the script through a browser (Note, script does NOT actually log the IP address).

I've tried changing the file permissions, but the only thing that happens is the script stops working.

Question is: What code can I add to prevent this part of the script from being revealed?

If there is something, I need the actual code.

Thanks much,

Newbie Steph
Dec 1 '06 #1
2 1713
ronverdonk
4,258 Expert 4TB
I am not sure what part of the code you are talking about, but when it is HTML or JavaScript or any other client-side code, you cannot reveal it. Not even after trying to block right-clicks. "What runs on my machine is mine"

Ronald :cool:
Dec 1 '06 #2
mkf
2
I am not sure what part of the code you are talking about, but when it is HTML or JavaScript or any other client-side code, you cannot reveal it. Not even after trying to block right-clicks. "What runs on my machine is mine"

Ronald :cool:
Hi Ronald,

If you load the address:

www.mydomain.com/PersonTryingToAccessThisFolder/ip.php

...into a browser, the page that comes up says:

"document.write("Your IP address has been <font color='red'>tracked and logged:</font> <b>xxx.xxx.xxx.xx</b>")"

Which is the "document.write" portion of my PHP script, and I do not want people to see this.

I wish to add some code so that this "document.write" portion of my "ip.php" script (shown above) does not show in the browser window.

My question re-stated:

What code can I add to prevent the doc.write portion of the script from showing in the browser window?
Dec 2 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: James | last post by:
Hi, I am running a virtual hosting server. The configuration of server is as follows: Windows 2000 IIS 5.0 All the virtual hosting sites are running as seperate user ie for the site...
3
by: Paul | last post by:
Hi all, at present I I've built a website which can be updated by admin and users. My problem, I've combined "log in" and "access levels" to restrict access to certain pages, using the built...
7
by: tweak | last post by:
Can someone give me a short example as how to best use this keyword in your code? This is my understanding: by definition restrict sounds like it is suppose to restrict access to memory...
1
by: =?Utf-8?B?Qw==?= | last post by:
I want to restrict the user entering nonalphanumeric keys using Javascript onKeypress. One exception is that I want to allow the user to enter spaces. How can I do this? Thanks in Advance.
2
by: phpnoob | last post by:
I have a php script that processes a form and then posts the user input to a data file on the server in a comma delimited format. For simplicity call the file "data.csv." The script is working...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.