Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
<?
# Database info, or include a config.php file
$db_host = 'localhost'; # Change to your host
$db_user = 'username'; # Change to your user name
$db_password = 'password'; # Change to your password
$db_name = 'database_name'; # Change to your db name
# Connect to the database, or end all scripts and give the reason for ending
mysql_connect($db_host,$db_user,$db_password) or die(mysql_error());
mysql_select_db($db_name) or die(mysql_error());
# Initialize an array that will contain the stats till the end.
$stats = array();
# Select the number of users online
$result = mysql_query("SELECT count(session_logged_in) as logged_in FROM phpbb_sessions WHERE session_logged_in = 1");
# This gets the result of the above query and stores it in a variable so we can access the result we need
$r = mysql_fetch_array($result);
# Here we store the needed result into the stats array
$stats['logged_in'] = $r['logged_in'];
# Select the newest member
$result = mysql_query("SELECT user_id, username FROM phpbb_users ORDER BY user_id DESC LIMIT 1");
# Using the same method as before, get the result
$r = mysql_fetch_array($result);
# Now we need to store 2 results into the array, the newest user's name, and id
$stats['user_id'] = $r['user_id'];
$stats['username'] = $r['username'];
# Now we need to total amount of topics the forum has
$result = mysql_query("SELECT count(topic_id) as topic_total FROM phpbb_topics");
# Guess what... we now get the result into an array again...
$r = mysql_fetch_array($result);
# And the store it again...
$stats['topic_total'] = $r['topic_total'];
# Select total amount of posts
$result = mysql_query("SELECT count(post_id) as post_total FROM phpbb_posts");
$r = mysql_fetch_array($result);
$stats['post_total'] = $r['post_total'];
# Now we can move onto the really fun stuff, getting everything to display.
# For that, we'll use the echo function. Make sure you change the link to go to your forums.
echo "Users online: {$stats['logged_in']}<br>
Newest registerd user:<br>
<a href=\"http://domain.com/forum/profile.php?mode=viewprofile&u={$stats['user_id']}\">{$stats['username']}</a><br><br>
Total topics: {$stats['topic_total']}<br>
Total Posts: {$stats['post_total']}";
?>
admin каза:Пишете на бафи да погледне урока си.
Друг няма да се занимава също не защото няма време а защото.. както и да еbafitu каза:Ааа еми както съм писал и там - не съм го тествал много много..бях го направил набързо и така..не ми се занимава сега да го преправям.Ако някои има желание...
Твойто дава много грешки, а този скрипт горе брои нещо като онлайн потребители ама нещо само се увеличават. И не е вярна статистиката :roll:bafitu каза:Еми какво да го гледам просто е нещо като статистика:
Общо логнати потребителя (без гостовете мисля)
Последният регистриран потребител + ид-то му
Общо теми
Общо постове
По просто от това неможе да е
Май не е това което искате може би ?
Там кода дето съм дал в темата неработи ли?
А мен ме мързи...
s.session_time >= ".( time() - 300 ) . "