function getData($lastID) { include "include/settings.php"; # getting table prefix include "include/offset.php"; # discard it if we are editing $sid = isset($_GET["sid"]) ? $_GET["sid"] : 0; # get shout id (sid)and set it to zero for bool $sql = "SELECT * FROM {$TABLE_PREFIX}chat WHERE id > " . $lastID . " AND id != " . $sid . " ORDER BY id DESC"; $conn = his_getDBConnection(); # establishes the connection to the database $results = mysqli_query($conn, $sql); # getting the data array while ($row = mysqli_fetch_array($results)) { # creating and naming array $id = $row[id]; $uid = $row[uid]; $time = $row[time]; $name = $row[name]; $text = $row[text]; # if no name is present somehow, $name and $text are set to the strings under # we assume all must be ok, othervise no post will be made by javascript check # if ($name == '') { $name = 'Anonymous'; $text = 'No message'; } # we lego put together our chat using some conditions and css and javascript this time print "<span class='name'>" . date("d/m/Y H:i:s", $time - $offset) . " | <a href=\"javascript:windowunder('index.php?page=userdetails&id=" . $uid . "')\">" . $name . "</a>:</span>"; global $CURUSER; if ($CURUSER["admin_access"] != "yes" && $CURUSER["uid"] != "" . $uid . "") { } else { # edit/delete buttons --> print "<div style='text-align:right;\r\n margin-top:-13px;\r\n margin-bottom:-3.5px;\r\n '>\r\n <a href='index.php?page=allshout&sid={$id}&edit'><img border='0' class='EditSwap' src='images/canvas.gif' alt='' /></a>\r\n <a onclick=\"return confirm('" . str_replace("'", "\\'", DELETE_CONFIRM) . "')\" href='index.php?page=allshout&sid={$id}&delete'>\r\n <img border='0' class='DeleteSwap' src='images/canvas.gif' alt='' /></a>\r\n </div>"; } # chat output --> print "<div class='chatoutput'>" . format_shout($text) . "</div>"; } }
function getData($lastID) { include "include/settings.php"; # getting table prefix include "include/offset.php"; # discard it if we are editing $sid = isset($_GET["sid"]) ? $_GET["sid"] : 0; # get shout id (sid)and set it to zero for bool $sql = "SELECT * FROM {$TABLE_PREFIX}chat WHERE id > " . $lastID . " AND id != " . $sid . " AND `private`='no' OR (" . $CURUSER['uid'] . " = `toid` OR " . $CURUSER['uid'] . "= `fromid` AND `private`='yes') ORDER BY id DESC"; $conn = his_getDBConnection(); # establishes the connection to the database $results = mysqli_query($conn, $sql); # getting the data array while ($row = mysqli_fetch_array($results)) { # creating and naming array $id = $row[id]; $uid = $row[uid]; $time = $row[time]; $rd = mysqli_fetch_row(mysqli_query($GLOBALS["___mysqli_ston"], "SELECT donor,warn,immunity FROM {$TABLE_PREFIX}users WHERE id={$uid}")); $row["donor"] = $rd[0]; $row["warn"] = $rd[1]; $row["immunity"] = $rd[2]; unset($rd); if ($row["warn"] == "no" or $uid == 0) { $st = ""; } else { $st = "<img src='images/warn.gif'>"; } if ($row["immunity"] == "no" or $uid == 0) { $set = ""; } else { $set = "<img src='images/shield.png'>"; } $name = user_with_color($row[name]); $text = $row[text]; $getsbox = @mysqli_fetch_array(@mysqli_query($GLOBALS["___mysqli_ston"], "SELECT * FROM {$TABLE_PREFIX}users WHERE id=" . $uid)); $sbox = "{$getsbox['sbox']}"; if ($sbox == "no" || $uid == "0") { //make sure system can still post # if no name is present somehow, $name and $text are set to the strings under # we assume all must be ok, othervise no post will be made by javascript check # if ($name == '') { $name = 'Anonymous'; $text = 'No message'; } //private chat if ($row["private"] == "yes") { $name = "<b><font color=orangered>[PM]</font></b> " . user_with_color($row["name"]) . ""; } $name = $name . $st . $set . get_user_icons($row); # we lego put together our chat using some conditions and css and javascript this time print "<span class='name'>" . date("d/m/Y H:i:s", $time - $offset) . " | <a href=\"javascript:windowunder('index.php?page=userdetails&id=" . $uid . "')\">" . $name . "</a>:</span>"; global $CURUSER; if ($CURUSER["admin_access"] != "yes" && $CURUSER["uid"] != "" . $uid . "") { } else { # edit/delete buttons --> print "<div style='text-align:right;\n margin-top:-13px;\n margin-bottom:-3.5px;\n '>\n <a href='index.php?page=allshout&sid={$id}&edit'><img border='0' class='EditSwap' src='images/canvas.gif' alt='' /></a>\n <a onclick=\"return confirm('" . str_replace("'", "\\'", DELETE_CONFIRM) . "')\" href='index.php?page=allshout&sid={$id}&delete'>\n <img border='0' class='DeleteSwap' src='images/canvas.gif' alt='' /></a>\n </div>"; } # chat output --> print "<div class='chatoutput'>" . format_shout($text) . "</div>"; } } }