Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP checking/refreashing functions
    text
    copied!<p>I have a main document that displays a chatbox. What I want is for the chatbox to refresh on everyone's screen when someone posts a new message.</p> <p>I've tried many methods, including sleep timers and new functions that call then sleep and get recalled, but this just generates an endless lines of the same or little different data making the form unusable until it errors.</p> <p>This is my code.</p> <pre><code>&lt;?php // set error reporting level if (version_compare(phpversion(), "5.3.0", "&gt;=") == 1) error_reporting(E_ALL &amp; ~E_NOTICE &amp; ~E_DEPRECATED); else error_reporting(E_ALL &amp; ~E_NOTICE); require_once('inc/login.inc.php'); require_once('inc/chat.inc.php'); // initialization of login system and generation code $oSimpleLoginSystem = new SimpleLoginSystem(); $oSimpleChat = new SimpleChat(); // draw login box echo $oSimpleLoginSystem-&gt;getLoginBox(); // draw chat application $sChatResult = '&lt;font color="0x99000"&gt; &lt;a href="Register_form.html"&gt;New Account&lt;/a&gt;&lt;br&gt; login to send a message&lt;br&gt; or register for a new account&lt;/font&gt;'; if ($_COOKIE['member_name'] &amp;&amp; $_COOKIE['member_pass']) { if ($oSimpleLoginSystem-&gt;check_login($_COOKIE['member_name'], $_COOKIE['member_pass'])) { $sChatResult = ""; if($oSimpleLoginSystem-&gt;check_privledges($_COOKIE['member_name']) &gt;= 2) { $sChatResult .= "&lt;br&gt;privledge check Working&lt;br&gt;"; } $sChatResult .= "&lt;form action=$_SERVER[PHP_SELF] method='post'&gt; &lt;input type='hidden' name='foo' value='&lt;?= $foo ?&gt;' /&gt; &lt;input type='submit' name='submit' value='Refresh Messages' /&gt; &lt;/form&gt;"; $sChatResult .= $oSimpleChat-&gt;acceptMessages(); $sChatResult .= "&lt;br&gt;&lt;br&gt;"; $sChatResult .= $oSimpleChat-&gt;getMessages(); } } echo $sChatResult; ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload