Using an include in the website Membership Plugin

7 posts by 2 authors in: Forums > CMS Builder
Last Post: July 4, 2020   (RSS)

By gkornbluth - July 1, 2020

Hi All,

I'm trying to set an alternate post login path for mobile devices and inserted this code in the Website Membership Plugin 1.13

$post_login = 'http://pollick.net/OK/index.php' ;
require_once 'http://pollick.net/Mobile_Detect.php';
$detect = new Mobile_Detect;
// Check for mobile environment.
if($detect->isMobile()){
$post_login = 'http://pollick.net/OK/m/welcome.php';
}

$GLOBALS['WEBSITE_LOGIN_POST_LOGIN_URL'] = $post_login ;

Unfortunately require once (and include) seem to throw the following error:

Warning: require_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /home2/ngpymrmy/public_html/pollick/cmsAdmin/plugins/websiteMembership1.13/websiteMembership.php on line 19 Warning: require_once(http://pollick.net/Mobile_Detect.php): failed to open stream: no suitable wrapper could be found in /home2/ngpymrmy/public_html/pollick/cmsAdmin/plugins/websiteMembership1.13/websiteMembership.php on line 19 Fatal error: require_once(): Failed opening required 'http://pollick.net/Mobile_Detect.php' (include_path='/home2/ngpymrmy/public_html/pollick/cmsAdmin:/home2/ngpymrmy/public_html/pollick/cmsAdmin/3rdParty:.:/opt/cpanel/ea-php73/root/usr/share/pear') in /home2/ngpymrmy/public_html/pollick/cmsAdmin/plugins/websiteMembership1.13/websiteMembership.php on line 19

Any thoughts to a fix or an alternate approach?

Thanks,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By daniel - July 1, 2020

Hi Jerry,

Is there a specific reason you're using the full URL to the file, or could you try an absolute/relative path? For example, something like this should work in most installations to target a file in the web root:

require_once SCRIPT_DIR . '../Mobile_Detect.php';

(SCRIPT_DIR typically targets the CMSB folder)

Let me know if that does the trick, or if you have any other questions.

Thanks!

Daniel
Technical Lead
interactivetools.com

By gkornbluth - July 1, 2020

Thanks Daniel,

Just didn't think of it.

Oops...

Seems to be heading in the right direction. 

I'll report back tomorrow.

Thanks again,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By gkornbluth - July 2, 2020

Hi Daniel,

When I use the relative url ../Mobile_Detect.php the Website Membership plugin seems happy (the error on the plugins page goes away), but all my mobile pages throw the following error:

Warning: require_once(../Mobile_Detect.php): failed to open stream: No such file or directory in /home2/ngpymrmy/public_html/pollick/cmsAdmin/plugins/websiteMembership1.13/websiteMembership.php on line 19 Fatal error: require_once(): Failed opening required '../Mobile_Detect.php' (include_path='/home2/ngpymrmy/public_html/pollick/cmsAdmin:/home2/ngpymrmy/public_html/pollick/cmsAdmin/3rdParty:.:/opt/cpanel/ea-php73/root/usr/share/pear') in /home2/ngpymrmy/public_html/pollick/cmsAdmin/plugins/websiteMembership1.13/websiteMembership.php on line 19

And the error log shows a similar error

#4097 - E_WARNING: require_once(../Mobile_Detect.php): failed to open stream: No such file or directory
/home2/ngpymrmy/public_html/pollick/cmsAdmin/plugins/websiteMembership1.13/websiteMembership.php (line 19)
http://www.pollick.net/OK/m/welcome.php

The original concept was to set up mobile friendly pages and redirect if a mobile device is used. Everything seems to work until I encounter a password protected page. Then things go awry. 

Maybe I'm approaching this in the wrong way?

Thanks,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By gkornbluth - July 2, 2020

Hey Daniel,

Thanks for all the time you spent to answer this as completely as you did (and for your enormous expertise, of course).

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By gkornbluth - July 4, 2020

Hi Daniel,

I couldn't seem to get this to work, (probably my fault) but I did manage to get my original issue solved with careful use of mobile detect redirects on my original desktop site pages.

Sorry for the wheel spin.

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php