Safe form data

Discussion in 'Programming' started by ashl1, Feb 24, 2008.

  1. #1
    My problem is.
    The logining of user is save in Session variable. It leaves in 20
    minutes for default. If user fill Form and sent data after
    automatically exite, he relocated to login.cfm.
    I want to safe data what he wrote.
    I tried to save form data in application.cfm to session.open_form. The
    code is:
    <cfif session.login is ''>
     <cfif not (GetBaseTemplatePath() contains 'enter.cfm')>
       <cfset session.open_path = 'http://'&cgi.http_host&cgi.SCRIPT_NAME>
       <cffile action="append"
    file="#GetDirectoryFromPath(GetBaseTemplatePath())#a.txt"
    output="#StructKeyList(form)#">
       <cfdump var="#form#">
       <cfif not structIsEmpty(form)>
           <cfset Session.open_form = form>
       </cfif>
       <cflocation url="enter.cfm" addtoken="no">
     </cfif>
    <cfelse>
     <cfif not StructIsEmpty(session.open_form)>
           <cfdump var="#session.form#">
           <cfset form = session.open_form>
       <cfset session.open_form = StructNew()>
     </cfif>
    </cfif>
    But when I do it, the FORM data not saved and cfdump sayd: "Struct is
    empty". If you look, i write to file list of form's key but this file
    is empty.
    If I delete the string "<cflocation url="enter.cfm" addtoken="no">,
    certainly the "cfdump" is show me normal data.
    How I save data, because i see that in php scripts it worked.
     
    ashl1, Feb 24, 2008 IP
  2. websiteideas

    websiteideas Well-Known Member

    Messages:
    1,406
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    130
    #2
    why are you saving the form data in application.cfm? Why not save it on the form page?
     
    websiteideas, Mar 8, 2008 IP
  3. ashl1

    ashl1 Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Because if user not logged it must locate to "enter.cfm" page for Login. "Application.cfm" script deside is it user logged for all page into security area. I think you want say to decide if user can view this page(for example: "test.cfm") and not locate to "enter.cfm". "test.cfm" script safe form data and locate to "enter.cfm" page if user not logged in. Is it right, what will you want to say?
     
    ashl1, Mar 10, 2008 IP