vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Email notification when users online (https://vborg.vbsupport.ru/showthread.php?t=50608)

bobhumphries2 03-22-2003 02:35 AM

Email notification when users online
 
I'm running a vBulletin board and it would be great if I could be notified by email when certain users come online. I guess it would be like a email notification if your buddies are online, but for moderators only ie this isn't a feature that everyone needs to have on the board. I've been trying to workout how to do it, I have some db skills but little PHP skills so I'm finding it tough going. Would be very grateful if someone could give me some pointers.

TIA

filburt1 03-22-2003 02:47 AM

I'll look into it this weekend unless somebody else wants to pounce.

bobhumphries2 03-22-2003 04:54 AM

Thanks for that - really appreciate any help you have time to give.

bobhumphries2 03-23-2003 01:32 AM

I've reached a sticking point - I think I've found the section in the members.php file which creates the session entry in the db session table so I've added the following code as a test to send an email but it doesn't seem to do anything (ie I never get an email). Here's the code with my additional code at the end (I haven't included the full original code).

Really appreciate any pointers:

Bob

// ############################### start login ###############################
if ($action=="login") {
$templatesused = 'redirect_login,error_wrongpassword,error_wronguse rname';
include("./global.php");
$userid = 0;
if (isset($username)) {
// get userid for given username
if ($user=$DB_site->query_first("SELECT userid,username,password,cookieuser FROM user WHERE username='".addslashes(htmlspecialchars($username) )."'")) {
if ($user['password']!=md5($password)) { // check password
eval("standarderror(\"".gettemplate("error_wrongpa ssword")."\");");
exit;
}
$userid=$user[userid];
} else { // invalid username entered
eval("standarderror(\"".gettemplate("error_wrongus ername")."\");");
exit;
}

if ($user['cookieuser']==1) {
vbsetcookie("bbuserid",$user['userid']);
vbsetcookie("bbpassword",$user['password']);
}

$DB_site->query("DELETE FROM session WHERE sessionhash='".addslashes($session[dbsessionhash])."'");

$session['sessionhash']=md5(uniqid(microtime()));
$session['dbsessionhash']=$session['sessionhash'];
$DB_site->query("INSERT INTO session (sessionhash,userid,host,useragent,lastactivity,st yleid) VALUES ('".addslashes($session['sessionhash'])."','".intval($userid)."','".addslashes($sessio n['host'])."','".addslashes($session['useragent'])."','".time()."','$session[styleid]')");
vbsetcookie("sessionhash",$session['sessionhash'],0);
$username = $user['username'];
}

// ########################### hack to email if certain user come online #################


vbmail("bob@bob.com","VBTest","Online");

afterlab 03-23-2003 03:36 AM

It would be best to run it from sessions.php, because not all members have to login in order to be considered online. Most are "cookied" so they can just drop by the forums and be "online".

I can get this hack done in a few minutes, but it seems filburt has this one. Good luck with it. :)

bobhumphries2 03-24-2003 03:47 AM

Thanks for the tip I'll put in inthe session.php file as well - I could do with a little help - whenever I run this on the server I get the error: call to undefined fuction vbmail:

I can see that the function is stored in /admin/functions.php and referenced by global.php

However if I include global.php just before I make the call the vbmail I get the error: Fatal error: Cannot redeclare regstring - previously declaired in...

Any pointers anyone. Seems like I can't use the vbmail function as it hasn;t been included but when I try and include the library that has it - it tells me that it can't as other members of the library have already been declaired - confused :(

TIA

Bob

bobhumphries2 03-24-2003 05:26 AM

Finally go it to work but ended up using just the mail command rather than the vbmail. Would still be interested why I had the vbmail problems if anyone knows.


All times are GMT. The time now is 08:39 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00949 seconds
  • Memory Usage 1,721KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete