Area51 @ 4seven.de

Mod Base and Testarea
It is currently 23 Feb 2025, 19:31

All times are UTC + 1 hour




Post new topic TOPIC_LOCKED  [ 1 post ] 
Author Message
PostPosted: 10 May 2012, 15:30 
Offline
Tiptop
Tiptop
User avatar

Joined: 11 Feb 2008, 11:49
Posts: 241
Website status in memberlist

This Snippet shows the website reachable status in memberlist

requested by: FranckTH
request topic: http://www.phpbb.com/community/viewtopi ... &t=2155208

demo: http://4seven.bplaced.net/forum/media/member ... &sk=a&sd=a

screen:

Attachment:
website_status.png
website_status.png [ 2.42 MiB | Viewed 1747 times ]

Instruction

download:

Image Image

rightclick > save image under ...

copy: both images to root/images/

open

memberlist.php

find

Code:
$user->setup(array('memberlist', 'groups')); 


after add

Code:
// Website status in memberlist / 4seven / 2012
if ($auth->acl_get('a_'))
{

function url_reachable($domain){

$a_url     = parse_url("$domain");
$host      = $a_url['host'];
$starttime = microtime(true);
$file      = @fsockopen ("$host", 80, $errno, $errstr, 0.2);
$stoptime  = microtime(true);
$status    = 0;

if (!$file){
$status = 0;}

else{
fclose($file);
$status = ($stoptime - $starttime) * 1000;
$status = floor($status);}
    
if 
(($status != 0) && ($status < 200)){
return '<img style="position:relative;top:2px;" src="images/link_yes.png" alt="" /> <span style="color:#999999;">' . $status . ' msec.</span><br />';}
    
else{
return ($status != 0) ? '<img style="position:relative;top:2px;" src="images/link_no.png" alt="" /> <span style="color:#999999;">Timeout: ' . $status . ' msec.</span><br />' : '<img style="position:relative;top:2px;" src="images/link_no.png" alt="" /> <span style="color:#999999;">Offline or Url not exists</span><br />';}}

}
// Remove the following part, if you want it for admins only
else
{

function url_reachable($domain){

$a_url     = parse_url("$domain");
$host      = $a_url['host'];
$starttime = microtime(true);
$file      = @fsockopen ("$host", 80, $errno, $errstr, 0.2);
$stoptime  = microtime(true);
$status    = 0;

if (!$file){
$status = 0;}

else{
fclose($file);
$status = ($stoptime - $starttime) * 1000;
$status = floor($status);}
    
if 
(($status != 0) && ($status < 200)){
return '<img style="position:relative;top:2px;" src="images/link_yes.png" alt="" /> ';}
    
else{
return '<img style="position:relative;top:2px;" src="images/link_no.png" alt="" /> ';}}

}
// Remove the part from last comment to here, if you want it for admins only
// Website status in memberlist / 4seven / 2012      


find

Code:
        'U_WWW'            => (!empty($data['user_website'])) ? $data['user_website'] : ''


after add

Code:
        // Website status in memberlist / 4seven / 2012
        'S_WWW_EXISTS'    => (!empty($data['user_website']) && function_exists('url_reachable')) ? url_reachable($data['user_website']) : false,
        // Website status in memberlist / 4seven / 2012     


open

styles/prosilver/memberlist_body.html

find

Code:
<!-- IF memberrow.U_WWW --><div><a href="{memberrow.U_WWW}" title="{L_VISIT_WEBSITE}: {memberrow.U_WWW}">{memberrow.U_SHORT_WWW}</a></div><!-- ENDIF -->


replace with

Code:
<!-- IF memberrow.U_WWW --><div><!-- IF memberrow.S_WWW_EXISTS -->{memberrow.S_WWW_EXISTS}<!-- ENDIF --><a href="{memberrow.U_WWW}" title="{L_VISIT_WEBSITE}: {memberrow.U_WWW}">{memberrow.U_SHORT_WWW}</a></div><!-- ENDIF --> 


clear all board- and browser-caches

note:
this is one of the fastest script for checking url availability.
it checks each [url] max. 200 msec. (0,2 sec.).
if many links are bad, the memberlist slows down.

_________________
Mod-Bot / Service-Team


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic TOPIC_LOCKED  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
[ Time : 0.015s | 24 Queries | GZIP : Off ]