$_GET['start']); if ( isset($_GET['sect']) && !strcmp($_GET['sect'], "persons") ) { $q = "SELECT uname, CONCAT_WS(' ', firstname, lastname) AS fullname FROM ".DB_PREFIX."_users "; $q .= "LEFT JOIN ".DB_PREFIX."_userinfo ON ".DB_PREFIX."_users.id=".DB_PREFIX."_userinfo.userid "; $q .= "WHERE firstname LIKE '".$_GET['start']."%' "; $q .= "OR lastname LIKE '".$_GET['start']."%'"; $q .= "OR uname LIKE '".$_GET['start']."%'"; $ret = $tdb->query($q); $ar = array(); while ( $row = mysql_fetch_array($ret) ) { $un = $row['uname']; $fn = $row['fullname']; if ( strlen($fn) == 0 ) { $fn = $un; } $ar[] = array($un, $fn); } mysql_free_result($ret); print json_encode($ar); } else if ( isset($_POST['sect']) && !strcmp($_POST['sect'], "available") ) { $ret = $tdb->query("SELECT uname FROM ".DB_PREFIX."_users WHERE uname='".$_POST['name']."'"); $num = mysql_num_rows($ret); if ( $num == 0 ) { print 0; } else { print 1; } } else if (isset($_POST['askForFolderList'])) { session_start(); require_once('includes/user.php'); $ret = $tdb->query("SELECT * FROM ".DB_PREFIX."_folders WHERE userID=".$user->getId()); $res = array(); while ( $row = mysql_fetch_array($ret) ) { $res[] = $row; } print json_encode($res); } else if (isset($_POST['getPsyhvelNotice']) && is_numeric($_POST['getPsyhvelNotice']) && $_POST['getPsyhvelNotice']=123) { session_start(); $notice = 0; if (isset($_SESSION['tops_notice'])) { $notice = $_SESSION['tops_notice']; unset($_SESSION['tops_notice']); } print json_encode($notice); } ?>