PHP Changes to WOL for New Forum Home Page


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
# 1  
PHP Changes to WOL for New Forum Home Page

Wrote some PHP code today to make the Who Is Online (WOL) in the forums work properly with the new home page:

Wrote this global plugin to add the location to both the user table (for members) and session table (for guests + registered users)

Code:
<?php
if (THIS_SCRIPT != 'misc' and THIS_SCRIPT != 'ajax') { 

    $mylocation = THIS_SCRIPT; 
    if (strlen($mylocation) < 2) { 
        $mylocation = "unknown"; 
    } 

    if ($UNIX.com->userinfo['userid'] > '0') { 

        $query = "UPDATE " . TABLE_PREFIX . "user SET parentemail = '" . $mylocation . "' WHERE userid = " . $UNIX.com->userinfo['userid']; 
        if (false) { 
            error_log("UID: " . $UNIX.com->userinfo['userid'] . ' loc_cookie ' . $mylocation . " query: " . $query . "\n", 3, '/var/log/apache2/debug/cookiesetdbupdate.log'); 
        } 

        $db->query_write($query); 
    } 

    // borrowed  unused incalendar DB column  in the session table until I have a change to create a new one

    if (isset($UNIX.com->session->vars['sessionhash']) and strlen($UNIX.com->session->vars['sessionhash']) > 10) { 
        $query = "UPDATE " . TABLE_PREFIX . " session SET incalendar = '" . $mylocation . "' WHERE sessionhash = '" . $UNIX.com->session->vars['sessionhash'] . "'"; 
        if (false) { 
            error_log("UID: " . $UNIX.com->userinfo['userid'] . ' loc_cookie ' . $mylocation . " query: " . $query . "\n", 3, '/var/log/apache2/debug/cookiesetdbupdate.log'); 
        } 

        $db->query_write($query); 

    } 

}

In addition, wrote some quick PHP code for the online.php in functions_online.php:


Code:
<?php

case 'index':

        if($userinfo[userid] > '0')
        {
            $query = "SELECT lastlocation,lastactivity FROM " . TABLE_PREFIX . "user WHERE userid = ".$userinfo[userid]." ORDER BY lastactivity DESC LIMIT 1";
            $userloc = $UNIX.com->db->query_first("SELECT lastlocation,lastactivity FROM " . TABLE_PREFIX . "user WHERE userid = ".$userinfo['userid']." ORDER BY lastactivity DESC LIMIT 1");
            error_log("UID: " . $UNIX.com->userinfo['userid'] . '  loc ' . $userloc['lastlocation'] . ' Query: '.$query. "\n", 3, '/var/log/apache2/debug/online_neo.log');
        }
        else
        {
            if(strlen($UNIX.com->session->vars['incalendar']) > 10)
            $guestloc = $UNIX.com->session->vars['incalendar'];
        }

     

        if($userloc['lastlocation'] == 'home' OR $guestloc == 'home')
        {              
             $userinfo['action'] =  'Viewing Home Page - Featured Discussion';
             $userinfo['where'] = '<a href="' . $UNIX.com->options['forumhome'] . '.php' . $UNIX.com->session->vars['sessionurl_q'] . '">' . $UNIX.com->options['bbtitle'] . '</a>';
        }
        else
        {                 
            $userinfo['action'] = 'Viewing Forum Home and Stats Page';
            $userinfo['where'] = '<a href="https://www.unix.com/forum.php' . $UNIX.com->session->vars['sessionurl_q'] . '">Forums: ' .$UNIX.com->options['bbtitle'] . '</a>';
        }
                
       break;

PHP Changes to WOL for New Forum Home Page-screen-shot-2018-12-03-111631-pmpng
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

5 More Discussions You Might Find Interesting

1. What is on Your Mind?

Mobile: Advanced Forum Statistics to Forum Home Page

For mobile users, I have just added a "first beta" Advanced Forum Statistics to the home page on mobile using CSS overflow:auto; so you can swipe if you need to see more. Google Search Console mobile usability says this page is "mobile friendly" so perhaps this will be useful for some of our... (12 Replies)
Discussion started by: Neo
12 Replies

2. What is on Your Mind?

JQuery and CSS Flex Code for Responsive Forum Home Page

So far, I have completed making the home page more responsive (except for the forum stats at the top and the WOL box at the bottom, they still use scroll bars). xevV3_iZ8-s For full screen use the link below and set your YT resolution to 1080p60 HD https://youtu.be/xevV3_iZ8-s Here is... (1 Reply)
Discussion started by: Neo
1 Replies

3. What is on Your Mind?

JQuery and CSS Flex Code for Responsive WOL Page

I have just wrote this jQuery to the WOL page, so the table of users on line will not need scrollbars and will instead transform into a responsive table: <script> jQuery(document).ready(function (){ jQuery("#neo-who-flex-tcat"). css({"display":"flex","flex-flow":"row wrap", ... (0 Replies)
Discussion started by: Neo
0 Replies

4. What is on Your Mind?

Forum Update: Disabled Home Page Forum Statistics for Guests (Not Registered)

Just a quick update; to speed up the forums, I have disabled the forum statistics on the home page for non registered users. No changes for registered users. (0 Replies)
Discussion started by: Neo
0 Replies

5. Solaris

How to change home page?

Hi I am new to Sun OS I am using "SunOS **** 5.9 Generic_122300-47 sun4u sparc SUNW,Sun-Fire-15000" I have logged on as user1, I could see sar -u 5 5. Now I wanted to execute the same command to another users (e.g user2) Question-1 ----------- ... (2 Replies)
Discussion started by: sbmk_design
2 Replies

Featured Tech Videos