Need PHP Help

by Devourz - 24-02-2016, 03:47 PM
Certified Cunt
Posts:
2,284
Joined:
Nov 2015
Likes:
244
Credits:
0
Reputation:
121
1 Year of Service
#1
OP
Posted: 24-02-2016, 03:47 PM
So i was installing Mysubscriptions for MyBB & i was going to add a usergroup thingy...

But i got this error, in this code...

Can anyone see what's wrong with the line 414?

[Image: a24d8f88bb500a302f6d5d3772332069.png]

[Image: 45c9397bcb2871d88db2c80fb6931ecf.png]


Here is the code for the whole usergroup php lines

PHP Code:
        // $query = $db->simple_select("usergroups", "gid, title", "gid != '1'", array('order_by' => 'title'));
        
foreach($cache->cache['usergroups'] as $usergroup)
        {
            if(
intval($usergroup['gid']) != && !$usergroup['isbannedgroup'])
            {
                
$usergroup_options[$usergroup['gid']] = $usergroup['title'];
            }
        }
        
        if(isset(
$mybb->input['price_options']))
        {
            
$forevs = array();
            
$others = array();
            foreach(
$mybb->input['price_options'] as $_id => $opt)
            {
                if(empty(
$mybb->input['delete_price'][$_id]))
                {
                    if(
intval($opt['l']) < 1$forevs[] = $opt;
                    else 
$others[] = $opt;
                }
            }
            if(!empty(
$forevs))
            {
                
$c = array();
                foreach(
$forevs as $key => $val)
                {
                    
$c[$key] = $val['c'];
                }
                
array_multisort($cSORT_ASC$forevs);
            }
            if(!empty(
$others))
            {
                
$c $l $lt = array();
                foreach(
$others as $key => $val)
                {
                    
$c[$key] = $val['c'];
                    
$l[$key] = $val['l'];
                    
$lt[$key] = $val['lt'];
                }
                
array_multisort($ltSORT_ASC$lSORT_ASC$cSORT_ASC$others);
            }
            
$mybb->input['price_options'] = array();
            foreach(
$others as $a$mybb->input['price_options'][] = $a;
            foreach(
$forevs as $a$mybb->input['price_options'][] = $a;
        }
        
        if(
$mybb->request_method == 'post')
        {
            if(!isset(
$mybb->input['add']))
            {
                
$name $db->escape_string($mybb->input['name']);
                if(empty(
$name) || rtrim($name) == ''$errors[] = $lang->error_empty_name;
                
                
$price $db->escape_string(serialize($mybb->input['price_options']));
                
                
$currency $db->escape_string($mybb->input['currency']);
                if(!
in_array($currencyarray_keys($currency_options))) $errors[] = $lang->error_invalid_currency;
                
                
$new_group intval($mybb->input['new_group']);
                if(!
in_array($new_grouparray_keys($usergroup_options))) $errors[] = $lang->error_invalid_group;
                
                if(!empty(
$mybb->input['accepted_groups']))
                {
                    foreach(
$mybb->input['accepted_groups'] as $group)
                    {
                        
$gid intval($group['gid']);
                        if(
in_array($gidarray_keys($usergroup_options)))
                        {
                            
$accepted[] = $gid;
                        }
                    }
                }
                
$accepted = (empty($accepted) ? 'all' implode(','$accepted));
                
                
$item_name $db->escape_string($mybb->input['item_name']);
                if(!
ctype_alnum($item_name) || count($item_name) > 127$errors[] = $lang->error_invalid_item_name

Rehab is for quitters
Prime
Posts:
515
Joined:
May 2015
Likes:
11
Credits:
503
Reputation:
22
2 Years of Service
#2
Posted: 24-02-2016, 04:07 PM
That's just a warning, you can choose to ignore that if you want.
Shouldn't stop the code from working, all it's doing is trying to access a string as if it were an array.
Strings are able to be treated as arrays of single characters in PHP anyway.
Certified Cunt
Posts:
2,284
Joined:
Nov 2015
Likes:
244
Credits:
0
Reputation:
121
1 Year of Service
#3
OP
Posted: 24-02-2016, 04:12 PM (This post was last modified: 24-02-2016, 04:21 PM by Devourz.)
(24-02-2016, 04:07 PM)LikeAlcohol Wrote: That's just a warning, you can choose to ignore that if you want.
Shouldn't stop the code from working, all it's doing is trying to access a string as if it were an array.
Strings are able to be treated as arrays of single characters in PHP anyway.

But when i get the error & proceed anyways, it doesn't work to set what usergroup anyways, so it's stopping it from working & just de-select my option

SOLVED
The last reply on this thread is older than a month. Please do not unnecessarily bump it.
Register an account or login to reply
Create an account
Create a free account today and start posting right away. It only takes a few seconds.
Login
Log into an existing account.
1 Guest(s)