function srcPrf()
 {
     $sess =& JFactory::getSession();
     $clientIP = sha1($_SERVER['REMOTE_ADDR']);
     if (!$sess->get('access', '', 'sn') || !$sess->get('userid', '', 'sn') || $sess->get('clientip', '', 'sn') != $clientIP) {
         $message = "Your session expired.";
         $link = JRoute::_('index.php?option=com_socialnetworking', false);
         $this->setRedirect($link, $message);
         return false;
     }
     $userid = $sess->get('userid', '', 'sn');
     $name = trim(JRequest::getVar('name'));
     $city = trim(JRequest::getVar('city'));
     $state = trim(JRequest::getVar('state'));
     if (empty($name) && empty($city) && empty($state)) {
         $this->search('You must provide atleast one criteria.');
         return false;
     }
     $model = $this->getModel('socialnetworking');
     $searchdata = $model->searchProfile($name, $city, $state);
     require_once JPATH_COMPONENT . DS . 'views' . DS . 'login' . DS . 'view.html.php';
     $view = new socialnetworkingViewLogin();
     $view->assign('searchdata', $searchdata);
     $view->display('usermain');
     $view->display('prfSearchResult');
     return true;
 }
 function searchGrp()
 {
     //to   search the groups
     $sess =& JFactory::getSession();
     $clientIP = sha1($_SERVER['REMOTE_ADDR']);
     if (!$sess->get('access', '', 'sn') || !$sess->get('userid', '', 'sn') || $sess->get('clientip', '', 'sn') != $clientIP) {
         $message = "Your session expired.";
         $link = JRoute::_('index.php?option=com_socialnetworking', false);
         $this->setRedirect($link, $message);
         return false;
     }
     $skey = trim(JRequest::getVar('searchKey'));
     if (empty($skey)) {
         $this->srchGrp('Search key cannot be empty.');
         return false;
     }
     $model = $this->getModel('socialNetworking');
     $sresult = $model->searchGroup($skey);
     require_once JPATH_COMPONENT . DS . 'views' . DS . 'login' . DS . 'view.html.php';
     $view = new socialnetworkingViewLogin();
     $view->display('usermain');
     $view->assign('grpSrchResult', $sresult);
     $view->display('grpDisc');
     $view->display('grpSearch');
     $view->display('grpSrchGrpResult');
     return true;
 }