Need Help

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

AllenTan
Forum Newbie
Posts: 8
Joined: Wed Mar 17, 2004 1:00 pm

Need Help

Post by AllenTan »

Hello there,
m a Newbie in PHP.
can you help on this.

I need to protect my php pages not being cached in clinets computer.
right now my server is php 4.0.

any help will apprecited!!!

thanks
Allen
User avatar
andre_c
Forum Contributor
Posts: 412
Joined: Sun Feb 29, 2004 6:49 pm
Location: Salt Lake City, Utah

Post by andre_c »

I've been using this:

Code: Select all

header("Expires: Mon, 14 Jul 1789 12:30:00 GMT");    // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 
header("Cache-Control: no-store, no-cache, must-revalidate");  // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");                        // HTTP/1.0
Maybe someone has something better but this has worked for me.
You need to do this before any output reaches the browser
AllenTan
Forum Newbie
Posts: 8
Joined: Wed Mar 17, 2004 1:00 pm

Post by AllenTan »

thanks a million!
I did apply on my page and delete my cache but when I see the page aging, it goes to cache again.
any Idea?

Rgs
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Post by TheBentinel.com »

AllenTan wrote:thanks a million!
I did apply on my page and delete my cache but when I see the page aging, it goes to cache again.
any Idea?

Rgs
Dumb question, but your browser is set to get a new version of the page every visit, right?

In IE, that's found at Tools-->Internet Options-->Settings
AllenTan
Forum Newbie
Posts: 8
Joined: Wed Mar 17, 2004 1:00 pm

Post by AllenTan »

so you are saying that applying no cache is not secure enough for my pages!? am I right?
cuz people can easyly do this: browser is set to get a new version of the page every visit
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Post by TheBentinel.com »

AllenTan wrote:so you are saying that applying no cache is not secure enough for my pages!? am I right?
cuz people can easyly do this: browser is set to get a new version of the page every visit
Well, I can't say for sure, but I think all those headers don't mean anything if the browser doesn't respect them. Maybe IE does respect them, but does Firefox? Does Dave's Custom Browser?

It's almost like trying to prevent people from viewing your HTML source, or keeping them from copying your images. You can put up roadblocks, but moderately-determined users can always drive around them.
AllenTan
Forum Newbie
Posts: 8
Joined: Wed Mar 17, 2004 1:00 pm

Post by AllenTan »

thanks and you are right!

Here it is what I am going to do.
I will have some .mov and .swf files on my php pages and wont people grab them easyly. and all these pages will have password protected. I think I should go and look for something that goes with does opjects. am I right?

any idea for this?
thanking you in advance!!!

cheers

Al
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Post by TheBentinel.com »

AllenTan wrote:I will have some .mov and .swf files on my php pages and wont people grab them easyly. and all these pages will have password protected. I think I should go and look for something that goes with does opjects. am I right?
I'm sorry, Al, I'm not following what you want to do. Do you want to show people .mov and .swf files, but prevent them from saving them to their computers?
AllenTan
Forum Newbie
Posts: 8
Joined: Wed Mar 17, 2004 1:00 pm

Post by AllenTan »

yes, exactly!
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Post by TheBentinel.com »

TheBentinel.com wrote: I'm sorry, Al, I'm not following what you want to do. Do you want to show people .mov and .swf files, but prevent them from saving them to their computers?
See, it's impossible. The way they view your files is by downloading them to their computers. You can put one of those annoying scripts on your site that "disables" the right-click menu and I think you can even convince IE to disable the "save" option for the page. But the files are right there in their cache.

Even if you manage to get in their way, a determined user can get past it. And the first time the code you put in place manages to prevent a user from viewing your site, you've lost any advantage you've tried to gain.

Do what you like, of course. But my advice is to just host great content and not sweat the very few users that plagarize your stuff.
AllenTan
Forum Newbie
Posts: 8
Joined: Wed Mar 17, 2004 1:00 pm

Post by AllenTan »

but I have seen something like this.
there is a site for online tutorials and is based on memberships.
when I see those movies, it does not stored in my cache!

thanks a million for you time anyway!
I have to find out how they are doing.

Al
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Post by TheBentinel.com »

AllenTan wrote: when I see those movies, it does not stored in my cache!
I went and said "impossible". You'd think I'd learn.

When you find out how they're doing it, please post it back. I don't want to do it right now, but I'd love to at least know how!

Thanks!
AllenTan
Forum Newbie
Posts: 8
Joined: Wed Mar 17, 2004 1:00 pm

Post by AllenTan »

for sure I will post when I get it!
thanks Dave for you time!

for now
Cheers
Al
AllenTan
Forum Newbie
Posts: 8
Joined: Wed Mar 17, 2004 1:00 pm

Post by AllenTan »

Helle Dave,

this is the site that I was talking about.
http://www.vtc.com/products/claris.htm

when you see the movies, it does not store in your computer.

try it yourself please.


Al
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

Code: Select all

function openWindow(url) 
{
p=url.indexOf("movie");

mtitle=url.substring(p+10,url.length);
movienum=url.substring(p+8,p+10);
chapter=url.substring(p+6,p+8);

movieURL=url.substring(url.length-9,url.length);
winwidth=640;
		winheight=480+50;
wposx=0;
wposy=0;
file='http://mediaservers.vtc.com/movieplayers/movieplayer.php?size=small&foldername=cw5&title='+mtitle+'&movie='+chapter+movienum+'';
popupWin = window.open(file,"vtcplayer","status=no,resizable=no,toolbar=no,scrollbars=no,screenX="+wposx+",screenY=0,left="+wposx+",top="+wposy+",width="+winwidth+",height="+winheight);

}

Code: Select all

<img src='/images/movie.gif'> <a href="javascript:openWindow('movie=
010433045');"> Ruler Bar</a><br>
Just figure out what each thing does, and you have your filename, then create a file that links to the filename, and right click and save as.


It's impossible..
Post Reply