473,406 Members | 2,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

how can i share a file with another user

123 100+
i have three user A,B and C user A can only see what he uploaded
in the userpanel page and the for userB and C.i want user A to share
want he upload with user B alone by clicking a link named share that
is in front of want user A upload which willnow display in the userpanel
of user B
Expand|Select|Wrap|Line Numbers
  1. userpanel page
  2.  
  3. <?php
  4.     $value = "SELECT username FROM account WHERE ID = '{$_SESSION['user_id']}'";
  5.     $conta = mysql_query ($value) or die('query error');
  6.     $time = mysql_fetch_array ($conta);
  7.     $user = $time[username];
  8.  
  9.     $data = "SELECT * FROM store WHERE pick = '$user'";
  10.     $result = mysql_query ($data) or die('query error');
  11.     //$part = mysql_fetch_array ($result);
  12.     //$present = $part[objectname];
  13.     //echo "$present";
  14.     $count = 0;
  15.     while ($line = mysql_fetch_array($result, MYSQL_ASSOC)){
  16.     $present = $line[objectname];
  17.     echo '<table style="width: 250px;">';
  18.     echo '<tr>';
  19.     echo"<td>$present";
  20.     echo '<td><a id="delete" href="deleted.php?userfile=' . $present . '">delete</a>';
  21.     echo '</tr>';
  22.     $count++;
  23. }
  24.     echo '</table>';
  25. ?>
  26.  
Dec 21 '08 #1
3 1144
pbmods
5,821 Expert 4TB
Heya, Simon.

To do this, you'll want to set up an ACL to allow Users to access files.

Since this will be a many-to-many relationship, you'll need to set up a separate table mapping Users to images. Something along the lines of:

Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE `ACL-UserImage`
  2. (
  3.     `UserID`  BIGINT UNSIGNED NOT NULL
  4.   , `ImageID` BIGINT UNSIGNED NOT NULL
  5.   , UNIQUE KEY `UserID-ImageID`(`UserID`, `ImageID`)
  6.   , INDEX(`ImageID`)
  7. );
  8.  
When determining whether a User has permission to access the file, check `ACL-UserImage` to see if you can find a match for that User/image combination.
Dec 22 '08 #2
simon2x1
123 100+
thank for your answer but it did not solve the problem i need you to tell me what to add to my code that will make it perform the function of sharing files with another user or an adjustment to my code. this is my table
Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE `store` {
  2. `id` INT NOT AUTO_INCREMENT PRIMARY KEY,
  3. `Objectname` VARCHAR(35) NOT NULL,
  4. `size` INT NOT NULL
  5. `pick` VARCHAR(20) NOT NULL,
  6.  }   
Objectname --- name of object uploaded
pick---- name of user that upload
Jan 14 '09 #3
pbmods
5,821 Expert 4TB
To see if a User has permission to view an image:

Expand|Select|Wrap|Line Numbers
  1. $db->query("SELECT 1 FROM `ACL-UserImage` WHERE `UserID` = $userID and `ImageID` = $imageID LIMIT 1");
If the query returns a row, then the User has permission to view the image (because a record exists for that User/Image combination). If it doesn't return any rows, then the User does not have permission to view the image.
Jan 14 '09 #4

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

Similar topics

9
by: Andrew Shitov | last post by:
I have to copy files from one network share folder to another (both are on different remote machines). Server running this asp.net appllication is not configurable (except web.config), while...
3
by: rfontaine | last post by:
I have a virtual directory on IIS 5.0 to a remote share on a Windows 2003 file server. The "connect as" is a domain user account. The share as read permission for everyone and the NTFS permission...
11
by: Andre | last post by:
Hi, I have ASP.NET application running on standalone (not part of the domain) Windows 2003. I use forms authentication for my application. The problem I have is that I need to create and read...
2
by: felecha | last post by:
I'm working on a system that has a several computers that run an alerting system. There are 2 "Host" machines that have no user interface, and one "Admin" station that has an Administrator's...
2
by: Johnny Fugazzi | last post by:
I would like to access a network share from my vb.net application. I do not want to map a drive to the share, however. I would also like to specifiy a user credential to use when connecting to...
3
by: Carl | last post by:
Using VB .NET how can I enable my program to access a share on another machine and pass the user name and password. I have a computer and share, say "\\computer\share" so I can copy files from it...
6
by: P4trykx | last post by:
Hello I hace a code that opens a file on a windows share. \\comp1\folder1\file.txt Folder1 has full access for Everyone. I can open it from explorer on my computer (my user isn't on set the...
5
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I am trying to accesss a Mapped Drive from my asp.net code running on IIS 6.0. I am using a FileUpload control and fileUpload.SaveAs() to save the file to the server. I want to save the file to...
1
by: JoeyNic | last post by:
I am working on an application where a web service (on the web tier) calls another web/gateway service (on the app tier). This then needs to save a file to a UNC share on a file server in our...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.