Jump to content

Simple Refresh. Advise Please?


Recommended Posts

Hi, I have wrote a script that echos all the stats of my web-chat client. Only trouble is, for it to get upfated info without changing the page, it has to use meta refresh (It is inside an iFrame) so the whole box flashes and lookes awful.

 

What I want to do is make it so it ONLY updates the ECHO data, and not the whole script. I will be prepared to use any coding language that will do what I need. (Except ASP)

 

Here is my script. Can anyone help me please?

 

<html>
<head>
<meta http-equiv="refresh" content="60">
</head>
<SCRIPT LANGUAGE="JavaScript">
function popPGCscript(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=700,height=150,left = 179,top = 334');");
}
</script>
<style type="text/css">
body {
background-color: #EFEFEF;
}
DIV.pgc-stats {
padding-left:3px;
border-style: solid;
background-image:url('gradient.jpg');
line-height:17px;
font-size:12px;
font-family:verdana;
}
</style>
<body>

<div class="pgc-stats">
<?php
$dbhost = 'XXXXX';
$dbuser = 'XXXXX';
$dbpass = 'XXXXX';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
$dbname = 'XXXXX';
mysql_select_db($dbname);
?>
<?php
$result = mysql_query("SELECT DISTINCT(room) FROM ajaxim_chats");
$num_rows = mysql_num_rows($result);
echo "<b>Public Chatrooms:</b><br />$num_rows";
?>
<br />
<?php
$result = mysql_query("SELECT * FROM ajaxim_users WHERE is_online = 1 AND admin = 1");
$num_rows = mysql_num_rows($result);
echo "<b>Admins Online:</b><br />$num_rows";
?>
<br />
<?php
$result = mysql_query("SELECT * FROM ajaxim_users WHERE is_online = 1 AND admin = 0");
$num_rows = mysql_num_rows($result);
echo "<b>Users Online:</b><br />$num_rows";
?>
<br />
<?php
$result = mysql_query("SELECT username FROM ajaxim_users");
$num_rows = mysql_num_rows($result);
echo "<b>Members:</b><br />$num_rows";
?>
</div>
<div align="center">
<a href="/chat/" target="_blank"><img src="ChatNow.gif" border="0"></a>
</div>
</body>
</html>

 

Also, if you find a security hole, let me know please.

 

Thanks in Advance, from Reece.

Link to comment
https://forums.phpfreaks.com/topic/110773-simple-refresh-advise-please/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.