Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

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

junkman690
Beginner Modder
ranks
useravatar
Offline
2 Posts
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

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3312 Posts
User info in posts
Administrator has disabled public posting

Re: Parse error using Control modules by IP address recipe

(example fixed on the recipe page now)

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3312 Posts
User info in posts
Administrator has disabled public posting

Re: Parse error using Control modules by IP address recipe

That works just as I was hoping. Thankyou for the great product and support

junkman690
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1666
Total Polls:
6
Total Posts:
5909
Dormant:
User Info:
 
Total Users:
10091
Newest User:
lamanaudio
Members Online:
3
Guests Online:
240


Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked