Only allow people from domain.com onto a page....

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
DynamiteHost
Forum Commoner
Posts: 69
Joined: Sat Aug 10, 2002 5:33 pm

Only allow people from domain.com onto a page....

Post by DynamiteHost »

Hey,

I need this:

Code: Select all

<?
if ($user_is_from_domain.com) &#123;

print "stuff";

&#125;
The website they would be coming from would be domain.com and the script would be on domain.com.... so basically a http_refer thing or sommet :-/

Can anyone give me the code quickly before I go insane?

Thanks :D
seg
Forum Commoner
Posts: 38
Joined: Thu Oct 31, 2002 12:08 pm
Location: Northern, VA
Contact:

Post by seg »

Code: Select all

&lt;?php
if (strstr($HTTP_REFERER,"domain.com")) {
echo("hello world");
}
?&gt;
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

DynamiteHost
Forum Commoner
Posts: 69
Joined: Sat Aug 10, 2002 5:33 pm

Post by DynamiteHost »

i'm not trying to prevent hotlinking 8O

its for an admin section and i want it to have top security :D
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

but it also checks the referer (which is insecure!!!)
seg
Forum Commoner
Posts: 38
Joined: Thu Oct 31, 2002 12:08 pm
Location: Northern, VA
Contact:

Post by seg »

volka wrote:but it also checks the referer (which is insecure!!!)
Agreed, but as long as that is just one point in a long aragment of security measures, then I'm all for it.
DynamiteHost
Forum Commoner
Posts: 69
Joined: Sat Aug 10, 2002 5:33 pm

Post by DynamiteHost »

I'm md5 encrypting all passwords, file urls have to be one of a predefined few, sessions are looked for and this...

any i have left out?
Post Reply