topage(get_operator_name($operator)) ); $userid = ""; if( isset($_GET['userid'])) { $userid = verifyparam( "userid", "/^.{0,63}$/", ""); } function threads_by_userid($userid) { if ($userid == "") { return null; } $link = connect(); $query = sprintf("select unix_timestamp(dtmcreated) as created, unix_timestamp(dtmmodified) as modified, ". " threadid, remote, agentName, userName ". "from chatthread ". "where userid=\"$userid\" order by created DESC", $userid); $result = mysql_query($query, $link) or die(' Query failed: ' .mysql_error().": ".$query); $foundThreads = array(); while ($thread = mysql_fetch_array($result, MYSQL_ASSOC)) { $foundThreads[] = $thread; } mysql_free_result($result); mysql_close($link); return $foundThreads; } $found = threads_by_userid($userid); setup_pagination($found,6); start_html_output(); require('../view/userhistory.php'); ?>