Inny 1 Posting Whiz in Training

Some members who come online and post are not appearing, while others are. Whats wrong with this code?
Can I host The Php elsewhere to create my own database?

<script>
tds = document.getElementsByTagName('td')
if ({ibf.member.id} > 0)
{
for (i=0;i<tds.length;i++)
{ 
if (tds[i].innerHTML.match('Logged in as:'))
{
a = tds[i].getElementsByTagName('a')[0]
if (a.href.match('showuser={ibf.member.id}'))
{ uname = a.innerHTML }
}}
}
else
{
uname = 'guest'
}
board_url = '{ibf.script_url}'.replace('http://','').slice(0,'{ibf.script_url}'.replace('http://','').indexOf('/'))
document.write('<scri'+'pt src=http://slanter.moved.in/forum_cash/forum_onlinetoday/index.php?uid={ibf.member.id}&board='+board_url+'&uname='+uname+'></scrip'+'t>')
</script>

<tr>
<td class='titlemedium2' colspan='2'><script>document.write(board_visitors_array.length)</script> user(s) active today</td>
</tr>
<tr>
<td width="5%" class='row4'><{F_ACTIVE}></td>
<td class='row2' width='95%'>
<div class='thin'>
<script>
for (i=0;i<board_visitors_array.length;i++)
{
if (i>0) {document.write(', ')}
document.write('<a href="http://herproom.5.forumer.com/index.php?showuser='+board_visitors_array[i]+'">'+board_visitors_array_name[i]+'</a>')
}
</script>
</div>
</td>
</tr>

the php

<?
/*
$blah = $_GET['blah'];
if ($blah == '1')
{
$username='*****';
$password='*****';
$database='slanter_forumcash';
$server='localhost';

$sql = mysql_connect($server,$username,$password); 
if (!$sql) { 
  die( 'Could not connect: ' . mysql_error());
}
$select_db = mysql_select_db($database) or die( "Unable to select database");
if (!$select_db) { 
  die( 'Could not select: ' . mysql_error());
}

mysql_query('CREATE TABLE forum_OnlineToday (id int(6) NOT NULL primary key auto_increment, date varchar(30) NOT NULL, board varchar(50) NOT NULL, members varchar(30) NOT NULL, guests varchar(30) NOT NULL, anonymous varchar(30) NOT NULL, memlist varchar(1000000) NOT NULL)') or die('Unable to create table: ' . mysql_error());

mysql_close($sql);
die('Table Created');
}
*/

function compress($str)
{
$str = str_replace('\'','',$str);
return $str;
}

if (isset($_GET['guests']) AND isset($_GET['board']) AND isset($_GET['members']) AND isset($_GET['anonymous']) AND isset($_GET['memlist']))
{
$_GET['memlist'] = compress($_GET['memlist']);
//$_GET['memlist'] = htmlspecialchars($_GET['memlist']);

$username='*****';
$password='*****';
$database='slanter_forumcash';
$server='localhost';

$sql = mysql_connect($server,$username,$password); 
if (!$sql) { 
  die( 'Could not connect: ' . mysql_error());
}
$select_db = mysql_select_db($database) or die( "Unable to select database");
if (!$select_db) { 
  die( 'Could not select: ' . mysql_error());
}

$guests = $_GET['guests'];
$board = $_GET['board'];
$members = $_GET['members'];
$anonymous = $_GET['anonymous'];
$memlist = explode(']-]delimiter[-[',$_GET['memlist']);

$check_regs = mysql_query('SELECT * FROM forum_OnlineToday WHERE board = "'.$_GET['board'].'"');
$check_reg = mysql_fetch_array($check_regs);

if ($check_reg['board'] != $_GET['board'])
{
$today = date("Ymd");
$query = "INSERT INTO forum_OnlineToday VALUES ('','".$today."','".$_GET['board']."','".$_GET['members']."','".$_GET['guests']."','".$_GET['anonymous']."','".serialize($memlist)."')";
mysql_query($query);
}

$check_info = mysql_query('SELECT * FROM forum_OnlineToday WHERE board = "'.$_GET['board'].'"');
$row = mysql_fetch_array($check_info);
$today = date("Ymd");

if ($row['date'] != $today)
{
mysql_query("UPDATE forum_OnlineToday SET date = ".$today." WHERE board = '".$_GET['board']."'");
mysql_query("UPDATE forum_OnlineToday SET members = ".count($memlist)." WHERE board = '".$_GET['board']."'");
mysql_query("UPDATE forum_OnlineToday SET guests = ".$guests." WHERE board = '".$_GET['board']."'");
mysql_query("UPDATE forum_OnlineToday SET anonymous = ".$anonymous." WHERE board = '".$_GET['board']."'");
mysql_query("UPDATE forum_OnlineToday SET memlist = ".serialize($memlist)." WHERE board = '".$_GET['board']."'");
}

$check_info = mysql_query('SELECT * FROM forum_OnlineToday WHERE board = "'.$_GET['board'].'"');
$row = mysql_fetch_array($check_info);
$raw = array('board' => $_GET['board'], 'members' => $_GET['members'], 'guests' => $_GET['guests'], 'anonymous' => $_GET['anonymous'], 'memlist' => $memlist);
$row['memlist'] = unserialize($row['memlist']);

$array_search_num = 0;
for ($i=0; $i<count($raw['memlist']); $i++)
{
for ($o=0; $o<count($row['memlist']); $o++)
{
if ($raw['memlist'][$i] == $row['memlist'][$o])
{ 
$array_search_num++; 
unset($raw['memlist'][$i]);
break;
}}}
$memlist = array_merge($raw['memlist'], $row['memlist']);
$cm = count($memlist);
$sm = serialize($memlist);

mysql_query("UPDATE forum_OnlineToday SET members = ".$cm." WHERE board = '".$_GET['board']."'");
mysql_query("UPDATE forum_OnlineToday SET memlist = '".serialize($memlist)."' WHERE board = '".$_GET['board']."'")
  or die( 'Could Not Update: ' . mysql_error());
if ($guests > $row['guests'])
{
mysql_query("UPDATE forum_OnlineToday SET guests = ".$guests." WHERE board = '".$_GET['board']."'");
}
if ($anonymous > $row['anonymous'])
{
mysql_query("UPDATE forum_OnlineToday SET anonymous = ".$anonymous." WHERE board = '".$_GET['board']."'");
}

$check_info = mysql_query('SELECT * FROM forum_OnlineToday WHERE board = "'.$_GET['board'].'"');
$row = mysql_fetch_array($check_info);
$row['memlist'] = unserialize($row['memlist']);
$memlist = $row['memlist'];

if (count($memlist)>1 || $_GET['memlist'] == '')
{
$memlist = implode(', ', $memlist);
}

$memlist = str_replace('\\','',$memlist);

echo 'var memlist="'.$memlist.'";';
echo 'var members="'.count($memlist).'";';
echo 'var guests="'.$row['guests'].'";';
echo 'var anonymous="'.$row['anonymous'].'";';

mysql_close($sql);
}
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.