visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Languages :: PHP :: Showing link to internal staff only


By: PHP newbee U.S.A.  Date: 16/01/2003 00:00:00  English  Points: 50 Status: Answered
Quality : Excellent
Our home page is being hosting on unix. It current has a link to our intra net. I want to write something on this page that will only show this link to people surfing from the internal network.

What is the best way to do this? Do we have to make the whole home page a cgi??

Could we use php on the home page for this?

Please let me know.
By: VGR Date: 16/01/2003 19:57:00 English  Type : Answer
could be easy, could not be

on an intranet, IP addresses shown belong to a specific range.

just do in PHP something like :

if ($REMOTE_ADDR in range³) {
// show the link
} // if, else NOP


³ "in range" will become for example ($REMOTE_ADDR>='192.168.0.1')and($REMOTE_ADDR<='192.169.255.255')
By: PHP newbee Date: 16/01/2003 20:23:00 English  Type : Comment
is this php or cgi (perl) ?


By: PHP newbee Date: 16/01/2003 20:24:00 English  Type : Comment
Also.. can i assume that anyone who says they are being hosted on unix runs php? If not how hard is it for them to run php on their servers?


By: TheFalklands Date: 16/01/2003 21:00:00 English  Type : Comment
Unix does not neccessarily have to run PHP. It depends on what the server is set up for. If you are running PHP on your server than that is all that matters.

The Remote Address PHP. But you will have to write the code for it. The following link is to a PHP IP Client Logger, it will get the IP address so you can use it.

<A HREF="http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=539&lngWId=8">http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=539&lngWId=8</a>
By: sumotimor Date: 19/01/2003 07:31:00 English  Type : Comment
<?php
// Find your ip address.
print 'Your ip address is '.$REMOTE_ADDR;
// Allow One ip address.
if ($REMOTE_ADDR=='0.0.0.1')
print '<a href="<A HREF="http://192.168.1.1">http://192.168.1.1</a>">Intranet</a>';
// Allow Two or more ip addresses.
if ($REMOTE_ADDR=='0.0.0.1')||($REMOTE_ADDR=='0.0.0.2')
print '<a href="<A HREF="http://192.168.1.1">http://192.168.1.1</a>">Intranet</a>';
// Allow Range of ip addresses. Similar to VGR's example.
if ($REMOTE_ADDR>='0.0.0.1')&&($REMOTE_ADDR<='0.0.0.10')
print '<a href="<A HREF="http://192.168.1.1">http://192.168.1.1</a>">Intranet</a>';
?>
It is fairly simple to add PHP to a web sever. It can be easily done with the php cgi executable.
You may even be able to add PHP if you have access to your cgi-bin.

Do register to be able to answer

EContact
browser fav
page generated in 342.224840 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page