Announcement

  •  » Extensions
  •  » Hostname from IP from stats page

#1 2005-01-04 03:12:44

Whiler
Member
Clichy
2004-12-24
24

Hostname from IP from stats page

As usual.. I fed up with having to launch my console to resolve the hostname from the ping when I wanna know more information... so, I write this MOD...

##############################################################
## MOD Title: Hostname from IP in stats page
## MOD Author: Whiler
## MOD Description: Popup to show the hostname from a logged IP
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: 2 Minutes
## Files To Edit: stats.vtp
## Files To Create: hostname.php
## System requirements : None
##############################################################
## MOD History:
##
##   2005-01-04 - Version 1.0.0
##      - Successfully tested with PhpWebGallery 1.3.4, PHP 4.3.3 and 4.3.10
##
##############################################################
## Before Adding This MOD To Your gallery, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN AND UPDATE ALL YOUR TEMPLATES ]------------------------------------------
#
./template/ALL YOUR TEMPLATE NAME/admin/stats.vtp
#
#-----[ BETWEEN ]------------------------------------------
#
<div style="text-align:center;margin-top:5px;">
  <!--VTP_last_day_option-->
  <a href="{#link}" style="{#style}">{#option}</a>{#separation}
  <!--/VTP_last_day_option-->
  {#stats_last_days}
</div>
#
#-----[ AND ]------------------------------------------
#
<table width="100%">
  <tr>
    <th width="1%">{#date}</th>
    <th>{#login}</th>
    <th>{#IP}</th>
    <th>{#file}</th>
    <th>{#category}</th>
    <th>{#picture}</th>
  </tr>
#
#-----[ ADD ]------------------------------------------
#
<div style="position:absolute;left:0px;top:0px;visibility:hidden;" id="datadiv">
    <iframe src="about:blank" height="0" width="0" name="dataframe"></iframe>
</div>

<script language="JavaScript">
function showHostname(lIP) {
    alert('Hostname : ' + lIP);
}

function loadHostname(lIP) {
    var hostnameResolveURL = './hostname.php?theIP='+lIP;
    if( document.layers && document.layers['datadiv'].load ) {
        document.layers['datadiv'].load(hostnameResolveURL,0);
    } else if( window.frames && window.frames.length ) {
        window.frames['dataframe'].window.location.replace(hostnameResolveURL);
    } else {
        alert( 'Doesn\'t work' );
    }
    return false;
}
</script>
#
#-----[ REPLACE ]------------------------------------------
#
  <tr>
    <td>{#date}</td>
    <td style="text-align:center;">{#login}</td>
    <td>{#IP}</td>
    <td>{#file}</td>
    <td>{#category}</td>
    <td>{#picture}</td>
  </tr>
#
#-----[ WITH ]------------------------------------------
#
  <tr>
    <td>{#date}</td>
    <td style="text-align:center;">{#login}</td>
    <td><a href="Javascript:void(0);" onClick="javascript:loadHostname('{#IP}');">{#IP}</a></td>
    <td>{#file}</td>
    <td>{#category}</td>
    <td>{#picture}</td>
  </tr>
#
#-----[ CREATE A NEW FILE ]------------------------------------------
#
.//admin/hostname.php
#
#-----[ ADD THIS CONTENT ]------------------------------------------
#
<?php
    $lIP = ereg("([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})", $theIP, $validIP) ? $validIP[0] : "Unknown" ;
    if ($lIP!="Unknown")
        $lIP = gethostbyaddr($lIP);
?>
<html>
    <head>
        <title>
            Host name
        </title>
        <script type="text/javascript"><!--
<?php
    print "var hostName = '$lIP'";
?>
        //--></script>
    </head>
    <body onload="parent.showHostname(hostName);">
Nothing 2 C here !
    </body>
</html>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM

Offline

 

#2 2005-01-25 00:10:44

ricoz
Member
2002-11-08
37

Re: Hostname from IP from stats page

## MOD Title: Hostname from IP in stats page

ce mod est t'il compatible avec ma version 1.4rc02 (les templates ne sont plus en vtp mais en tpl...)

Offline

 

#3 2005-01-25 00:20:58

Sephi
Former Piwigo Team
Suisse
2004-11-28
430

Re: Hostname from IP from stats page

Non, enfin c'est juste la structure des fichiers qui a changé... ;-)

Offline

 

#4 2005-02-01 22:07:48

Whiler
Member
Clichy
2004-12-24
24

Re: Hostname from IP from stats page

Oui.. donc aisément modifiable ;)

Offline

 

#5 2005-02-01 23:35:22

ricoz
Member
2002-11-08
37

Re: Hostname from IP from stats page

pour des cracks de la prog surement moi je debute en php...on va voir...

Offline

 

#6 2005-02-17 15:30:15

tlegras
Member
2005-02-02
177

Re: Hostname from IP from stats page

Mouais, ce n'est pas si trivial que ça, puisque la 1.4.0RC3 n'affichent plus les adresses IP. Le plus dur n'est donc pas d'integrer le mod, mais de reajouter cette fonction - pas vitale pour une gallerie photo c'est vrai, mais pour moi ça m'interesserai beaucoup.

Personne n'a encore adapte ce mod pour une 1.4?

En fait je voudrais bien pouvoir afficher les N dernières couples (IP, login) connectées (guest inclus), la date de derniere connection et donc le nom du provider associe.
Si quelqu'un à une idee rapide pour me lancer sur le sujet je suis preneur.

Thierry.

Offline

 

#7 2011-03-10 11:08:46

Whiler
Member
Clichy
2004-12-24
24

Re: Hostname from IP from stats page

tlegras wrote:

Mouais, ce n'est pas si trivial que ça, puisque la 1.4.0RC3 n'affichent plus les adresses IP. Le plus dur n'est donc pas d'integrer le mod, mais de reajouter cette fonction - pas vitale pour une gallerie photo c'est vrai, mais pour moi ça m'interesserai beaucoup.

Personne n'a encore adapte ce mod pour une 1.4?

En fait je voudrais bien pouvoir afficher les N dernières couples (IP, login) connectées (guest inclus), la date de derniere connection et donc le nom du provider associe.
Si quelqu'un à une idee rapide pour me lancer sur le sujet je suis preneur.

Thierry.

Je t'invite à regarder cette extension : AStat

Offline

 

#8 2011-03-10 11:19:18

tlegras
Member
2005-02-02
177

Re: Hostname from IP from stats page

Excellent! merci pour ta réponse rapide ;-)

Offline

 

#9 2011-03-10 11:27:16

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: Hostname from IP from stats page

tlegras wrote:

Excellent! merci pour ta réponse rapide ;-)

In English : oh great! thank you for your fast answer ;-)

Very funny :-D 5 years ago, the plugin AStat was not there, plugins were not implemented and I see that we've talked about VTP templates that have been replaced twice (first time with PHPLib, second time with Smarty)

Offline

 

#10 2011-03-10 11:42:37

tlegras
Member
2005-02-02
177

Re: Hostname from IP from stats page

Sorry for this private joke Pierrick, the fact is that by chance I met Whiler yesterday and discover we had a common hobbies and even shared a common (though uncomplete) thread :-)

Not really relevent for piwigo users indeed!

(BTW impressive the way piwigo has evolved since that time!)

Offline

 
  •  » Extensions
  •  » Hostname from IP from stats page

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact