-2

I have a website which allows users to login through google/facebook. I want that users upload files to my website which will be stored in cloud (ie. my Google Drive or Dropbox account). And only those files will be visible to them. Is it possible to achieve this? PLease help.

  • Please read "[ask]" and the linked pages, along with "[mcve]". We need to see evidence of your effort. Did you search and read some pages? Why didn't they help? Did you write code? If not, why? If so, show us the minimum code necessary to demonstrate the problem you're having, along with the minimum input data and expected output. – the Tin Man Feb 14 '17 at 20:26

1 Answers1

0

I suggest to create a database that will contain the usernames that will be able to download the file. I think that you create a $_SESSION['username'] variable (or something similar) to remember who's logged into your site. You just need to look into your database and verify if the person that is using yor website has the complete access to your files. For example :

<?php
$host = '';
$user = '';
$pass = '';
$database = '';
$conn = new mysqli($host,$user,$pass,$database);
$sql = "SELECT * FROM permission WHERE username='".$_SESSION['username']."'";
$result = $conn->query($sql);
if($result->num_rows > 0) {
    ---ALLOW USER TO DOWNLOAD---
} else {
    echo 'You're not allowed to download the file';
}
?>
DamiToma
  • 921
  • 3
  • 9
  • 27