PDA

View Full Version : Parse error in banning.php


zemic
02-16-2005, 09:17 AM
Parse error: parse error, unexpected T_STRING in /home/fhlinux199/k/kroozing.com/user/htdocs/forum/modcp/banning.php on line 279

I get that error message when I open banning.php . "View Banned Users" link under "Users" menu in Admin CP.

Any ideas?

I've checked the instructions and it seems like I've copied it correctly :s

sv1cec
02-16-2005, 12:05 PM
Parse error: parse error, unexpected T_STRING in /home/fhlinux199/k/kroozing.com/user/htdocs/forum/modcp/banning.php on line 279

I get that error message when I open banning.php . "View Banned Users" link under "Users" menu in Admin CP.

Any ideas?

I've checked the instructions and it seems like I've copied it correctly :s
Here is what my file looks like, in that area. Compare it with yours.


// there is already a record - just update this record
$DB_site->query("
UPDATE " . TABLE_PREFIX . "userban SET
adminid = $bbuserinfo[userid],
bandate = " . TIMENOW . ",
liftdate = $liftdate,
reason = '" . addslashes($reason) . "'
WHERE userid = $user[userid]
");
}
else
{
// insert a record into the userban table
$DB_site->query("
INSERT INTO " . TABLE_PREFIX . "userban
(userid, usergroupid, displaygroupid, customtitle, usertitle, adminid, bandate, liftdate, reason)
VALUES
($user[userid], $user[usergroupid], $user[displaygroupid], $user[customtitle], '" . addslashes($user['usertitle']) . "', $bbuserinfo[userid], " . TIMENOW . ", $liftdate, '" . addslashes($reason) . "')
");
}

// update the user record
$DB_site->query("
UPDATE " . TABLE_PREFIX . "user SET
$bantitlesql
usergroupid = $usergroupid,
displaygroupid = 0
WHERE userid = $user[userid]
");

define('CP_REDIRECT', 'banning.php');
if ($period == 'PERMANENT')
{
print_stop_message('user_x_has_been_banned_permane ntly', $user['username']);
}
else
{
print_stop_message('user_x_has_been_banned_until_y ', $user['username'], vbdate("$vboptions[dateformat] $vboptions[timeformat]", $liftdate));
}


Rgds

Aceman
05-23-2005, 02:04 PM
It's amazing what leaving out a ";" can do to an application.

Aceman

sv1cec
05-23-2005, 06:16 PM
Indeed!!! Quite amazing!

heynurse
05-27-2005, 09:09 AM
I don't have any TABLE_PREFIX's in my db, how do I update my code so it it doesn't read TABLE_PREFIX in the banning.php file?

Thanks

Here is what my file looks like, in that area. Compare it with yours.


// there is already a record - just update this record
$DB_site->query("
UPDATE " . TABLE_PREFIX . "userban SET
adminid = $bbuserinfo[userid],
bandate = " . TIMENOW . ",
liftdate = $liftdate,
reason = '" . addslashes($reason) . "'
WHERE userid = $user[userid]
");
}
else
{
// insert a record into the userban table
$DB_site->query("
INSERT INTO " . TABLE_PREFIX . "userban
(userid, usergroupid, displaygroupid, customtitle, usertitle, adminid, bandate, liftdate, reason)
VALUES
($user[userid], $user[usergroupid], $user[displaygroupid], $user[customtitle], '" . addslashes($user['usertitle']) . "', $bbuserinfo[userid], " . TIMENOW . ", $liftdate, '" . addslashes($reason) . "')
");
}

// update the user record
$DB_site->query("
UPDATE " . TABLE_PREFIX . "user SET
$bantitlesql
usergroupid = $usergroupid,
displaygroupid = 0
WHERE userid = $user[userid]
");

define('CP_REDIRECT', 'banning.php');
if ($period == 'PERMANENT')
{
print_stop_message('user_x_has_been_banned_permane ntly', $user['username']);
}
else
{
print_stop_message('user_x_has_been_banned_until_y ', $user['username'], vbdate("$vboptions[dateformat] $vboptions[timeformat]", $liftdate));
}


Rgds

I think I figured it out, at least I'm not getting any errors when I try to access banned users from the modcp?

Since I don't use Table Prefix's, all I did was delete the green portion below:

$DB_site->query("
UPDATE " . TABLE_PREFIX . "userban SET
adminid = $bbuserinfo[userid],
bandate = " . TIMENOW . ",
liftdate = $liftdate
WHERE userid = $user[userid]
");

is that right, or should I have done something else?

sv1cec
05-27-2005, 09:24 AM
Actually, you do not have to delete anything, since the part you indicate is something that vB knows, and is replaced during execution, automatically.

It's one thing to replace that, when running a query externally, and another thing to edit the files and remove that. You do not have to remove that part, your vB should work fine as it is. If you have to remove it for your vB to work, something is wrong.

Rgds

heynurse
05-27-2005, 09:37 AM
hmmmm......

Well before making the change, when I tried accessing "ban a user" in the modcp, I got an error on line 260 of the banning.php file????? I removed the " . TABLE_PREFIX . " portion that line and the error went away??? Anyways, it appears that it is working now? :)

Thanks for your great and prompt support!

sv1cec
05-27-2005, 10:50 AM
Yes, but I am sure that if you look in the file, you will find plenty of other instances where that particular piece of code is used. It's in every query that is run by the program. So it can't cause an error in one particular line and not cause the error in all the other lines. Unless of course, something is wrong with that line, somewhere else.

Rgds