You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Gaurav Pathak <ga...@directi.com> on 2002/12/24 10:36:28 UTC

[users@httpd] adding footers on basis of IP address.

Hi
I have a list of IP Address with me. What I want is if my website is 
viewed from any of these IP Addresses I want to add a particular line 
of text (basically a footer) and then display it.
eg
For a range of IP address x.y.z.1 to x.y.z.255 I want one footer while 
for another range p.q.r.1 to p.q.r.255 I want to have a different footer.
Any hints on how can I achieve this.

Thanks
Gaurav


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] adding footers on basis of IP address.

Posted by Gary Turner <kk...@sbcglobal.net>.
Gaurav Pathak wrote:

>Hi
>I have a list of IP Address with me. What I want is if my website is 
>viewed from any of these IP Addresses I want to add a particular line 
>of text (basically a footer) and then display it.
>eg
>For a range of IP address x.y.z.1 to x.y.z.255 I want one footer while 
>for another range p.q.r.1 to p.q.r.255 I want to have a different footer.
>Any hints on how can I achieve this.

The first thing that comes to my mind is to use server-side-includes and
conditional expressions.  Use the environmental variable "REMOTE_ADDR"
or "REMOTE_HOST".  You may prefer to use the ssi to call a cgi script to
handle the whatif.  See:

	http://httpd.apache.org/docs/howto/ssi.html#conditionalexpressions

hth
--
gt                  kk5st@sbcglobal.net
 If someone tells you---
 "I have a sense of humor, but that's not funny." 
                                  ---they don't.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] adding footers on basis of IP address.

Posted by Gaurav Pathak <ga...@directi.com>.
Hi
Thanks for the reply. It should be easy with PHP, Perl etc but I 
think it would be very resource hungry and the performence will 
degrade as the visits will increase. Is it possible to build  a 
custom module in Apache that would do the task as well as save 
the overhead involved in calling an external program every time.

Thanks
Gaurav


-----Original Message-----
From: Chris Taylor [mailto:chris@x-bb.org]
Sent: Tuesday, December 24, 2002 9:06 PM
To: users@httpd.apache.org; gaurav.p@directi.com
Subject: Re: [users@httpd] adding footers on basis of IP address.


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Other than SSI, your options include many scripting languages, such
as PHP, Perl, ASP, ColdFusion etc etc. All of these should have no
problem getting the request variables and conditionally including
some text based on an IP.

Personally, I'd recommend PHP, because it's very easy to setup for
Apache, and extremely simple to embed in regular HTML.

As far as I know, this is not possible using some clever Apache
config to actually include this footer. However, you could use
mod_rewrite to redirect to a different page (with a different footer)
based on the IP.

There are many solutions available here, some more complex than
others. :)

HTH.

Chris Taylor - chris@x-bb.org - The guy with the PS2 WebServer -
http://www.x-bb.org/chris.asc

- ----- Original Message ----- 
From: "Gaurav Pathak" <ga...@directi.com>
To: <us...@httpd.apache.org>
Sent: Tuesday, December 24, 2002 9:36 AM
Subject: [users@httpd] adding footers on basis of IP address.


> Hi
> I have a list of IP Address with me. What I want is if my website
> is  viewed from any of these IP Addresses I want to add a
> particular line  of text (basically a footer) and then display it.
> eg
> For a range of IP address x.y.z.1 to x.y.z.255 I want one footer
> while  for another range p.q.r.1 to p.q.r.255 I want to have a
> different footer. Any hints on how can I achieve this.
> 
> Thanks
> Gaurav
> 
> 
> --------------------------------------------------------------------
> - The official User-To-User support forum of the Apache HTTP Server
> Project. See <URL:http://httpd.apache.org/userslist.html> for more
> info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPgh+1Cqf8lmE2RZkEQI9owCeNGdDrXAOrRc5kcASJlczGnIO4LAAoKro
XIUL0BKNnZljDXFbrqTKmfek
=8eO7
-----END PGP SIGNATURE-----



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] adding footers on basis of IP address.

Posted by Chris Taylor <ch...@x-bb.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Other than SSI, your options include many scripting languages, such
as PHP, Perl, ASP, ColdFusion etc etc. All of these should have no
problem getting the request variables and conditionally including
some text based on an IP.

Personally, I'd recommend PHP, because it's very easy to setup for
Apache, and extremely simple to embed in regular HTML.

As far as I know, this is not possible using some clever Apache
config to actually include this footer. However, you could use
mod_rewrite to redirect to a different page (with a different footer)
based on the IP.

There are many solutions available here, some more complex than
others. :)

HTH.

Chris Taylor - chris@x-bb.org - The guy with the PS2 WebServer -
http://www.x-bb.org/chris.asc

- ----- Original Message ----- 
From: "Gaurav Pathak" <ga...@directi.com>
To: <us...@httpd.apache.org>
Sent: Tuesday, December 24, 2002 9:36 AM
Subject: [users@httpd] adding footers on basis of IP address.


> Hi
> I have a list of IP Address with me. What I want is if my website
> is  viewed from any of these IP Addresses I want to add a
> particular line  of text (basically a footer) and then display it.
> eg
> For a range of IP address x.y.z.1 to x.y.z.255 I want one footer
> while  for another range p.q.r.1 to p.q.r.255 I want to have a
> different footer. Any hints on how can I achieve this.
> 
> Thanks
> Gaurav
> 
> 
> --------------------------------------------------------------------
> - The official User-To-User support forum of the Apache HTTP Server
> Project. See <URL:http://httpd.apache.org/userslist.html> for more
> info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPgh+1Cqf8lmE2RZkEQI9owCeNGdDrXAOrRc5kcASJlczGnIO4LAAoKro
XIUL0BKNnZljDXFbrqTKmfek
=8eO7
-----END PGP SIGNATURE-----



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org