PcGeniusProductions Posted June 18, 2008 Share Posted June 18, 2008 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 More sharing options...
trq Posted June 18, 2008 Share Posted June 18, 2008 You need to find some ajax tutorials by the sound of it. Theres a resources sticky in the top of our Ajax board that may be of some use to you. Link to comment https://forums.phpfreaks.com/topic/110773-simple-refresh-advise-please/#findComment-568296 Share on other sites More sharing options...
PcGeniusProductions Posted June 18, 2008 Author Share Posted June 18, 2008 OK, I shall take a look. I was thinking of Ajax, but never having used it in my own creations, I don't know much about it. Thanks for your advice. Link to comment https://forums.phpfreaks.com/topic/110773-simple-refresh-advise-please/#findComment-568300 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.