Glad to see I'm not the only one with a warped sense of humour.
It was that miserable users mod for VB which set me off on the idea.
You are not logged in. Please login or register.
PunBB Forums → Posts by MattF
Glad to see I'm not the only one with a warped sense of humour.
It was that miserable users mod for VB which set me off on the idea.
I'm confused, if someone logs out how can you track them? The cookie is set back to the guest cookie.
And why would you want to? Since anyone could put any ID there and you would have no way to authenticate it, what would you use it for?
It's not for tracking per se, more for annoying. I've altered the set_cookie function to add the users group when the cookie is created, as in that modified code I posted above. It's to work in conjunction with a script which literally screws up their forum browsing, (for wont of a better description), in a random'ish fashion. Which is why I wanted the consistency whether they are logged in or not. I would prefer for the penny not to drop, if possible.
And why, might you ask? It's an alternative to outright banning. It's intended to keep their account active so they can still log in and do everything else, but to just annoy the hell out of them through induced time lags, redirections, blank pages and error pages. It's for those special cases where the user would merely create another account if they were banned, so rather than doing a daily/weekly/fortnightly banning session on them when they see fit to have another trolling session, it's to try and deter them from coming online by more subtle means. Sad, I know, but what can I say?
It isn't necessary to start a seperate query, but to call for the group title in the same query. I'll check up on the error, and thanks .
I've done roughly the same principle on mine, but due to being naff at the more indepth db semantics, I'd ended up doing another lookup to pull the info down. Hope you don't mind me copying your lookup to use in mine?
No, it's always available.
You had me worried there for awhile. I thought I'd overlooked something blindingly obvious, (again), and done all that alteration for nowt.
Had a look at my first post and realised it was a tad scant on description. The reason for this is so that I can track the users actual group rather than just pulling the guest gid if they're not logged in, so that a script can do it's work regardless of their online status. Double checked the pun_user gid just to be certain. Is the cookie, therefore, the best way to achieve that end? It seems to be working fine on test, but obviously, if there's a better method I've overlooked. Btw, none of those cookie alterations will have a detrimental effect on anything will they, if that is the only method?
Thanks once again.
Matt
But is not the group_id that of the guest group, (3), once they log out? I initially tried it using $pun_user['g_id'] and once logged out, they never triggered the scripts gid check.
Apologies. I thought it covered feature requests in general.
That var isn't available unless they're logged in, is it?
If you do a search for Quaker and Bingiman's frontpage index mod, that includes subject/message truncation and all the other gubbins.
elliott wrote:$db_prefix = '';
you have no $db_prefix = ''
The db prefix is not required to be anything other than it is. That is merely for identifying different tables if you do multiple installs within the same db.
Think I may have figured this one. Just wanting to check on a couple of points, however. Firstly, will calling this each time from header.php lead to performance/load problems at all? Is there a better way to do it? The cookie settings don't appear to be available from within header.php by default, or have I missed something?
if ($pun_user['is_guest'] && isset($_COOKIE[$cookie_name]))
{
list(, , $header['group_id']) = @unserialize($_COOKIE[$cookie_name]);
}
Also could I just check that I haven't cocked anything up with these changes. These are all the instances I've changed with regards to the cookie settings:
include/functions.php: $cookie = array('user_id' => 1, 'password_hash' => 'Guest', 'group_id' => '3');
include/functions.php: list($cookie['user_id'], $cookie['password_hash'], $cookie['group_id']) = @unserialize($_COOKIE[$cookie_name]);
include/functions.php: pun_setcookie(0, random_pass(8), 3, $expire);
include/functions.php:function pun_setcookie($user_id, $password_hash, $group_id, $expire)
include/functions.php: setcookie($cookie_name, serialize(array($user_id, md5($cookie_seed.$password_hash), $group_id)), $expire, $cookie_path, $cookie_domain, $cookie_secure, true);
include/functions.php: setcookie($cookie_name, serialize(array($user_id, md5($cookie_seed.$password_hash), $group_id)), $expire, $cookie_path.'; HttpOnly', $cookie_domain, $cookie_secure);
login.php: pun_setcookie($user_id, $form_password_hash, $group_id, $expire);
login.php: pun_setcookie(1, random_pass(8), $pun_user['g_id'], time() + 31536000);
profile.php: pun_setcookie($pun_user['id'], $new_password_hash, $pun_user['g_id'], $expire);
profile.php: pun_setcookie($id, $db->result($result), $pun_user['g_id'], ($form['save_pass'] == '1') ? time() + 31536000 : 0);
register.php: pun_setcookie($new_uid, $password_hash, $initial_group_id, ($save_pass != '0') ? $now + 31536000 : 0);
Btw, just on a slight sidetrack, is there any reason other than a propogated mis-spell that $initial_group_id is actually set as $intial_group_id, originally?
Thanks again,
Matt
Looks quite nice. The blue defines the seperate sections nicely. One point, however. You have an errant </noscript> tag in your footer.php file, by the looks of it.
Also, surely you must at least have to do a gid query for the username colouring?
Wouldn't this thread have been better placed in 'Feature requests'?
Am I correct in the assumption that when logged in, the cookie stores the uid and password, but when browsing as guest it just stores the uid of guest, or am I way off the mark again? I'm now getting onto the point of the actual question. Is there any way to store the group_id in the cookie and keep it intact whether the user is browsing as guest or logged in?
Cheers,
Matt
Thanks for the advice Smartys. That method has worked a treat.
have you seen my member selection in my register.php?
I saw mention of it over on Punlancer. Not had chance to have a peek at it yet though.
Cheers. I had a feeling I'd overlooked something again. It is just that one function I need to do it in, is it not? The others all relate to logged in users?
Thanks again,
Matt
Just another quickie. In the set_default_user function, would there be any side effects I've overlooked by changing the remote_address part to an if else where the user agent is used as the ident if it matches certain criteria, or else the I.P is used as normal if not? Also, that would be the only place I'd need to do the if/else statement, would it not?
Thanks again,
Matt
I knew I'd track this devil down one day. It was the redirect function causing it. I needed to add the clock_array var to the global line in the redirect function. What a bugger this one has been to track down.
never mind i read the top... change o to 1
lol..
Thought it would make life easier adding the info in the file itself.
I've just updated the script slightly again. I'd forgotten to call pun_htmlspecialchars on the info printed to screen. New download link:
http://punbb.org/forums/viewtopic.php?id=17037
The last one on that thread is the most upto date version.
Try it with a straight:
.copy a {
[your css]
}
for the base link colour.
Just change this line:
$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id='.$id.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
to:
$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.idle=0) WHERE p.topic_id='.$id.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
and remove that new code you've added. That should pull up and display the guest post count too, as far as I know, unless something else affects the guest user display settings too.
See above post. 25 is throwing a timeout.
Then contact your host. The problem is at their end.
PunBB Forums → Posts by MattF
Powered by PunBB, supported by Informer Technologies, Inc.