Allowing download for registered users from the FRONTEND

Phoca Download - download manager
paxcou
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 11 Sep 2012, 13:39

Allowing download for registered users from the FRONTEND

Post by paxcou »

From the backend, I can add some files that are displayed for non registered but not accessible for downloading.
It needs to put the file as not public but registered and then check the option "unaccessible_file" to yes so it displays the file.

But from the front end i cannot :
- choose the access right (so it's by default public)
- choose to display the unaccessible files

Unfortunately, I will have many users who do not have access to backend but use the front end and i need for ALL the files to allow the display but to only allow the download to registered users.

I have try to modify the "upload files front end page" to give me the possibility to add these two fields that exist in the backend in the frontend but it's too hard for my limited knowledge.

Could you tell me how to add these options in the front end page

OR

Could you tell me how by default all the files are for registered users and displayed for non registered ?

Thanks for your great support.
paxcou
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 11 Sep 2012, 13:39

Re: Allowing download for registered users from the FRONTEND

Post by paxcou »

Temporary solution that i have decided to use as i have no other way :

I have created a php script and a cron job to execute a command which will set up the file acces to registered and the visibility of the file as visible even if the file is for registered and the user is public.

The script is :

Code: Select all

<?php
$host="localhost"; // Host name 
$username="xxxxxx"; // Mysql username 
$password="xxxxx"; // Mysql password 
$db_name="xxxxx"; // Database name 
$tbl_name="benqx_xxxxxx"; // Table name

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

$sql='UPDATE benqx_xxxxxx SET unaccessible_file=1';

$result=mysql_query($sql);
if (!$result) 
{
  echo "Erreur DB, impossible d'effectuer une requête\n";
  echo 'Erreur MySQL : ' . mysql_error();
   exit;
}	
$sql='UPDATE benqx_xxxxxx SET access=2';
$result=mysql_query($sql);
if (!$result) 
{
  echo "Erreur DB, impossible d'effectuer une requête\n";
  echo 'Erreur MySQL : ' . mysql_error();
   exit;
}	

?>

And the cron job is :

Code: Select all

php -q /xxxx/xxxx/public_html/-cron-/cronUPDATE.php
Executed twice a day.

But if someone as the solution requested in my previous message I will be more than happy to use it !
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48595
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Allowing download for registered users from the FRONTEND

Post by Jan »

Hi, yes, there is no such feature, so you will use your cron or then you need to customize the code - to change the access rights, etc. while uploading in frontend :-(

Jan
If you find Phoca extensions useful, please support the project
Post Reply