Current location: Hot Scripts Forums » Programming Languages » PHP » If the user has permission to download the file_name or the file_pack, then go ahead.


If the user has permission to download the file_name or the file_pack, then go ahead.

Reply
  #1 (permalink)  
Old 12-26-06, 06:11 AM
Oskare100 Oskare100 is offline
Newbie Coder
 
Join Date: Apr 2005
Posts: 86
Thanks: 0
Thanked 0 Times in 0 Posts
If the user has permission to download the file_name or the file_pack, then go ahead.

Hello,
I've a file downloading script that hides the real location from the person who is trying to download the file.

First I run this (don't know if it's right) to get the file_pack and the file_name of the file:
PHP Code:

$result2 mysql_query('select `file_name` , `file_pack` from '$file_tbl' where `file_id` = "'.$_GET['serve'].'"')

    or die( 
mysql_error() ); 
Then I run this (don't know if it's right) to get the file_pack and file_name from the user permission table:
PHP Code:

$result3 mysql_query('select `file_name` , `file_pack` from '$user_tbl' where `username` = "'$_SESSION['username']'"')

    or die( 
mysql_error() ); 
If one of the "file_name"s from the uuser permissions table matches the "file_name" from the requested file OR if one of the "file_pack"s from the user permissions table matches the "file_pack" of the current file then go ahead and continue with the script. If not, then die. I hope that you understand what I want to do with this and I really hope that you can help me..


IF YOU NEED IT, here is the database structure:
Code:
The user permission table where I will store which users has permission to download which files.
CREATE TABLE `user_perm` (
  `perm_id` int(11) NOT NULL auto_increment,
  `perm_user` varchar(50) NOT NULL default '',
  `file_pack` varchar(30) NOT NULL default '',
  `file_name` varchar(100) NOT NULL default '',
  `perm_date` varchar(30) NOT NULL default '',
  `perm_timestamp` varchar(30) NOT NULL default '',
  PRIMARY KEY  (`perm_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

The file table where I will store the files:
CREATE TABLE `files` (
  `file_id` int(11) NOT NULL auto_increment,
  `file_pack` varchar(50) NOT NULL default '',
  `file_pack_cat` varchar(50) NOT NULL default '',
  `file_cat` varchar(50) NOT NULL default '',
  `file_name` varchar(100) NOT NULL default '',
  `file_desc` text NOT NULL,
  `file_fullname` varchar(100) NOT NULL default '',
  `file_downloads` varchar(11) NOT NULL default '',
  `file_date` varchar(30) NOT NULL default '',
  `file_timestamp` varchar(30) NOT NULL default '',
  PRIMARY KEY  (`file_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
Thanks in advance,
Best Regards
Oskar R
Reply With Quote
  #2 (permalink)  
Old 12-28-06, 09:12 AM
Shaffer Shaffer is offline
Wannabe Coder
 
Join Date: Sep 2006
Location: Israel
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
First of all, in SQL when you want to select more then 1 object you use "and" not ",".
About the code: You want the script to hide the real location of the file...when does the user get to see it?
What is the error you get?
__________________
Hello from Israel!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql user permission? zoliky Database 0 10-14-06 02:32 AM
Download system with user permissions? Babyslaughtera General HotScripts Site Discussion 0 10-30-05 09:56 AM
User account needed for special features -- download software ATS16805 ASP.NET 0 06-24-05 09:18 AM
2 flash websites for sale metamorph General Advertisements 5 01-09-05 10:03 PM
Need Epinions-lite system in PHP & MYSQL wali001 Job Offers & Assistance 4 01-12-04 06:02 AM


All times are GMT -5. The time now is 05:51 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.