The link only shows a number 6.
i am just looking for usergroup id number by user name search
so with mybb
here is the php code that works for differnt forum
$id=$_GET['username'];
$query = "SELECT usergroupid
AS group
FROM user
WHERE username
='{$id}'"; //SELECT the subtable name as 'group' FORM tablename WHERE username='$id'
$result = mysql_query($query);
while(($row = mysql_fetch_assoc($result)) !== false) {
$info = $row;
}
echo $info['group'];
?>
how would i convert this to mybb is the real question
I think this is what you are looking for ($username is the name of the user of which you want the usergroup)
$query = $db->simple_select("users", "usergroup", "username = '{$username}'");
$usergroup = $db->fetch_array($query)['usergroup'];
nope that did not work
PHP Parse error: syntax error, unexpected '$id' (T_VARIABLE) in on line 6
here is full code
<?php
ini_set("display_errors", 1);
include('inc/config.php')
$id=$_GET['username'];
$query = $db->simple_select("users", "usergroup", "username = '{$username}'");
$usergroup = $db->fetch_array($query)['usergroup'];
?>
(2015-08-06, 03:09 PM)rocket Wrote: [ -> ]nope that did not work
PHP Parse error: syntax error, unexpected '$id' (T_VARIABLE) in on line 6
here is full code
<?php
ini_set("display_errors", 1);
include('inc/config.php')
$id=$_GET['username'];
$query = $db->simple_select("users", "usergroup", "username = '{$username}'");
$usergroup = $db->fetch_array($query)['usergroup'];
$result = mysql_query($query);
while(($row = mysql_fetch_assoc($result)) !== false) {
$info = $row;
}
echo $info['group'];
?>
all the php script is to do is grab the user group id of username
so virus should = 4 as out put and just show number 4
keep in mind the url is for different form just looking for conversion to mybb to do the same thing
I do not know the context in which you want to use this. It is apparently a script to which parameters are passed by the GET method. But it already goes wrong because the satement:
include('inc/config.php');
did not end with a ;
(always look for these kind of errors when the error message says something about syntax errors).
Also this is not a valid include statement, that would be:
include 'inc/config.php';
It is also not clear why you need variables from the inc/config.php in this script.
When this would work, and $id would be the username, the query must be changed in:
$query = $db->simple_select("users", "usergroup", "username = '{$id}'");
basicly what i am after is just to be able to grab the usergroup number form the username entered
thanks for helping i do appetite it
here is similar of what i am looking for but only shows number this is for mybb
http://haxcore.net/forum/usergroup.php?uid=1
but when u search for the user the php script only shows number
When you want the name og the usergroup you need something like this:
global $cache, $groupscache;
if(!is_array($groupscache))
{
$groupscache = $cache->read("usergroups");
}
$usergroupname = $groupscache[$usergroup]['usertitle'];
here is what i got so far now need to figuar out how to get user group by user name here is the query that it works too
SELECT *
FROM mbb_users
WHERE usergroup =4
LIMIT 0 , 30
will disaplay all user in this group usergroup
It becomes less and less clear what you really want. Can't you give an explanation what you want to achieve?