/**	Function used to get the session id which was set during login time
 *	@param int $id - contact id to which we want the session id
 *	return string $sessionid - return the session id for the customer which is a random alphanumeric character string
 **/
function getServerSessionId($id)
{
    global $adb;
    $adb->println("Inside the function getServerSessionId({$id})");
    //To avoid SQL injection we are type casting as well as bound the id variable. In each and every function we will call this function
    $id = (int) $id;
    $sessionid = Vtiger_Soap_CustomerPortal::lookupSessionId($id);
    if ($sessionid === false) {
        $query = "select * from vtiger_soapservice where type='customer' and id=?";
        $sessionid = $adb->query_result($adb->pquery($query, array($id)), 0, 'sessionid');
        Vtiger_Soap_CustomerPortal::updateSessionId($id, $sessionid);
    }
    return $sessionid;
}