Jump to content

Restrict download page only to logged in pilots


Recommended Posts

Posted

how can i restrict access to my downloads page only to logged in pilots.

i tried this

<?php

if(!Auth::LoggedIn())

{

?>

<li><a href="<?php echo SITE_URL ?>/index.php/registration"><strong>Register</strong></a></li>
   <li><a href="<?php echo url('/login'); ?>"><strong>Pilot Log In</strong></a></li>

<?php

}

else

{

?>

<li><a href="<?php echo SITE_URL ?>/index.php/downloads"><strong>Downloads</strong></a></li>




<?php

but that doesnt work

Posted

how can i restrict access to my downloads page only to logged in pilots.

i tried this

<?php

if(!Auth::LoggedIn())

{

?>

<li><a href="<?php echo SITE_URL ?>/index.php/registration"><strong>Register</strong></a></li>
   <li><a href="<?php echo url('/login'); ?>"><strong>Pilot Log In</strong></a></li>

<?php

}

else

{

?>

<li><a href="<?php echo SITE_URL ?>/index.php/downloads"><strong>Downloads</strong></a></li>




<?php

but that doesnt work

Switch the

<li><a href="<?php echo SITE_URL ?>/index.php/registration"><strong>Register</strong></a></li>
<li><a href="<?php echo url('/login'); ?>"><strong>Pilot Log In</strong></a></li>

With the

<li><a href="<?php echo SITE_URL ?>/index.php/downloads"><strong>Downloads</strong></a></li>

?

  • Moderators
Posted

Just add this at the top of that tpl,

<?php
if(Auth::LoggedIn() == false)
{
  echo 'Please login to view this page.';
  return;
}
?>

You can also hide in the nav bar by putting the line under the section if logged in.

Posted

is there a way to prevent access to the index page. specifically the downloads. i tried to add .zip tothe htaccess file and that worked, but then when legitimate pilots tried to d/l the got the 404 error?

Posted

Mark is right. Downloads page is, by default, only available to logged in users.

Open up core/modules/Downloads/Downloads.php and check, it should look something like this:

class Downloads extends CodonModule
{

public function index()
{
	if(!Auth::LoggedIn())
	{
		echo 'You must be logged in to access this page!';
		return;
	}

	$this->set('allcategories', DownloadData::GetAllCategories());
	$this->render('downloads_list.tpl');
}

And so on.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...