473,775 Members | 2,463 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Registered users only can download

150 New Member
I need php code that deny any user to download the files in the site except the registerd users can download the files how can i do that with php or any language?
Dec 12 '07 #1
2 1834
nothing1
30 New Member
I need php code that deny any user to download the files in the site except the registerd users can download the files how can i do that with php or any language?
In what way are the users logged in? sessions or cookies? either way this might help:


[PHP]//the blank space is where it changes depending on sessions or cookies.
if( _______ != ''){
$logged_in = 'true';
}else{
$logged_in = 'false';
}


//in the body where ever the download link is
<?php
if($logged_in){ echo '<a href="http://mysite.com/donwload/file.zip">Downl oad</a>';}
?>[/PHP]
Dec 13 '07 #2
Markus
6,050 Recognized Expert Expert
In what way are the users logged in? sessions or cookies? either way this might help:


[PHP]//the blank space is where it changes depending on sessions or cookies.
if( _______ != ''){
$logged_in = 'true';
}else{
$logged_in = 'false';
}


//in the body where ever the download link is
<?php
if($logged_in){ echo '<a href="http://mysite.com/donwload/file.zip">Downl oad</a>';}
?>[/PHP]
TRUE, FALSE or NULL should never be writtin within qoutes - unless you want the TRUE, FALSE or NULL to breated treated as text.

Doing what you have done
[php]
$logged_in = 'true'
//wont check for boolean TRUE or FALSE
//but will assign the text 'true' to that variable

$logged_in = true;
//however, will give the variable a booleab TRUE.
[/php]
Dec 13 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1199
by: Derrick | last post by:
We are trying to create a basic "signup for demo download" where user enters info, gets an email with user/pass to go and ftp download the demo. FTP currently is using NT security. Is it possible to create an NT user from ASP? Or is there any other tactic that is more standard? Thanks in advance! Derrick
3
3114
by: Lachlan Gemmell | last post by:
Hello there, I'd like to set the users default download folder on their PC to a certain location (if it exists). The users will be downloading documents and we want to try to minimise the chances of them being littered all over their PCs. Any suggestions? I don't want to create directories on their PCs just make them the default directory when the download dialogue appears. Regards,
4
9168
by: Martin Franklin | last post by:
I am trying to get a total record count on a Acess 97 mdb database. However I get the following error when I try to load the page: Provider error '80040154' Class not registered http://www.assetresearch.com/clog/count.asp I believe permissions for the IUSR_machine are correct as I am able to add and delete records from the database through other ASP pages in the site. Any ideas on what Class needs to be re-registered. If so, how do I...
11
2274
by: Heather | last post by:
I need suggestions on possible ways to implement the following: 10 users on a network need to infrequently add data to a backend database on the network. The data would be a couple of records containing maybe a half dozen fields. The users do not have Access. Would adding a form to the backend database for these users be a viable option considering they would need to open the form over the network? Thanks for all anticipated help!
0
1179
by: znmaster | last post by:
I've made a ActiveX control, and I put it in a web page. When users browser the page , the ActiveX control is downloaded,but not registered in the computer automatically!! When you refresh the page, the browser has to download it again!! How can I solve this problem? Should I solve this prolbem in the ActiveX control,or in the web page, or in the inf file? I've made a cab file including the .ocx,.dll, and .inf. The .inf is like this:
8
2699
by: DanB | last post by:
This is probably soooo simple but I can't seem to get it. I have a text file that I want users to download via a web page. I want the file to be saved to a default folder (or one that they choose) on the users / client file system. I have toyed with a Self-Extracting zip file but the contents of my zip file changes each time it is downloaded so that invalidates the exe file. Also the text file is so small it is a waste to zip it.
2
1396
by: bjacob | last post by:
Hi! I have a blog made with b2evo, but I'd want to migrate to another software. I need this feature: different user levels, and each level see only the posts intended for them. I'd want to be able to do posts for everyone, posts for customers, posts for friends and posts for close friends. The user levels deployed in b2evo and Wordpress seem only to limit editing and blogging, but not readability of the posts (actually, in
2
3255
by: deko | last post by:
I have files on my Apache web server that are NOT in publicly accessible space. I want to make these files available for download only to authenticated users. I currently use a download script that is accessed from an SSL-encrypted page (that the user arrives at after authenticating). There are links in this page that initiate the different file downloads by passing a variable (name of the directory and file) to the download script. ...
10
3056
by: Jamunt | last post by:
Hi, I want to create an application in which around 1000 users will be served at one time. All of the users will be sending around 1 mb of data. I will be parsing that data and would insert some of the data into the database. Is web service right choice for this kind of web applications. What kind of performance problems i might encounter. Will ASP.net is the
0
9622
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10270
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9916
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8939
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5360
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5486
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4017
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.