LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-14-2005, 02:29 AM   #1
fritz001
Member
 
Registered: Aug 2004
Posts: 176

Rep: Reputation: 18
question about APACHE and PHP


on my slack box i have installed apache with php support

well if a memeber of LAN try to access the apache server he will be redirect to a specific WEB page.

example

client IP-192.168.0.6 request http://slack-box ------->redirect to http://slack-box/index6.html

client IP-192.168.0.4 request http://slack-box ------->redirect to http://slack-box/index1.html

client IP-192.168.0.7 request http://slack-box ------->redirect to http://slack-box/index3.html

usw..................

what i mean if a client with a specfic IP try to access web server he will be redirect to a specific page....

i have no ideea howto do that !!!!!!
 
Old 05-14-2005, 03:53 AM   #2
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 53
From : http://www.php.net/manual/en/function.getenv.php
Code:
$ip = getenv("REMOTE_ADDR");
Can also be:
Code:
$ip = $_SERVER["REMOTE_ADDR"];
From : http://www.faqts.com/knowledge_base/...html/aid/4127/
Code:
  <?php
    $to = 'http://www.example.com';

    header('Location: '. $to); 
    exit;
  ?>
So it will be something like... (UNTESTED):
Code:
  <?php
    $ip = getenv("REMOTE_ADDR");
    if ($ip="192.168.0.6") {
         $to = 'http://slack-box/index6.html';
    } elseif ($ip="192.168.0.4") {
         $to = 'http://slack-box/index1.html';
    } elseif ($ip="192.168.0.7") {
         $to = 'http://slack-box/index3.html';
    }
    header('Location: '. $to); 
    exit;
  ?>
PS: Take a look at second page that will also teach you different ways to redirect a page.

Last edited by gbonvehi; 05-14-2005 at 03:55 AM.
 
Old 05-15-2005, 11:40 AM   #3
fritz001
Member
 
Registered: Aug 2004
Posts: 176

Original Poster
Rep: Reputation: 18
well it helps me a lot........
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache/PHP Question Bobscrachy Linux - Software 5 12-12-2005 01:47 AM
Quick Apache + PHP question locke105 Slackware 2 08-02-2005 07:19 PM
another apache question (maybe PHP) zchoyt Linux - Software 2 05-20-2005 01:46 PM
Apache-PHP question jolu2000 Linux - Software 3 06-04-2003 03:57 PM
Php & Apache question DoubleLetter Linux - General 8 10-16-2001 03:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration