19/04/2010, 19:41
|
| | Fecha de Ingreso: abril-2010
Mensajes: 2
Antigüedad: 14 años, 7 meses Puntos: 0 | |
Respuesta: Ayuda exception en coldfusion ): Saludos
Encontre la fuente verdadera del error, es la siguiente:
ErrNumber 0
Message Element ANUSER.USERID is undefined in SESSION.
Resolvedname SESSION
Sin embargo ya revise la parte del codigo donde esta la inicializacion de la variable sin embargo no busco que podria estar mal, el codigo es el siguiente:
Código:
<cfcomponent hint="User session structure">
<cffunction name="init" access="public" output="no" returntype="void" hint="Initialize user session">
<cfset var q = ""/>
<cfset var q2 = ""/>
<cfset var i = 0/>
<cfset var j = 0/>
<cfset var allowAccess = false/>
<cfset var anuser = structNew()/>
<cfset var trackCookie = "ANX-T-#hash(application.applicationName)#"/> <!--- return visitor tracking cookie --->
<cfset var cookieList = ""/>
<cfinclude template="#application.virtualPaths.CFLIBS#/agentlib.cfm"/> <!--- agent detection library --->
<!--- create new user session --->
<cfscript>
anuser.userID = 0;
anuser.identifier = createUUID(); /* used for record lock tracking */
anuser.firstName = "";
anuser.lastName = "";
anuser.email = "";
anuser.status = "new";
anuser.toolAccess = false; /* flag for tools */
anuser.userGroups = ""; /* list of user group identifiers, set default so not empty list */
anuser.userGroupIDs = ""; /* list of user group IDs */
anuser.authGroupIDs = ""; /* list of authorized groups */
anuser.defaultGroupID = 0; /* default url group ID (token) */
anuser.currentGroupID = 0; /* token to ensure correct group for embedded urls using -1 groupid reference */
anuser.userRoles = "anonymous"; /* role uuid */
anuser.userRoleIDs = 0; /* role ids */
anuser.language = listFirst(application.config.SUPPORTED_LOCALES); /* default locale first: English (US) */
anuser.localeCode = ""; /* locale code: form en_US */
anuser.sessionTSStart = now();
anuser.lastAccess = anuser.sessionTSStart;
anuser.authCode = hash(anuser.identifier); /* used to access secure content/feeds without login */
anuser.screenMode = "default"; /* can be used to set output format by selecting css */
anuser.validDomain = application.assetnow.anxdomain(cgi.server_name);
anuser.userCommentIDs = ""; /* track comments posted during session */
/* authorize node ids, content ids access permissions for tools user */
anuser.accessContent = structNew();
anuser.accessNode = structNew();
/* vars for tracking metrics */
anuser.trackUser = true; /* false = exclude from analytics tracking set by exclude IPs setting param */
anuser.browser = userAgent(cgi.http_user_agent); /* detect browser - library function */
anuser.browserSettings = userBrowser(cgi.http_user_agent); /* get browser type, version, OS */
anuser.connectionType = 0; /* connection speed: 33, 56, 64, 128, 384, 768, 1500, 3000 - set on first session update if track cookie available */
anuser.campaigns = 0; /* tracks campaigns with ids passed in request from url/form */
anuser.cookieVisits = 0; /* repeat visitor tracking */
anuser.cookieTSFirstVisit = anuser.sessionTSStart;
anuser.cookieTSLastVisit = anuser.sessionTSStart;
anuser.countryCode = "XX"; /* unknown */
anuser.readOnlyNodeIDs = 0;
</cfscript>
<!--- get geolocation if enabled --->
<cfif application.geoInit>
<cfset anuser.countryCode = application.geoLocator.findCountry(cgi.remote_addr)/>
<cfif len(anuser.countryCode) eq 0>
<cfset anuser.countryCode = "XX"/> <!--- XX = unknown/other code --->
</cfif>
</cfif>
<!--- read tracking cookie --->
<cfif structKeyExists(cookie,trackCookie)>
<cftry>
<cfset cookieList = decrypt(cookie[trackCookie],application.applicationName)/>
<cfset anuser.cookieVisits = listGetAt(cookieList,1,"|") + 1/> <!--- visit count --->
<cfset anuser.cookieTSFirstVisit = listGetAt(cookieList,2,"|")/> <!--- first visit timestamp --->
<cfset anuser.cookieTSLastVisit = listGetAt(cookieList,3,"|")/> <!--- last visit timestamp --->
<cfset anuser.cookieUUID = listGetAt(cookieList,4,"|")/> <!--- user uuid --->
<cfcatch type="any">
<cfset anuser.cookieVisits = 1/>
<cfset anuser.cookieTSFirstVisit = now()/>
<cfset anuser.cookieTSLastVisit = anuser.cookieTSFirstVisit/>
<cfset anuser.cookieUUID = createUUID()/>
</cfcatch>
</cftry>
</cfif>
<!--- create/update tracking cookie, "repeat" visitor determined from stored last visit timestamp --->
<cftry>
<cfset cookieList = "#anuser.cookieVisits#|#anuser.cookieTSFirstVisit#|#now()#|#anuser.identifier#"/>
<cfcookie name="#trackCookie#" value="#encrypt(cookieList,application.applicationName)#" expires="never"/>
<cfcatch/>
</cftry>
<!--- get all anonymous, link access groups --->
<cfquery name="q" username="#application.config.DSN_USERNAME#" password="#application.config.DSN_PASSWORD#" datasource="#application.config.DSN#">
select gGroupID, gIdentifier, gRestrict, gAuthenticate
from groups
where gAuthenticate in (0,1) <!--- anonymous, link access groups --->
and (gStatus = 1 or (gStatus = 2 and #createODBCDateTime(dateAdd("n",application.config.SERVER_TIME_OFFSET_MINUTES,now()))# between gTSOn and gTSOff))
<cfif application.geoInit> <!--- only apply location restrictions if geolocator available --->
and gGroupID not in (select g.gGroupID
from countries cy, groups g, groups_countries gc
where cy.cyCountryID = gc.gcCountry_ID
and g.gGroupID = gc.gcGroup_ID)
or gGroupID in (select g.gGroupID
from countries cy, groups g, groups_countries gc
where cy.cyCountryID = gc.gcCountry_ID
and g.gGroupID = gc.gcGroup_ID
and cy.cyCountryCode = '#anuser.countryCode#')
</cfif>
order by gListOrder DESC;
</cfquery>
<!--- list of user authorized groups, used for global access permissions --->
<cfloop index="i" from="1" to="#q.recordCount#">
<!--- test for valid country --->
<cfquery name="q2" username="#application.config.DSN_USERNAME#" password="#application.config.DSN_PASSWORD#" datasource="#application.config.DSN#">
select cy.cyCountryCode
from countries cy, groups g, groups_countries gc
where cy.cyCountryID = gc.gcCountry_ID
and g.gGroupID = gc.gcGroup_ID
and g.gGroupID = #q.gGroupID[i]#;
</cfquery>
<!--- validate authenticated groups --->
<cfif listLen(q.gRestrict[i]) eq 0 and q2.recordCount eq 0>
<cfset anuser.authGroupIDs = listAppend(anuser.authGroupIDs,q.gGroupID[i])/>
<cfelse>
<cfset allowAccess = false/>
<!--- IP address takes priority over country to grant access --->
<cftry>
<cfif listLen(q.gRestrict[i]) neq 0> <!--- test for valid IP address --->
<cfscript>
for (j=1; j lte listLen(q.gRestrict[i]); j=j+1) {
if (reFindNoCase(listGetAt(q.gRestrict[i],j),cgi.remote_addr)) allowAccess = true;
}
</cfscript>
</cfif>
<cfif allowAccess eq false and listFindNoCase(valueList(q2.cyCountryCode),anuser.countryCode) neq 0> <!--- test for valid country --->
<cfset allowAccess = true/>
</cfif>
<cfcatch type="any">
<cfset allowAccess = false/> <!--- any errors then not valid auth access --->
</cfcatch>
</cftry>
<cfif allowAccess>
<cfset anuser.authGroupIDs = listAppend(anuser.authGroupIDs,q.gGroupID[i])/>
</cfif>
</cfif>
<cfif q.gAuthenticate[i] eq 0> <!--- add anonymous authenticate groups --->
<cfif listLen(q.gRestrict[i]) eq 0 and q2.recordCount eq 0> <!--- no IP access or country restriction --->
<cfset anuser.userGroups = listAppend(anuser.userGroups,q.gIdentifier[i])/>
<cfset anuser.userGroupIDs = listAppend(anuser.userGroupIDs,q.gGroupID[i])/>
<!--- default group is first anonymous group --->
<cfif anuser.defaultGroupID eq 0 and q.gGroupID[i] neq application.assetnow.everyoneGroupID>
<cfset anuser.defaultGroupID = q.gGroupID[i]/>
</cfif>
<cfelse>
<cfset allowAccess = false/>
<!--- IP address takes priority over country to grant access --->
<cftry>
<cfif listLen(q.gRestrict[i]) neq 0> <!--- test for valid IP address --->
<cfscript>
for (j=1; j lte listLen(q.gRestrict[i]); j=j+1) {
if (reFindNoCase(listGetAt(q.gRestrict[i],j),cgi.remote_addr)) allowAccess = true;
}
</cfscript>
</cfif>
<cfif allowAccess eq false and listFindNoCase(valueList(q2.cyCountryCode),anuser.countryCode) neq 0> <!--- test for valid country --->
<cfset allowAccess = true/>
</cfif>
<cfcatch type="any">
<cfset allowAccess = false/> <!--- any errors then no access --->
</cfcatch>
</cftry>
<cfif allowAccess>
<cfset anuser.userGroups = listAppend(anuser.userGroups,q.gIdentifier[i])/>
<cfset anuser.userGroupIDs = listAppend(anuser.userGroupIDs,q.gGroupID[i])/>
<!--- default group is first anonymous group --->
<cfif anuser.defaultGroupID eq 0 and q.gGroupID[i] neq application.assetnow.everyoneGroupID>
<cfset anuser.defaultGroupID = q.gGroupID[i]/>
</cfif>
</cfif>
</cfif>
</cfif>
</cfloop>
<!--- ensure valid lists for queries --->
<cfif listLen(anuser.userGroups)eq 0>
<cfset anuser.userGroups = anuser.identifier/>
</cfif>
<cfif listLen(anuser.userGroupIDs)eq 0>
<cfset anuser.userGroupIDs = 0/>
</cfif>
<cfif listLen(anuser.authGroupIDs)eq 0>
<cfset anuser.authGroupIDs = 0/>
</cfif>
<!--- store user data in session --->
<cfset session.anuser = anuser/>
</cffunction>
</cfcomponent>
Si alguien tiene alguna idea se lo agradeceria mucho. Por cierto en mi localhost con CF8 application server funciona bien, el host donde puse el sitio tiene la version 9 y ahi es donde me marca el error, sera por algo de las versiones?
Gracias de antemano |