Saturday, August 20, 2022
HomeWordPress Developmentplugins - Code for distinctive consumer go to depend on each web...

plugins – Code for distinctive consumer go to depend on each web page WordPress


I’m working a venture and I’ve determined to develop a customized plugin for it and I need it to point out each customers web page go to depend someplace within the footer.(For instance, if a consumer clicks on a web page, it might present within the Footer – “you’ve gotten visited this web page 1 time” and if he refreshes it might present 2 instances)

Till now I’ve acquired one thing to work nevertheless it reveals the full customers on-line on the web page, however I wish to retailer in a few weeks lengthy cookie the consumer’s exercise and preserve observe of his web page visits.

    //  Get consumer on-line
    public static perform WTVCP_get_users_online()
    {
        $base      = "base_sessions.dat";
        $last_time = time() - 120;
        contact($base);
        $file = file($base);

        $output="";

        $id = session_id();
        if ($id !== '') {
            $res_file = [];

            foreach ($file as $line) ', $line);

                if ($utime > $last_time) ' . trim($utime) . PHP_EOL;
                
            

            $res_file[$id] = trim($id) . '|' . time() . PHP_EOL;
            file_put_contents($base, $res_file, LOCK_EX);
            $count_users = depend($res_file);
            $count_users = (string)number_format($count_users);
            $symbols     = str_split($count_users);

            foreach ($symbols as $image) {
                if ($image == ',') {
                    $output .= ",";
                } else {
                    $output .= "<span>$image</span>";
                }
            }
        }

        return $output;
    }

that is my most important code that reveals the consumer depend proper now. Is there any strategy to modify it to make it based mostly on Distinctive classes or one thing like that?
Any recommendation can be a lot appreciated. Thanks!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments