Precedente :: Successivo |
Autore |
Messaggio |
mdweb Dio maturo


Registrato: 18/12/07 16:59 Messaggi: 4412
|
Inviato: 12 Feb 2008 14:44 Oggetto: |
|
|
si ma perchè non usi quello che ti ho dato io??? |
|
Top |
|
 |
mdweb Dio maturo


Registrato: 18/12/07 16:59 Messaggi: 4412
|
Inviato: 12 Feb 2008 14:48 Oggetto: |
|
|
clicca in script poi contatori e cerca la voce contatore utenti onlie...ci sono 2 soluzioni o file di testo o mysql |
|
Top |
|
 |
sevenjeak Semidio


Registrato: 04/02/08 22:05 Messaggi: 308 Residenza: Roma
|
Inviato: 12 Feb 2008 18:55 Oggetto: |
|
|
ho gia provato a vedere quello, ma non mi va |
|
Top |
|
 |
mdweb Dio maturo


Registrato: 18/12/07 16:59 Messaggi: 4412
|
Inviato: 12 Feb 2008 21:05 Oggetto: |
|
|
che tipo di errore ti da? |
|
Top |
|
 |
sevenjeak Semidio


Registrato: 04/02/08 22:05 Messaggi: 308 Residenza: Roma
|
Inviato: 12 Feb 2008 21:44 Oggetto: |
|
|
non mi da nessun tipo di errore perche all' inizio di ogni funzione c'è la @ che da quello che ho sentito e per non far visualizare l' errori, poi non so se e vero, cmq a me non mi da nessun errore |
|
Top |
|
 |
mdweb Dio maturo


Registrato: 18/12/07 16:59 Messaggi: 4412
|
Inviato: 12 Feb 2008 21:46 Oggetto: |
|
|
levale e vediamo cose succede....poi dopo cena mi rimetto al pc e provo a scriverti uno script...  |
|
Top |
|
 |
mdweb Dio maturo


Registrato: 18/12/07 16:59 Messaggi: 4412
|
Inviato: 12 Feb 2008 22:06 Oggetto: |
|
|
1. Creare una tabella di database:
Codice: | CREATE TABLE useronline (
zeit int(15) NOT NULL,
ip varchar(15) NOT NULL,
file varchar(50) NOT NULL,
PRIMARY KEY (zeit),
KEY ip (ip),
KEY file (file)
);
|
Adesso crea un file confing.php:
Codice: | <?php
$db_server = "localhost";
$db_username = "root";
$db_passwort = "";
$db_database = "useronline";
$db_table = "useronline";
$timeout = "5";
$twidth = "100";
$bghl = "#dddddd";
$bgfl = "#dddddd";
$ffacehl = "Arial";
$fsizehl = "2";
$fcolorhl = "#6666ff";
$ffacefl = "Arial";
$fsizefl = "1";
$fcolorfl = "#6666ff";
$texthl = "user online";
$text1 = "user is at:";
$text2 = "users are at:";
?> |
Ora crea un file userin.php che inserirai all'interno delle pagine che vuoi contare:
Codice: |
<?php
include ("confing.php");
$handler=@mysql_connect($db_server,$db_username,$db_passwort);
@mysql_select_db($db_database,$handler);
$zeit = time();
$ip = getenv(REMOTE_ADDR);
$file = $PHP_SELF;
$result=@mysql_query("INSERT INTO $db_table VALUES ('$zeit','$ip','$file')",$handler);
@mysql_close();
?>
|
Ora un file useronline.php per mostrare gli utenti:
Codice: | <?php
include ("confing.php");
$zeit = time();
$loeschzeit = $zeit-($timeout*60);
$ip = getenv(REMOTE_ADDR);
$file = $PHP_SELF;
$handler = @mysql_connect($db_server,$db_username,$db_passwort);
@mysql_select_db($db_database,$handler);
$result = @mysql_query("INSERT INTO $db_table VALUES ('$zeit','$ip','$file')",$handler);
$result = @mysql_query("DELETE FROM $db_table WHERE zeit<'$loeschzeit'",$handler);
$result = @mysql_query("SELECT DISTINCT ip FROM $db_table",$handler);
$anzahl_user= @mysql_numrows($result);
echo "<table width=\"$twidth\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr>";
echo "<td bgcolor=\"$bghl\" align=\"center\">";
echo "<font face=\"$ffacehl\" size=\"$fsizehl\" color=\"$fcolorhl\">";
echo "<b>";
echo $anzahl_user." ".$texthl;
echo "</font>";
echo "</b>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td height=\"7\">";
echo "</td>";
echo "</tr>";
unset($file);
for ($i = 0; $i < $anzahl_user; $i++)
{
$row = @mysql_fetch_array($result);
$ip = $row[ip];
$result2 = @mysql_query("SELECT file FROM $db_table WHERE ip='$ip' ORDER BY zeit DESC",$handler);
$row2 = @mysql_fetch_array($result2);
$datei = $row2[file];
$datei = explode("/",$datei);
for ($xy=0;$xy<count($datei)-1;$xy++)
{
$file .= $datei[$xy];
if ($xy<(count($datei)-2)) $file .= "/";
}
if (count($datei)==2) $file .= $datei[$xy];
$anzahluser[$file]++;
if (count($datei)==2):
$linkuser[$file] = "../".$file;
else:
$linkuser[$file] = $file;
endif;
unset ($file);
}
@arsort($anzahluser);
while (list ($key, $val) = @each ($anzahluser))
{
echo "<tr bgcolor=\"$bgfl\">";
echo "<td align=\"center\">";
echo "<font face=\"$ffacefl\" size=\"$fsizefl\" color=\"$fcolorfl\">";
if($val>1):
echo $val." ".$text2;
else:
echo $val." ".$text1;
endif;
echo "<br>";
echo "<a href=$linkuser[$key]>$key</a>";
echo "</font>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td height=\"5\">";
echo "</td>";
echo "</tr>";
}
@mysql_close();
?>
</table> |
Spero funzioni non l'ho testato...[/code] |
|
Top |
|
 |
sevenjeak Semidio


Registrato: 04/02/08 22:05 Messaggi: 308 Residenza: Roma
|
Inviato: 12 Feb 2008 22:27 Oggetto: |
|
|
Ho provato il codice, mi da questo errore:
Codice: |
Parse error: syntax error, unexpected T_STRING in C:\AppServ\www\Fasterwolf\cont\useronline.php on line 12
|
|
|
Top |
|
 |
sevenjeak Semidio


Registrato: 04/02/08 22:05 Messaggi: 308 Residenza: Roma
|
Inviato: 14 Feb 2008 21:24 Oggetto: |
|
|
Ho trovato un tutorial per effettuare il logout alla chiusura della finestra e al cambio del dominio dell' utente qui:
link
in un primo momento usa quello che mi avete detto voi ma poi in un segondo momento approfondisce un po il codice, cmq li troverete una pagina che reindirizza in logout.asp, ora io ho modificato quella pagina in logout.php perche io lo faccio con quello il logout, ma non mi va, come mai? |
|
Top |
|
 |
|