Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Parse error using Control modules by...
Page:
1
Parse error using Control modules by IP address recipe
Parse error using Control modules by IP address recipe
Hi,
I am trying to use the Control modules by IP address recipe on Joomla! 2.5.8. I have tried metamod 3.12 and 3.13b.
Using the single IP recipe:
Code:
if ( $core_genius->check( "client_ip = 123.22.33.44" ) ) return 56;
Works fine (obviously changing the ip and module id), however the IP range recipe:
Code:
// split ip address into numbers, we test individually
$ip_numbers = explode( ".", $core_genius->info( "client_ip" ) );
if ($ip_numbers[0] == 123 &&
$ip_numbers[1] == 22 &&
$ip_numbers[2] == 33 &&
$ip_numbers[3] >= 50 &&
$ip_numbers[3] <= 55) return 12;
Returns:
Code:
Parse error: syntax error, unexpected ';' in C:\xampp\htdocs\helpdesk\modules\mod_metamod\helper.php(628) : eval()'d code on line 3
I have tested using the desired range and article ID as well as using the code as provided. As well as trying both the Jom genuis and pre-jom genis code.
Any help would be greatly appreciated
Administrator has disabled public posting
Re: Parse error using Control modules by IP address recipe
Hi,
looks like some errors on the example page... sorry about that, will get those fixed ASAP.
Meanwhile, you could rewrite your code as follows:
Code:
// split ip address into numbers, we test individually
$ip_numbers = explode( ".", $core_genius->info( "client_ip" ) );
if ($ip_numbers[0] == 123 and
$ip_numbers[1] == 22 and
$ip_numbers[2] == 33 and
$ip_numbers[3] >= 50 and
$ip_numbers[3] <= 55) return 12;
Hope that helps,
Stephen
Administrator has disabled public posting
Administrator has disabled public posting
Page:
1
- Index
- » MetaMod
- » MetaMod General Support
- » Parse error using Control modules by...
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5942
- Total Posts Today:
- 1
- User Info:
- Total Users:
- 7624
- Newest User:
- borger3298
- Members Online:
- 1
- Guests Online:
- 198
- Online:
- borger3298
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked