Jump to content

Restricted Access to downloads


Adamski

Recommended Posts

Hi,

 

I'm going to be restricting access to the downloads page to logged in clients only.

 

I would also like to take that a step further and restrict access to certain downloads depending on what products they have purchased.

 

Is this possible? And if so where would I start? First, checking to see if client is logged in, if they are then checking which products they have, and then displaying each product related download. If not logged in display "You must be logged in to see this page / message".

 

The initial if else is fine, but not quite sure how to do the bit in the middle! Any pointers?

 

Thanks,

 

Adam

Link to comment
Share on other sites

After realising I was editing the wrong template I have now got to this stage.. code from downloadscat.tpl

 


{if $downloads && $dlcats.id ==9}




TEST





{elseif $downloads && $dlcats.id !=9}




[b]{$LANG.downloadsfiles}[/b]</p>

<table width=100%>
<blockquote>
{foreach key=num item=download from=$downloads}
<tr><td>


{$download.type} [url="{$download.link}"][b]{$download.title}[/b][/url]
{$download.description}
<font style="color:#A8A8A8;font-size:10px;">{$LANG.downloadsfilesize}: {$download.filesize}</font>

</p>
</td></tr>
{/foreach}
</table>

{else}

<p align=center>[b]{$LANG.downloadsnone}[/b]</p>

{/if}

 

I'm not sure if "$dlcats.id ==9" is right though so if someone could advise that would be great?

 

Basically at this point I just want to display "test" if the download cat id is 9. At the moment it just displays the available downloads!

 

Thanks,

 

Adam

Link to comment
Share on other sites

ok i've made progress on this but was wondering if there is way of still using this

 

<table width=100%>

<blockquote>

{foreach key=num item=download from=$downloads}

<tr><td>



{$download.type} [url="{$download.link}"][b]{$download.title}[/b][/url]
{$download.description}
<font style="color:#A8A8A8;font-size:10px;">{$LANG.downloadsfilesize}: {$download.filesize}</font>

</p>

</td></tr>

{/foreach}

</table>

 

but specifying it to only display one thing depending on the product. Not the end of the world as I can do it all manually - would just be a much neater solution ;)

 

Ad

Link to comment
Share on other sites

Hi,

 

Does anyone know how I can use a smarty string when querying the databse?

 

I want to do this:

 

$client_query = "SELECT * FROM tblhosting WHERE userid = '$clientsdetails.id''";

 

but it doesn't work.... i'm wondering if I need to do something to it first?

 

Cheers

 

Adam

Link to comment
Share on other sites

{if $downloads && $smarty.get.catid == 9}


{php}
$this->assign('clientid', $clientsdetails.id);
$client_query = "SELECT * FROM tblhosting WHERE userid = '$clientid'";
$result = mysql_query($client_query) or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());
$this->assign('package', $row);
{/php}



success</p>


{elseif $downloads && $smarty.get.catid != 9}







[b]{$LANG.downloadsfiles}[/b]</p>



<table width=100%>

<blockquote>

{foreach key=num item=download from=$downloads}

<tr><td>



{$download.type} [url="{$download.link}"][b]{$download.title}[/b][/url]
{$download.description}
<font style="color:#A8A8A8;font-size:10px;">{$LANG.downloadsfilesize}: {$download.filesize}</font>

</p>

</td></tr>

{/foreach}

</table>



{else}



<p align=center>[b]{$LANG.downloadsnone}[/b]</p>



{/if}

 

It works when i substitute $clientid with the actual number ;)

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated