Vlade' <3 Membru Activ
Numarul mesajelor : 715 Data nasterii : 09/12/1994 Data de inscriere : 21/07/2009 Varsta : 29 Localizare : Undeva pe planeta albastra
| Subiect: [SCRIPT] Jucatori online + Numar caractere/conturi Dum Noi 27, 2011 5:37 am | |
| Acest script va arata: - numarul de jucatori online pe server - numarul de conturi create pe server - numarul de caractere create pe server
- Cod:
-
<?php require_once("conectare/conector.php"); mysql_select_db("player"); $exe = mysql_query("SELECT COUNT(*) as count FROM player WHERE DATE_SUB(NOW(), INTERVAL 5 MINUTE) < last_play;"); $player_online = mysql_fetch_object($exe)->count; if ($player_online == '1') echo "<b><font face='' color='red'>$player_online jucator online. </font></b>"; else echo "<b><font face='' color='red'>$player_online jucatori online. </font></b>";
$cont = "SELECT * from player"; $contquery = mysql_query($cont); $num = mysql_num_rows($contquery); echo "<b><font face='' color='blue'>$num caractere.</font></b>";
mysql_select_db("account"); $test = "SELECT * from account"; $testquery = mysql_query($test); $num2 = mysql_num_rows($testquery); echo "<b><font face='' color='green'> $num2 conturi inregistrate.</font></b>";
?>
Pentru a functiona, creati un folder "conectare" in care creati un fisier "conector.php". In fiserul php puneti:
- Cod:
-
<?php /* |------------------------------------------------------------------- | Detalii conectare baza de date |------------------------------------------------------------------- */ $mysql_host = ""; $mysql_user = ""; $mysql_pass = ""; $mysql_db = "account"; $mysql_db1 = "player"; $mysql_db2 = "log"; /* |------------------------------------------------------------------- | Suport de conectare baza de date |------------------------------------------------------------------- */ mysql_connect($mysql_host, $mysql_user, $mysql_pass) OR die("Nu m-am putut conecta pentru ca exista obstructionari. <br /> Error: ".mysql_error()); mysql_select_db($mysql_db) OR die("Nu m-am putut conecta pentru ca exista obstructionari. <br /> Error: ".mysql_error()); ?>
Aici puneti datele voastre:
- Cod:
-
$mysql_host = ""; $mysql_user = ""; $mysql_pass = ""; | |
|