Example #1
0
<?php

require 'steamauthOOP.class.php';
$steam = new steamauthOOP();
if (isset($_GET["logout"])) {
    $steam->logout();
}
include "database_config.php";
?>

<html>
	<head>
		<title>DOTA2Mining</title>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		<!--[if lte IE 8]><script src="assets/js/ie/html5shiv.js"></script><![endif]-->
		<link rel="stylesheet" href="assets/css/main.css" />
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        .table {
            table-layout: fixed;
            word-wrap: break-word;
        }
    </style>
	</head>
	<body>
Example #2
0
<?php

require 'steamauthOOP.class.php';
@($steam = new steamauthOOP());
if (isset($_GET["logout"])) {
    $steam->logout();
}
global $steamid;
$steamid = $_SESSION["steamid"];
$personaname = $steam->personaname;
function on_line()
{
    require 'connect.php';
    $wine = 300;
    $table_online = "online";
    // имя таблицы
    // делаем доступной глобальную переменную ИП-адреса
    global $REMOTE_ADDR;
    $REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
    // соединяемся с сервером MySQL и выбираем нужную базу
    @mysql_connect($host, $db_user, $db_password) or die(mysql_error());
    mysql_select_db($db_name) or die(mysql_error());
    // удаляем всех, кто уже пробыл $wine секунд или у кого ИП текущий
    $sql_update = "DELETE FROM {$table_online} WHERE `unix`+{$wine} < " . time() . " OR `ip` = '{$REMOTE_ADDR}'";
    $result_update = mysql_query($sql_update) or die(mysql_error());
    // вставляем свою запись
    $sql_insert = "INSERT INTO {$table_online} VALUES ('','{$REMOTE_ADDR}','" . time() . "')";
    $result_insert = mysql_query($sql_insert) or die(mysql_error());
    // считаем уников он-лайн
    $sql_sel = "SELECT `id` FROM {$table_online}";
    $result_sel = mysql_query($sql_sel) or die(mysql_error());