Go to Post Call it confidence, call it ego, call it what you want, but the fact of the matter is you need to be humble or someone will humble you. - Dan Richardson [more]
Home
Go Back   Chief Delphi > Other > Chit-Chat
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 24-07-2001, 19:46
mpking's Avatar
mpking mpking is offline
Registered User
AKA: Mike
#0088 (TJ²)
Team Role: Alumni
 
Join Date: Jun 2001
Location: Bridgewater MA
Posts: 144
mpking is an unknown quantity at this point
Send a message via AIM to mpking
Question Web Page Help

Ok, I've bashed my head for the last few hours.

I'm trying make a simple redirect script for a web page

If your IP address begins with 207.206
goto http://this site.com
else
goto http://that.site.com

I don't care how it's occomplished (php, server config, java, javascript,etc)

It's on a apache 1.3.19 server that I have complete control over. I've spent the last couple of hours trying to do it with javascript, and everything I've come up with is Netscape only. Arrg!

Can anyone help?

Please?
__________________
Mike King
Bridgewater Raynham Regional High School
Team 88 TJ²
The Home of Moe
Reply With Quote
  #2   Spotlight this post!  
Unread 24-07-2001, 23:44
Brandon Martus's Avatar Unsung FIRST Hero
Brandon Martus Brandon Martus is offline
busy.
AKA: B. Slash Kamen
no team
 
Join Date: May 2001
Rookie Year: 1998
Location: Nevada, TX USA
Posts: 5,271
Brandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond repute
Send a message via ICQ to Brandon Martus Send a message via AIM to Brandon Martus Send a message via Yahoo to Brandon Martus
heres some php

PHP Code:
<?php

if ( strstr($REMOTE_ADDR'207.206') ) {
  
header ("Location: http://this.site.com");
  exit;
} else {
  
header ("Location: http://that.site.com");
  exit;
}

?>

I didn't test it out.
Let me know if it doesnt work, and I'll fix it.
__________________
Brandon Martus
e-mail
Reply With Quote
  #3   Spotlight this post!  
Unread 25-07-2001, 00:02
mpking's Avatar
mpking mpking is offline
Registered User
AKA: Mike
#0088 (TJ²)
Team Role: Alumni
 
Join Date: Jun 2001
Location: Bridgewater MA
Posts: 144
mpking is an unknown quantity at this point
Send a message via AIM to mpking
Um?

Um, how's this work.

I'm assuming the file has to be renamed from index.html to index.php?

Never dealt with PHP before?

Quote:
Originally posted by Brandon Martus
heres some php

PHP Code:
<?php

if ( strstr($REMOTE_ADDR'207.206') ) {
  
header ("Location: [url]http://this.site.com[/url]");
  exit;
} else {
  
header ("Location: [url]http://that.site.com[/url]");
  exit;
}

?>

I didn't test it out.
Let me know if it doesnt work, and I'll fix it.
__________________
Mike King
Bridgewater Raynham Regional High School
Team 88 TJ²
The Home of Moe
Reply With Quote
  #4   Spotlight this post!  
Unread 25-07-2001, 01:08
mpking's Avatar
mpking mpking is offline
Registered User
AKA: Mike
#0088 (TJ²)
Team Role: Alumni
 
Join Date: Jun 2001
Location: Bridgewater MA
Posts: 144
mpking is an unknown quantity at this point
Send a message via AIM to mpking
Re: Um?

Ok, I've enabled SSI on the server, turned on XBitHack, and made the page executable.

It was halfway working, but now it's not.

by halfway I mean this.
I should have been clearer in my example.

if 207.206
https://netreg.bridgew.edu/indexresnet.html
else
https://netreg.bridgew.edu/indexall.html

I had those two locations in there, and when it was partway working, it would redirect to the httpS, but it wouldn't pick up the document.
__________________
Mike King
Bridgewater Raynham Regional High School
Team 88 TJ²
The Home of Moe
Reply With Quote
  #5   Spotlight this post!  
Unread 25-07-2001, 21:22
Adrian Wong Adrian Wong is offline
Registered User
#0596 (SciClones)
Team Role: Alumni
 
Join Date: Jun 2001
Rookie Year: 2001
Location: Hopkinton, Mass.
Posts: 146
Adrian Wong is an unknown quantity at this point
Send a message via AIM to Adrian Wong
Do you have mod_rewrite setup on your Apache server?
Reply With Quote
  #6   Spotlight this post!  
Unread 25-07-2001, 22:42
mpking's Avatar
mpking mpking is offline
Registered User
AKA: Mike
#0088 (TJ²)
Team Role: Alumni
 
