Adult Script Pro Community Forums

The forum is here for legacy reasons. No new posts will be created. User registration is disabled! If you have any questions, please email us or check https://www.adultscriptpro.com for more details!

You are not logged in.

#1 2012-07-01 13:34:52

Tenche
Member
Registered: 2012-06-30
Posts: 46

Premium only video uploading / Cookie question

After research, I've found what I need I think but still have some questions.

I want to disable the Upload button and link for a user who is not premium. When a non-premium user clicks it, it just takes them to the home page and says you're already logged in.

Therefor, I want to use modules/user/components/login.php to set a cookie saying whether a user is premium or not.

In login.php at line 105 I see:

if (isset($remember) && $remember == 'on') {
        VCookie::set('username', md5($user['username']), (30*86400));
        VCookie::set('password', $user['password'], (30*86400));
}

I can set it to:

if (isset($remember) && $remember == 'on') {
        VCookie::set('username', md5($user['username']), (30*86400));
        VCookie::set('password', $user['password'], (30*86400));
	VCookie::set('premium', $user['premiumornot'], (30*86400));
}

But the premiumornot section is what I'm wondering about. How does the software check for premium? If someone can clarify I can set this up.

Last edited by Tenche (2012-07-01 13:54:03)

Offline

#2 2012-07-01 15:00:06

symtab
Administrator
Registered: 2010-08-23
Posts: 7,501
Website

Re: Premium only video uploading / Cookie question

It checks if the $_SESSION['group_id'] is the Premium group and then it checks if the user has enough credit/subscription valid. If you only want to allow premium users to upload, edit modules/video/components/upload.php and add VAuth::check('Registered');


Adult Scripts: Adult Script Pro - Adult Search Script
Adult Advertising/Traffic: Plug Rush - EXOClick - PopAds

Offline

#3 2012-07-01 15:12:56

Tenche
Member
Registered: 2012-06-30
Posts: 46

Re: Premium only video uploading / Cookie question

I may not have explained what I'm trying to do properly. I want to REMOVE the upload button and link from the site if they are not Premium.

Can I use VAuth::check('Premium'); ?

Offline

#4 2012-07-01 15:52:19

THS
Member
Registered: 2012-02-02
Posts: 313
Website

Re: Premium only video uploading / Cookie question

You will need to wrap the button in an if statement that checks the group_id from the session array.  If it equals premium then show the button.  Do not use a cookie for this as that can be bypassed extremely easy.

Last edited by THS (2012-07-01 15:53:04)

Offline

#5 2012-07-01 16:31:15

Tenche
Member
Registered: 2012-06-30
Posts: 46

Re: Premium only video uploading / Cookie question

Correct, which is what I'm doing. I'll work on this later, thanks again.

Offline

#6 2012-07-01 19:41:01

symtab
Administrator
Registered: 2010-08-23
Posts: 7,501
Website

Re: Premium only video uploading / Cookie question

In the templates/your-template/header.tpl.php you can have:

<?php if (VAuth::group('Premium')): ?>
html code here
<?php endif; ?>

Adult Scripts: Adult Script Pro - Adult Search Script
Adult Advertising/Traffic: Plug Rush - EXOClick - PopAds

Offline

#7 2012-07-01 21:12:17

Tenche
Member
Registered: 2012-06-30
Posts: 46

Re: Premium only video uploading / Cookie question

Wow! It's identical to the one I wrote. Just what I needed. Thanks!

Offline

#8 2012-07-04 12:52:03

Tenche
Member
Registered: 2012-06-30
Posts: 46

Re: Premium only video uploading / Cookie question

Got a problem. Since the upload button in the menu still shows, I'd like to know the best method of achieving it's hidden status for Registered/non-premium users. I've looked in the extend\plugins\menu_main.plugin.php file and found where it handles some of the upload button, but I'm not sure what would be the best method of hiding it using the VAuth::group('Premium') method.

Any insight would be appreciated.

Thanks again!

Offline

#9 2012-07-04 14:31:05

symtab
Administrator
Registered: 2010-08-23
Posts: 7,501
Website

Re: Premium only video uploading / Cookie question

Change this:

        $url    = ($link['type'] == 'int') ? RELATIVE_URL.$link['link'] : $link['link'];
        $target = ($link['target'] != 'none') ? ' target="_'.$link['target'].'"' : '';
        $active = ($link['current'] == $tpl->menu) ? ' class="active"' : '';
        $title  = ($link['title'] != '') ? ' title="'.htmlspecialchars($link['title'], ENT_QUOTES, 'UTF-8', FALSE).'"' : '';
        $upload = ($link['current'] == 'upload') ? ' class="upload"' : '';
        $name   = ($lang == 'en-US') ? strtoupper($link['name']) : utf8_strtoupper(__($link['lang']));
        $menu[] = '<li'.$upload.'><a href="'.$url.'"'.$active.$title.$target.'>'.htmlspecialchars($name, ENT_QUOTES, 'UTF-8', FALSE).'</a></li>';

to:

        $url    = ($link['type'] == 'int') ? RELATIVE_URL.$link['link'] : $link['link'];
        $target = ($link['target'] != 'none') ? ' target="_'.$link['target'].'"' : '';
        $active = ($link['current'] == $tpl->menu) ? ' class="active"' : '';
        $title  = ($link['title'] != '') ? ' title="'.htmlspecialchars($link['title'], ENT_QUOTES, 'UTF-8', FALSE).'"' : '';
        $upload = ($link['current'] == 'upload') ? ' class="upload"' : '';
        $name   = ($lang == 'en-US') ? strtoupper($link['name']) : utf8_strtoupper(__($link['lang']));
        if ($upload) {
        if (VAuth::group('Premium')) {
 $menu[] = '<li'.$upload.'><a href="'.$url.'"'.$active.$title.$target.'>'.htmlspecialchars($name, ENT_QUOTES, 'UTF-8', FALSE).'</a></li>';
        } 
        } else {
        $menu[] = '<li'.$upload.'><a href="'.$url.'"'.$active.$title.$target.'>'.htmlspecialchars($name, ENT_QUOTES, 'UTF-8', FALSE).'</a></li>';
        }

Adult Scripts: Adult Script Pro - Adult Search Script
Adult Advertising/Traffic: Plug Rush - EXOClick - PopAds

Offline

#10 2012-07-04 15:35:56

Tenche
Member
Registered: 2012-06-30
Posts: 46

Re: Premium only video uploading / Cookie question

Thank you sooo much! The logic is understood.

Offline

Board footer

Powered by FluxBB