Advertisement
Guest User

Untitled

a guest
Jun 10th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. <body>
  3.  
  4. <!--- 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. --->
  5. <cfif not IsDefined("SESSION.User.ID")>
  6.     <cfoutput>session not defined<br /></cfoutput>
  7.     <cfif IsDefined("Form.username") AND IsDefined("Form.password")>
  8.         username and password exist <br />
  9.         <cfif Trim(Form.username) IS NOT "" AND Trim(Form.password) IS NOT "">
  10.             username and password are not null
  11.             <cfquery datasource="mysqlcf_btsb" username="btsb" password="W4tkins" name="q_index">
  12.             Select fn, ln, un, pw, privy, sessionkey from htlogin where un = '#Trim(form.username)#' and pw = '#Trim(form.password)#';
  13.             </cfquery>
  14.             <cfset SESSION.User = structNew()>
  15.             <cfset SESSION.User.ID = GenerateSecretKey("AES")>
  16.             <cfset SESSION.User.key = q_index.sessionkey>
  17.             <cfset SESSION.User.privy = q_index.privy>
  18.         </cfif>
  19.     </cfif>
  20. <cfelse>
  21.     <cfset SESSION.User = structNew()>
  22.     <cfset SESSION.User.ID = GenerateSecretKey("AES")>
  23.     <cfset SESSION.User.key = Left(GenerateSecretKey("AES"),Len(GenerateSecretKey("AES")))>
  24.     <cfset SESSION.User.privy = "TOTAL">
  25.     <cfoutput>SESSION.User.ID:#SESSION.User.ID#</cfoutput>
  26. </cfif>
  27.  
  28. <!--- 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. --->
  29. <cfset mnu_login_color = "black">
  30. <cfset mnu_add_color = "black">
  31. <cfset mnu_viewprint_color = "black">
  32. <cfset mnu_editdelete_color = "black">
  33. <cfset mnu_export_color = "black">
  34. <cfswitch expression="#Decrypt(SESSION.User.ID, SESSION.User.key, "AES")#">
  35.     <cfcase value="LoggedIn">
  36.         <cfset mnu_logout_color = "red">
  37.         <cfset tmp_page_body="tmp_logged_in.cfm">
  38.         <cfset page_title = "Please Make A Selection">
  39.     </cfcase>
  40.     <cfdefaultcase>
  41.         <cfset mnu_login_color = "red">
  42.         <cfset tmp_page_body="tmp_login.cfm">
  43.         <cfset page_title = "Please Log In">
  44.     </cfdefaultcase>
  45. </cfswitch>
  46.  
  47.  
  48. <!--- The menu template is loaded; the page title is displayed; the present page-body template is loaded. --->      
  49. <div class="header_1"><a class="page_title">&nbsp; Back To School Bash Data Entry &nbsp;</a></div>
  50.     <div class="header_2">
  51.         <div class="menu_bar">
  52.             <cfinclude template = "#tmp_menu.cfm#">
  53.         </div>
  54.     </div>
  55.     <div class="header_3" />
  56.         <div id="Content">
  57.             <div id="Content_Inner">
  58.                 <div class="page_title">
  59.                     <cfoutput>#page_title#</cfoutput>
  60.                 </div>
  61.                 <p><cfinclude template = "#tmp_page_body#"></p>
  62.             </div>
  63.         <div class="header_3">
  64.     </div>
  65. </div>
  66. </body>
  67. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement