Zymic Forums

Webmaster resources

Zymic IRC Server

Chat in real time at irc.zymic.com - Learn More

Welcome

Welcome to the Zymic webmaster forums. Our forums are here to provide people the free ability to discuss a range of websites related topics such as design, development coding and marketing.

In order to post you will need to register for a zymic account or if you already have one simply login by using the form on the left.

left Zymic Webmaster ForumsWeb Design & DevelopmentServer Side ScriptingPHP right
  Closed Topic Start new topic
left right
Jetteh22
post Nov 22 2010, 06:03 PM
Post #1


PHP Programmer
*******

Group: Members
Posts: 895
Joined: 9-March 08
From: Naples, FL
Member No.: 13,296



Hello,

Some of you might remember me. I've finally gotten back into web building, etc, and I just can't figure this out. I test on Chrome, Firefox and IE. A couple of my PHP codes aren't working for IE ONLY... I'll put them in two separate threads since they're different questions.

The following code is supposed to make sure, on every page, that the page the person is coming from is within the site (no outside linking):

CODE
<?php

$myurl = "thinkcreactive.com";
$myurl2 = "www.thinkcreactive.com";

$referer = $_SERVER['HTTP_REFERER'];

if ($referer == "") {
$domain = $myurl;
} else {
$domain = parse_url($referer);
}

if($domain['host'] == $myurl || $domain['host'] == $myurl2) {

} else {

echo ?>

<script type="text/javascript">
<!--
window.location = "index.php?e=18"
-->
</script>
<?php

die();

}
?>


Now, on Chrome and Firefox you can go from page to page to page and it works fine. But on IE, it ALWAYS goes to the index page and gives the message I want it to give if you're linking in from outside.

Anybody know why it's doing this on IE only?
Go to the top of the page 
 
  + Quote Post
swordz
post Nov 22 2010, 11:03 PM
Post #2


Outrageously Uber Ninja
*******

Group: Moderators
Posts: 1,805
Joined: 10-July 08
From: UK
Member No.: 44,994



HTTP_REFERER is a browser set header - you can't rely on it for anything. Some set it, some don't, some even allow you to change it.

My personal method of doing this would be by sessions (which then relies on cookies)..., or by IP (with MySQL backup).

Swordz
Go to the top of the page 
 
  + Quote Post
Jetteh22
post Nov 22 2010, 11:40 PM
Post #3


PHP Programmer
*******

Group: Members
Posts: 895
Joined: 9-March 08
From: Naples, FL
Member No.: 13,296



QUOTE(swordz @ Nov 22 2010, 11:03 PM) *
HTTP_REFERER is a browser set header - you can't rely on it for anything. Some set it, some don't, some even allow you to change it.

My personal method of doing this would be by sessions (which then relies on cookies)..., or by IP (with MySQL backup).

Swordz


Heyyy, I remember you! tongue.gif

I actually do use sessions. My thing is, I don't want people to be able to link into my forms and my pages from their own site. With sessions and cookies, as long as you're in the same window you can log into the site, go to your own site ,click a link and it will take you back into MY site again and that's what I'm trying to avoid.

The referring URL is the perfect solution except for IE shit.
Go to the top of the page 
 
  + Quote Post
swordz
post Nov 23 2010, 08:50 AM
Post #4


Outrageously Uber Ninja
*******

Group: Moderators
Posts: 1,805
Joined: 10-July 08
From: UK
Member No.: 44,994



QUOTE(Jetteh22 @ Nov 22 2010, 11:40 PM) *
Heyyy, I remember you! tongue.gif

I've never left, just gotten quieter...

QUOTE(Jetteh22 @ Nov 22 2010, 11:40 PM) *
The referring URL is the perfect solution except for IE shit.

And the fact that it's not reliable. If people figure it out (and they will) they'll just spoof the referrer.

Swordz
Go to the top of the page 
 
  + Quote Post
 Closed Topic Start new topic
left right
0 Members:
left right
 


Lo-Fi Version Time is now: 19th June 2013 - 09:12 AM