ALTER TABLE users ADD opsystem char(13) default NULL;
SQL_Query_exec("UPDATE users SET last_login = '".get_date_time()."' WHERE id = $id");
$info = new IPconnected();
$osName = $info->operatingSystem();
SQL_Query_exec("UPDATE users SET last_login = '".get_date_time()." AND opsystem=".$osName." ' WHERE id = $id");
echo $CURUSER['opsystem'];
<?php
if (!$site_config["MEMBERSONLY"] || $CURUSER) {
begin_block(T_("Ip Details"));
$info = new IPconnected();
$osName = $info->operatingSystem();
$osVersion = $info->osVersion();
$browserName = $info->browser()['browser'];
$browserVersion = $info->browserVersion();
$ip = $info->ip();
echo '<font color=orange><b>Op Sys </b></font>'.$osName;
echo '<br><font color=orange><b>Version </b></font>'.$osVersion;
echo '<br><font color=orange><b>Browser </b></font>'.$browserName;
echo '<br><font color=orange><b>Version </b></font>'.$browserVersion;
echo '<br><font color=orange><b>Ip </b></font>'.$ip;
end_block();
}<?php
class IPconnected
{
/**
* Get user agent.
*/
private static function agent()
{
return $_SERVER['HTTP_USER_AGENT'];
}
/**
* Get OperatingSystem name.
*/
public function operatingSystem()
{
$UserAgent = self::agent();
if (preg_match_all('/windows/i', $UserAgent)) {
$PlatForm = 'Windows';
} elseif (preg_match_all('/linux/i', $UserAgent)) {
$PlatForm = 'Linux';
} elseif (preg_match('/macintosh|mac os x/i', $UserAgent)) {
$PlatForm = 'Macintosh';
} elseif (preg_match_all('/Android/i', $UserAgent)) {
$PlatForm = 'Android';
} elseif (preg_match_all('/iPhone/i', $UserAgent)) {
$PlatForm = 'IOS';
} elseif (preg_match_all('/ubuntu/i', $UserAgent)) {
$PlatForm = 'Ubuntu';
} else {
$PlatForm = 'unknown';
}
return $PlatForm;
}
/**
* Get Browser Name.
*/
public function browser()
{
$UserAgent = self::agent();
if (preg_match_all('/Edge/i', $UserAgent)) {
$Browser = 'Microsoft Edge';
$B_Agent = 'Edge';
} elseif (preg_match_all('/MSIE/i', $UserAgent)) {
$Browser = 'Mozilla Firefox';
$B_Agent = 'Firefox';
} elseif (preg_match_all('/OPR/i', $UserAgent)) {
$Browser = 'Opera';
$B_Agent = 'Opera';
} elseif (preg_match_all('/Opera/i', $UserAgent)) {
$Browser = 'Opera';
$B_Agent = 'Opera';
} elseif (preg_match_all('/Chrome/i', $UserAgent)) {
$Browser = 'Google Chrome';
$B_Agent = 'Chrome';
} elseif (preg_match_all('/Safari/i', $UserAgent)) {
$Browser = 'Apple Safari';
$B_Agent = 'Safari';
} elseif (preg_match_all('/firefox/i', $UserAgent)) {
$Browser = 'Mozilla Firefox';
$B_Agent = 'Firefox';
} else {
$Browser = null;
$B_Agent = null;
}
return [
'browser' => $Browser,
'agent' => $B_Agent,
];
}
/**
* Get Os version.
*/
public function oSVersion()
{
$UserAgent = self::agent();
if (preg_match_all('/windows nt 10/i', $UserAgent)) {
$OsVersion = 'Windows 10';
} elseif (preg_match_all('/windows nt 6.3/i', $UserAgent)) {
$OsVersion = 'Windows 8.1';
} elseif (preg_match_all('/windows nt 6.2/i', $UserAgent)) {
$OsVersion = 'Windows 8';
} elseif (preg_match_all('/windows nt 6.1/i', $UserAgent)) {
$OsVersion = 'Windows 7';
} elseif (preg_match_all('/windows nt 6.0/i', $UserAgent)) {
$OsVersion = 'Windows Vista';
} elseif (preg_match_all('/windows nt 5.1/i', $UserAgent)) {
$OsVersion = 'Windows Xp';
} elseif (preg_match_all('/windows xp/i', $UserAgent)) {
$OsVersion = 'Windows Xp';
} elseif (preg_match_all('/windows me/i', $UserAgent)) {
$OsVersion = 'Windows Me';
} elseif (preg_match_all('/win98/i', $UserAgent)) {
$OsVersion = 'Windows 98';
} elseif (preg_match_all('/win95/i', $UserAgent)) {
$OsVersion = 'Windows 95';
} elseif (preg_match_all('/Windows Phone +[0-9]/i', $UserAgent, $match)) {
$OsVersion = $match;
} elseif (preg_match_all('/Android +[0-9]/i', $UserAgent, $match)) {
$OsVersion = $match;
} elseif (preg_match_all('/Linux +x[0-9]+/i', $UserAgent, $match)) {
$OsVersion = $match;
}
return $OsVersion;
}
/**
* Get Browser version.
*/
public function browserVersion()
{
$UserAgent = self::agent();
$B_Agent = self::Browser()['agent'];
if ($B_Agent !== null) {
$known = ['Version', $B_Agent, 'other'];
$pattern = '#(?<browser>' . implode('|', $known) .
')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
if (!preg_match_all($pattern, $UserAgent, $matches)) {
}
$i = count($matches['browser']);
if ($i != 1) {
if (strripos($UserAgent, 'Version') < strripos($UserAgent, $B_Agent)) {
$Version = $matches['version'][0];
} else {
$Version = $matches['version'][0];
}
} else {
$Version = $matches['version'][0];
}
}
return $Version;
}
/**
* Get The user ip.
*/
public function ip()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip_add = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER[' HTTP_X_FORWADED_FOR'])) {
$ip_add = $_SERVER['HTTP_X_FORWADED_FOR'];
} else {
$ip_add = $_SERVER['REMOTE_ADDR'];
}
return $ip_add;
}
}
if (Permissions::hasPermission($_SESSION['id'], $_SESSION["LOGGEDIN"])) {if (Permissions::hasPermission($user->id, $user->loggedin)) { <?php
class Permissions
{
public static function hasPermission($id, $permission)
{
global $site_config, $CURUSER;
if ($id == $CURUSER['id'] && $permission == 1) {
return true;
} else {
return false;
}
}
}if (Permissions::hasPermission($CURUSER['id'], $site_config["MEMBERSONLY"])) {
echo "<br>Success<br>";
}
// End
if ($count)
{
if ($site_config['torrimagetable'] == true) {
torrenttableimage($res);
print $pagerbottom;
} else {
torrenttable($res);
print $pagerbottom;
}
}else
// End
if ($count)
{
torrenttable($res);
print $pagerbottom;
}
// End
if ($count)
{
if ($site_config['torrimagetable'] == true) {
torrenttable($res);
print $pagerbottom;
} else {
torrenttableimage($res);
print $pagerbottom;
}
}else
function torrenttable($res) {function torrenttableimage($res) {function pager($rpp, $count, $href, $opts = array()) {function torrenttable($res) {
global $site_config, $CURUSER, $THEME, $LANGUAGE; //Define globals
if ($site_config["MEMBERSONLY_WAIT"] && $site_config["MEMBERSONLY"] && in_array($CURUSER["class"], explode(",",$site_config["WAIT_CLASS"]))) {
$gigs = $CURUSER["uploaded"] / (1024*1024*1024);
$ratio = (($CURUSER["downloaded"] > 0) ? ($CURUSER["uploaded"] / $CURUSER["downloaded"]) : 0);
if ($ratio < 0 || $gigs < 0) $wait = $site_config["WAITA"];
elseif ($ratio < $site_config["RATIOA"] || $gigs < $site_config["GIGSA"]) $wait = $site_config["WAITA"];
elseif ($ratio < $site_config["RATIOB"] || $gigs < $site_config["GIGSB"]) $wait = $site_config["WAITB"];
elseif ($ratio < $site_config["RATIOC"] || $gigs < $site_config["GIGSC"]) $wait = $site_config["WAITC"];
elseif ($ratio < $site_config["RATIOD"] || $gigs < $site_config["GIGSD"]) $wait = $site_config["WAITD"];
else $wait = 0;
}
// Columns
$cols = explode(",", $site_config["torrenttable_columns"]);
$cols = array_map("strtolower", $cols);
$cols = array_map("trim", $cols);
$colspan = count($cols);
// End
// Expanding Area
$expandrows = array();
if (!empty($site_config["torrenttable_expand"])) {
$expandrows = explode(",", $site_config["torrenttable_expand"]);
$expandrows = array_map("strtolower", $expandrows);
$expandrows = array_map("trim", $expandrows);
}
// End
echo '<table align="center" class="ttable_headinner" width="100%"><thead><tr class="ttable_head">';
foreach ($cols as $col) {
switch ($col) {
case 'category':
echo "<th>".T_("TYPE")."</th>";
break;
case 'name':
echo "<th>".T_("NAME")."</th>";
break;
case 'dl':
echo "<th>".T_("DL")."</th>";
break;
case 'uploader':
echo "<th>".T_("UPLOADER")."</th>";
break;
case 'comments':
echo "<th>".T_("COMM")."</th>";
break;
case 'nfo':
echo "<th>".T_("NFO")."</th>";
break;
case 'size':
echo "<th>".T_("SIZE")."</th>";
break;
case 'completed':
echo "<th>".T_("C")."</th>";
break;
case 'seeders':
echo "<th>".T_("S")."</th>";
break;
case 'leechers':
echo "<th>".T_("L")."</th>";
break;
case 'health':
echo "<th>".T_("HEALTH")."</th>";
break;
case 'external':
if ($site_config["ALLOWEXTERNAL"])
echo "<th>".T_("L/E")."</th>";
break;
case 'added':
echo "<th>".T_("ADDED")."</th>";
break;
case 'speed':
echo "<th>".T_("SPEED")."</th>";
break;
case 'wait':
if ($wait)
echo "<th>".T_("WAIT")."</th>";
break;
case 'rating':
echo "<th>".T_("RATINGS")."</th>";
break;
}
}
if ($wait && !in_array("wait", $cols))
echo "<th>".T_("WAIT")."</th>";
echo "</tr></thead>";
while ($row = mysqli_fetch_assoc($res)) {
$id = $row["id"];
print("<tr class='t-row'>\n");
$x = 1;
foreach ($cols as $col) {
switch ($col) {
case 'category':
print("<td class='ttable_col$x' align='center' valign='middle'>");
if (!empty($row["cat_name"])) {
print("<a href=\"torrents.php?cat=" . $row["category"] . "\">");
if (!empty($row["cat_pic"]) && $row["cat_pic"] != "")
print("<img border=\"0\"src=\"" . $site_config['SITEURL'] . "/images/categories/" . $row["cat_pic"] . "\" alt=\"" . $row["cat_name"] . "\" />");
else
print($row["cat_parent"].": ".$row["cat_name"]);
print("</a>");
} else
print("-");
print("</td>\n");
break;
case 'name':
$char1 = 35; //cut name length
$smallname = htmlspecialchars(CutName($row["name"], $char1));
$dispname = "<b>".$smallname."</b>";
$last_access = $CURUSER["last_browse"];
$time_now = gmtime();
if ($last_access > $time_now || !is_numeric($last_access))
$last_access = $time_now;
if (sql_timestamp_to_unix_timestamp($row["added"]) >= $last_access)
$dispname .= "<b><font color='#ff0000'> - (".T_("NEW")."!)</font></b>";
if ($row["freeleech"] == 1)
$dispname .= " <img src='images/free.gif' border='0' alt='' />";
print("<td class='ttable_col$x' nowrap='nowrap'>".(count($expandrows)?"<a href=\"javascript: klappe_torrent('t".$row['id']."')\"><img border=\"0\" src=\"".$site_config["SITEURL"]."/images/plus.gif\" id=\"pict".$row['id']."\" alt=\"Show/Hide\" class=\"showthecross\" /></a>":"")." <a title=\"".$row["name"]."\" href=\"torrents-details.php?id=$id&hit=1\">$dispname</a></td>");
break;
case 'dl':
print("<td class='ttable_col$x' align='center'><a href=\"download.php?id=$id&name=" . rawurlencode($row["filename"]) . "\"><img src='" . $site_config['SITEURL'] . "/images/icon_download.gif' border='0' alt=\"Download .torrent\" /></a></td>");
break;
case 'uploader':
echo "<td class='ttable_col$x' align='center'>";
if (($row["anon"] == "yes" || $row["privacy"] == "strong") && $CURUSER["id"] != $row["owner"] && $CURUSER["edit_torrents"] != "yes")
echo "Anonymous";
elseif ($row["username"])
echo "<a href='account-details.php?id=$row[owner]'>$row[username]</a>";
else
echo "Unknown";
echo "</td>";
break;
case 'comments':
print("<td class='ttable_col$x' align='center'><font size='1' face='verdana'><a href='comments.php?type=torrent&id=$id'>" . number_format($row["comments"]) . "</a></font></td>\n");
break;
case 'nfo':
if ($row["nfo"] == "yes")
print("<td class='ttable_col$x' align='center'><a href='nfo-view.php?id=$row[id]'><img src='" . $site_config['SITEURL'] . "/images/icon_nfo.gif' border='0' alt='View NFO' /></a></td>");
else
print("<td class='ttable_col$x' align='center'>-</td>");
break;
case 'size':
print("<td class='ttable_col$x' align='center'>".mksize($row["size"])."</td>\n");
break;
case 'completed':
print("<td class='ttable_col$x' align='center'><font color='orange'><b>".number_format($row["times_completed"])."</b></font></td>");
break;
case 'seeders':
print("<td class='ttable_col$x' align='center'><font color='green'><b>".number_format($row["seeders"])."</b></font></td>\n");
break;
case 'leechers':
print("<td class='ttable_col$x' align='center'><font color='#ff0000'><b>" . number_format($row["leechers"]) . "</b></font></td>\n");
break;
case 'health':
print("<td class='ttable_col$x' align='center'><img src='".$site_config["SITEURL"]."/images/health/health_".health($row["leechers"], $row["seeders"]).".gif' alt='' /></td>\n");
break;
case 'external':
if ($site_config["ALLOWEXTERNAL"]){
if ($row["external"]=='yes')
print("<td class='ttable_col$x' align='center'>".T_("E")."</td>\n");
else
print("<td class='ttable_col$x' align='center'>".T_("L")."</td>\n");
}
break;
case 'added':
print("<td class='ttable_col$x' align='center'>".date("d-m-Y H:i:s", utc_to_tz_time($row['added']))."</td>");
break;
case 'speed':
if ($row["external"] != "yes" && $row["leechers"] >= 1){
$speedQ = SQL_Query_exec("SELECT (SUM(downloaded)) / (UNIX_TIMESTAMP('".get_date_time()."') - UNIX_TIMESTAMP(started)) AS totalspeed FROM peers WHERE seeder = 'no' AND torrent = '$id' ORDER BY started ASC");
$a = mysqli_fetch_assoc($speedQ);
$totalspeed = mksize($a["totalspeed"]) . "/s";
} else
$totalspeed = "--";
print("<td class='ttable_col$x' align='center'>$totalspeed</td>");
break;
case 'wait':
if ($wait){
$elapsed = floor((gmtime() - strtotime($row["added"])) / 3600);
if ($elapsed < $wait && $row["external"] != "yes") {
$color = dechex(floor(127*($wait - $elapsed)/48 + 128)*65536);
print("<td class='ttable_col$x' align='center'><a href=\"faq.php#section46\"><font color=\"$color\">" . number_format($wait - $elapsed) . " h</font></a></td>\n");
} else
print("<td class='ttable_col$x' align='center'>--</td>\n");
}
break;
case 'rating':
if (!$row["rating"])
$rating = "--";
else
$rating = "<a title='$row[rating]/5'>".ratingpic($row["rating"])."</a>";
//$rating = ratingpic($row["rating"]);
//$srating .= "$rpic (" . $row["rating"] . " out of 5) " . $row["numratings"] . " users have rated this torrent";
print("<td class='ttable_col$x' align='center'>$rating</td>");
break;
}
if ($x == 2)
$x--;
else
$x++;
}
//Wait Time Check
if ($wait && !in_array("wait", $cols)) {
$elapsed = floor((gmtime() - strtotime($row["added"])) / 3600);
if ($elapsed < $wait && $row["external"] != "yes") {
$color = dechex(floor(127*($wait - $elapsed)/48 + 128)*65536);
print("<td class='ttable_col$x' align='center'><a href=\"faq.php\"><font color=\"$color\">" . number_format($wait - $elapsed) . " h</font></a></td>\n");
} else
print("<td class='ttable_col$x' align='center'>--</td>\n");
$colspan++;
if ($x == 2)
$x--;
else
$x++;
}
print("</tr>\n");
//Expanding area
if (count($expandrows)) {
print("<tr class='t-row'><td class='ttable_col$x' colspan='$colspan'><div id=\"kt".$row['id']."\" style=\"margin-left: 2px; display: none;\">");
print("<table width='100%' border='0' cellspacing='0' cellpadding='0'>");
foreach ($expandrows as $expandrow) {
switch ($expandrow) {
case 'size':
print("<tr><td><b>".T_("SIZE")."</b>: ".mksize($row['size'])."</td></tr>");
break;
case 'speed':
if ($row["external"] != "yes" && $row["leechers"] >= 1){
$speedQ = SQL_Query_exec("SELECT (SUM(downloaded)) / (UNIX_TIMESTAMP('".get_date_time()."') - UNIX_TIMESTAMP(started)) AS totalspeed FROM peers WHERE seeder = 'no' AND torrent = '$id' ORDER BY started ASC");
$a = mysqli_fetch_assoc($speedQ);
$totalspeed = mksize($a["totalspeed"]) . "/s";
print("<tr><td><b>".T_("SPEED").":</b> $totalspeed</td></tr>");
}
break;
case 'added':
print("<tr><td><b>".T_("ADDED").":</b> ".date("d-m-Y \\a\\t H:i:s", utc_to_tz_time($row['added']))."</td></tr>");
break;
case 'tracker':
if ($row["external"] == "yes")
print("<tr><td><b>".T_("TRACKER").":</b> ".htmlspecialchars($row["announce"])."</td></tr>");
break;
case 'completed':
print("<tr><td><b>".T_("COMPLETED")."</b>: ".number_format($row['times_completed'])."</td></tr>");
break;
}
}
print("</table></div></td></tr>\n");
}
//End Expanding Area
}
print("</table><br />\n");
}$site_config["torrimagetable"] = true;
$res = DB::run($query);
if ($res->rowCount()) {
torrenttable($res);
torrenttableimage($res);
}else {
$res = DB::run($query);
if ($res->rowCount()) {
if ($site_config['torrimagetable'] == true) {
torrenttable($res);
} else {
torrenttableimage($res);
}
}else {$site_config["torrimagetable"] = true;$example = select torrtable from users where id
if ($example = true) if ($site_config['torrent_image'] == true) {
torrenttableimage()
} else {
torrenttable()
}