Join Date: Jun 2001
Location: Bridgewater MA
Posts: 144
mpking is an unknown quantity at this point
Send a message via AIM to mpking
Solution is Found

Ok, I called in one of the programming guru's at work, and in trying to explain it to him, I hit apon the solution.

The solution that I've discovered is a combination of Javascript and SSI includes.
Code:
<noscript><meta http-equiv="refresh" content="2; URL=indexresnet.html"></noscript>
<script language="JavaScript">
<!--
var resnetsTargetURL = "https://netreg.bridgew.edu/indexresnet.html";
var allsTargetURL = "https://netreg.bridgew.edu/indexall.html";


function doRedirect()
{
var ip = "REMOTE_ADDR";
if (ip.indexOf("192.168") >= -1)  
        setTimeout( "window.location.href = resnetsTargetURL", 2*1000 );
else
        setTimeout( "window.location.href = allsTargetURL", 2*1000 );
}
//-->
</script>

<script language="JavaScript1.1">
<!--
function doRedirect()
{
var ip = "REMOTE_ADDR";

if (ip.indexOf("192.168") >= -1)  
   window.location.replace( resnetsTargetURL );
else
   window.location.replace( allsTargetURL );
}

doRedirect();

//-->
</script>
of course the <body onload="doRedirect()"> tag is in there too.

Thanks for all your suggestions, you guys at least got me started on the right road.
__________________
Mike King
Bridgewater Raynham Regional High School
Team 88 TJ²
The Home of Moe
Reply With Quote
  #7   Spotlight this post!  
Unread 26-07-2001, 22:24
mpking's Avatar
mpking mpking is offline
Registered User
AKA: Mike
#0088 (TJ²)
Team Role: Alumni
 
Join Date: Jun 2001
Location: Bridgewater MA
Posts: 144
mpking is an unknown quantity at this point
Send a message via AIM to mpking
Ok, just a small minor update. The previous script I posted don't work.

I did a google search on SSI redirects

Came up with this script. Keep in mind this is the entire webpage.

Code:
<!--#if expr="${REMOTE_ADDR} = /192.168.10/" --> 
<!--#include file="indexresnet.html" --> 
<!--#else --> 
<!--#include file="indexall.html" --> 
<!--#endif -->


Kinda neat, eh?

The pages I want displayed are completely contained in the .html files.

Too bad no one had mentioned server side includes to me before. (they've been suppored since both browsers verion 2.0)
__________________
Mike King
Bridgewater Raynham Regional High School
Team 88 TJ²
The Home of Moe
Reply With Quote
  #8   Spotlight this post!  
Unread 27-07-2001, 05:11
Brandon Martus's Avatar Unsung FIRST Hero
Brandon Martus Brandon Martus is offline
busy.
AKA: B. Slash Kamen
no team
 
Join Date: May 2001
Rookie Year: 1998
Location: Nevada, TX USA
Posts: 5,271
Brandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond repute
Send a message via ICQ to Brandon Martus Send a message via AIM to Brandon Martus Send a message via Yahoo to Brandon Martus
oh yea

i mainly use SSI for

including files
<!--#include virtual="/file/to/include/here.html"-->

and executing cgi's
<!--#exec cgi="/cgi/date.pl"-->


forgot about the scripting capabilities.
__________________
Brandon Martus
e-mail
Reply With Quote
  #9   Spotlight this post!  
Unread 27-07-2001, 10:48
Kyle Fenton Kyle Fenton is offline
GET IT ON!!
FRC #0121 (Rhode Warrior)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 2000
Location: Middletown, R.I.
Posts: 785
Kyle Fenton has much to be proud ofKyle Fenton has much to be proud ofKyle Fenton has much to be proud ofKyle Fenton has much to be proud ofKyle Fenton has much to be proud ofKyle Fenton has much to be proud ofKyle Fenton has much to be proud ofKyle Fenton has much to be proud ofKyle Fenton has much to be proud ofKyle Fenton has much to be proud of
Send a message via AIM to Kyle Fenton
Using Flash 5

You can use Flash 5 to re-direct to any file. It is simple and most people have the plug-in for it.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
A web page class in converting from PBasic to C JimWright949 Programming 1 21-09-2003 19:54
an error in SoCal event result in the FIRST web page archiver 2001 0 24-06-2002 02:35
What happend to the FIRST team web page directory? archiver 2001 1 24-06-2002 01:21
Web page upgrades archiver 1999 0 23-06-2002 23:04
Web page upgrades archiver 1999 0 23-06-2002 23:04


All times are GMT -5. The time now is 07:54.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi