oskare100 Posted December 26, 2006 Share Posted December 26, 2006 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:[code=php:0]$result2 = mysql_query('select `file_name` , `file_pack` from '$file_tbl' where `file_id` = "'.$_GET['serve'].'"') or die( mysql_error() );[/code]Then I run this (don't know if it's right) to get the file_pack and file_name from the user permission table:[code=php:0]$result3 = mysql_query('select `file_name` , `file_pack` from '$user_tbl' where `username` = "'$_SESSION['username']'"') or die( mysql_error() );[/code]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 ;[/CODE]Thanks in advance,Best RegardsOskar R Link to comment https://forums.phpfreaks.com/topic/31872-if-the-user-has-permission-to-download-the-file_name-or-the-file_pack-then-go-a/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.