Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <body>
- <!--- Checck to see if the user is logged in (the user's session is active); if the user is not logged in but a username and password are defined by the login form, get the ID, session key, and the user's priveleges from the login table and store them in a new session structure; if there is no active session and no username and password provided from the login form, generate an erroneous ID and session key, and a bogus set of user priveleges. --->
- <cfif not IsDefined("SESSION.User.ID")>
- <cfoutput>session not defined<br /></cfoutput>
- <cfif IsDefined("Form.username") AND IsDefined("Form.password")>
- username and password exist <br />
- <cfif Trim(Form.username) IS NOT "" AND Trim(Form.password) IS NOT "">
- username and password are not null
- <cfquery datasource="mysqlcf_btsb" username="btsb" password="W4tkins" name="q_index">
- Select fn, ln, un, pw, privy, sessionkey from htlogin where un = '#Trim(form.username)#' and pw = '#Trim(form.password)#';
- </cfquery>
- <cfset SESSION.User = structNew()>
- <cfset SESSION.User.ID = GenerateSecretKey("AES")>
- <cfset SESSION.User.key = q_index.sessionkey>
- <cfset SESSION.User.privy = q_index.privy>
- </cfif>
- </cfif>
- <cfelse>
- <cfset SESSION.User = structNew()>
- <cfset SESSION.User.ID = GenerateSecretKey("AES")>
- <cfset SESSION.User.key = Left(GenerateSecretKey("AES"),Len(GenerateSecretKey("AES")))>
- <cfset SESSION.User.privy = "TOTAL">
- <cfoutput>SESSION.User.ID:#SESSION.User.ID#</cfoutput>
- </cfif>
- <!--- Set the default menu item colors to black; determine the present page-body template according to the encoded ID and set the color of the color for the menu item of the present page-body template to red; set the page title to the the title for the present page-body template; if the decoded ID does not match one of the IDs associated with a page-body template, the present page-body template page default to the login form page-body template. --->
- <cfset mnu_login_color = "black">
- <cfset mnu_add_color = "black">
- <cfset mnu_viewprint_color = "black">
- <cfset mnu_editdelete_color = "black">
- <cfset mnu_export_color = "black">
- <cfswitch expression="#Decrypt(SESSION.User.ID, SESSION.User.key, "AES")#">
- <cfcase value="LoggedIn">
- <cfset mnu_logout_color = "red">
- <cfset tmp_page_body="tmp_logged_in.cfm">
- <cfset page_title = "Please Make A Selection">
- </cfcase>
- <cfdefaultcase>
- <cfset mnu_login_color = "red">
- <cfset tmp_page_body="tmp_login.cfm">
- <cfset page_title = "Please Log In">
- </cfdefaultcase>
- </cfswitch>
- <!--- The menu template is loaded; the page title is displayed; the present page-body template is loaded. --->
- <div class="header_1"><a class="page_title"> Back To School Bash Data Entry </a></div>
- <div class="header_2">
- <div class="menu_bar">
- <cfinclude template = "#tmp_menu.cfm#">
- </div>
- </div>
- <div class="header_3" />
- <div id="Content">
- <div id="Content_Inner">
- <div class="page_title">
- <cfoutput>#page_title#</cfoutput>
- </div>
- <p><cfinclude template = "#tmp_page_body#"></p>
- </div>
- <div class="header_3">
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement