澳大利亚新闻 澳洲留学移民 澳洲留学移民精华 澳大利亚广播电台 澳大利亚英语讲座 雅思听力 雅思口语 雅思阅读 雅思写作 澳大利亚贴图 新西兰论坛 澳大利亚招聘 澳大利亚租房 澳大利亚旅游 澳大利亚黄页 澳大利亚宠物 澳大利亚文学 澳大利亚美食 堪培拉,Canberra论坛 悉尼,Sydney论坛 墨尔本,Melbourne论坛 布里斯本,Brisbane论坛 悉尼大学,USYD Forum 新南威尔士大学,UNSW CSA Forum 麦觉理大学,MQ Forum 悉尼科技大学,UTS Forum TAFE 澳洲高中,Taylors College论坛 墨尔本大学联盟 Adelaide大学联盟 昆士兰大学联盟

help: download page(页 1) - 澳洲网页设计 -

澳洲中文网 » 澳洲网页设计 » help: download page
悉尼专业美发
2006-5-4 10:28 j2lane
help: download page

[size=3]Say you have a page can be visited at www.mycom.com/downpage.php that contains following code:

please <a href="mysoftware.zip">click</a> to download the software

obviousely if user clicks on the word 'click',mysoftware.zip will be downloaded to local harddisk, right? however, for smart users, they may know that the zip file stored at same directory/folder as downpage.php, so if they put the following into browser's address bar :

www.mycom.com/mysoftware.zip

what will happen? they will get your file anyway. what i want is, if some guys type in the above url into address bar, it pops up a window says

you did not pay me 5 cents, you can not download it.

or just simply ban it, redirect to the downloadpage.php, let those people give me some information or 5 cents, and they they can download it.

[/size][size=4]anyone who knows how to do that?[/size]

2006-5-4 14:36 城市童话
This is the coding skill. or you can use redirect function to do it by using this:

<?php
header("Location: [url]http://www.skyaus.com/[/url]");
?>

put this code into your php page

2006-5-4 15:52 j2lane
[quote]原帖由 [i]城市童话[/i] 于 2006-5-4 13:36 发表
This is the coding skill. or you can use redirect function to do it by using this:

<?php
header("Location: [url]http://www.skyaus.com/[/url]");
?>

put this code into your php page [/quote]


[size=3]
hehe

sorry u didnt get my words.

say if i put the file mysoftware.zip on server, and somehow, people know the exactly the directory where i put it in, for example, i put it in the root directory same as the index.html/php file, so the user can download it by type in the address bar following letters

[url]http://www.myhost.com/mysoftware.zip[/url]

and download it. how can i do to avoiding people access mysoftware.zip directly?  say, if my server notices that mysoftware.zip is being accessed not from the download page, for example the referer url is not on my allowed list. or other case, how to stop giving the file to them?

hope i explained it clearly


[/size]

[[i] 本帖最后由 j2lane 于 2006-5-4 14:54 编辑 [/i]]

2007-3-14 17:55 夜灵乄蝎
so have you resolved it yet?

2007-7-6 13:06 viggy
why dont you define some members and levels and give an accessLevel to your members, if its a member and is VIP, then put the links on it, others, just hide the link. like
<%
String users = "1234";
String accessLevel ="VIP";

if ( users !=null && users.equals("1234") && accessLevel != null && accessLevel.equals("VIP")) {
%>
   <a href="/mysoftware.zip">download it</a>
<% } else { %>
   sorry you dont have permission to download it.
<% } %>

and you might need to check whether the member is login or not? and set this attribute into your session?

and also you might need to encode your links?

well, you need lots of code for doing it...

and also on the serverside you'd better put relative path to your page, for example /mysoftware.zip instead of mysoftware.zip then wherever you put your page on your server it wont gets 404 page not found error.

but i still think your question is too general, like do you want us to help you with the coding or with the logic? or something else, if you can provide more details, maybe more ppl can help you through,  not sure whether it make sense to you, the above are jsp codes, and very draft examples.

2008-1-20 00:15 markyao
原来是 天书

2008-1-29 14:25 kr2000
用.htaccess控制文件夹属性,别人就不能直接打开文件了

页: [1]

查看完整版本: help: download page


Powered by 澳大利亚中文网 5.5.0  © 2005-2007 澳大利亚论坛