class design improvment - tweet - decoupling super global variables?
<p><strong>Question:</strong></p>

<p>Should I decouple the SESSION variables, i.e. move them outside of the class...this was a suggestion from another POST.  I would like to extend this library to more general cases than just for my purposes..and I believe this is the next step here?</p>

<p><strong>Summary:</strong></p>

<p>This class sends "tweet" data to the client in the form of a custom markup language.</p>

<p>It is used in Ajax call and in previous post people have suggested not to echo the result..but this is my primary means of communicating with the server via Ajax responseText.</p>

<p>Also <code>&lt;tw_p&gt;</code> is used to denote a pass and is read by the client.  The markup looks like this.</p>

<p>field 1 | field 2 | field 3 | field 4 || field 1 | field 2 | field 3 | field 4 ||</p>

<p>It is called like this - </p>

<pre><code>new tweet();
</code></pre>

<p>The client knows how render this into xhtml once it receives it.</p>

<pre><code>/*tweet*/

class tweet extends post
  {
  function __construct()
    {
    parent::__construct();
    $email=$_SESSION['email'];
    $flname=$_SESSION['name'];
    $message=$this-&gt;_protected_arr['f4b'];
    $time=time();
    database::query("INSERT INTO tw VALUES ('$time','$flname','$message','$email')");        
    $query_return = database::query("SELECT * FROM tw ORDER BY time DESC LIMIT 7");
    $b=0;
    $c='&lt;tw_p&gt;';
    while($a=mysqli_fetch_assoc($query_return))
      {  
      if($b==0)
        {
        $c = $c . $a['email'] . "|" .  $a['fname'] . "|" . $a['time'] . "|" . $time . "|" . $a['message'];
        }
      else
        {
        $c = $c . "||" . $a['email'] . "|" .  $a['fname'] . "|" . $a['time'] . "|" . $time . "|" . $a['message'];
        }
      $b++;
      }
    echo $c;
    }
  }
</code></pre>
