<?php
require_once '123login.php';
$db_server = mysql_connect($db_hostname, $db_username, $db_password);
if (!$db_server) die("Unable to connect to MySQL: " . mysql_error());
mysql_select_db($db_database)
or die("Unable to select database: " . mysql_error());
$query = (" (SELECT chanid, channel FROM chan WHERE 1=1) UNION (SELECT currentusers, channel FROM chan LIMIT 1) ");
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
$query.= " && chanid = " . $_GET['id'] . "";
}
$query.= " ORDER BY channel ASC";
$result = mysql_query($query);
if (!$result) die ("Accesso al database fallito: " . mysql_error());
$rows = mysql_num_rows($result);
for ($j = 0; $j < $rows; ++$j) {
$row = mysql_fetch_row($result);
if (!$_GET) {
$data1=trim($row[1],"#");
echo '<a href="?id=' . $data1 . '">' . $row[1] . '</a><br/><br/>';
} else {
echo $row[2];
}
}
?>