Set up a Session Variable

Hi,
How to setup a session variable of User id in PHP in
Dreamweaver Style. Is it possible to assign the session variable
value equal to user id from the recordset......if yes i need the
procedure. Thanks in advance.

prashi123 wrote:
> How to setup a session variable of User id in PHP in
Dreamweaver Style. Is it
> possible to assign the session variable value equal to
user id from the
> recordset......if yes i need the procedure.
There is no "Dreamweaver style" for setting up a session
variable. You
do it in exactly the same way as for any PHP page. Put this
at the
beginning of the page:
session_start();
Retrieve the value that you want from the recordset and
assign it to a
session variable like this:
$_SESSION['user_id'] = $row_recordsetName['user_id'];
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/

Similar Messages

  • Code to set and destroy session variables in Java Server Pages(JSP)

    code to set and destroy session variables in Java Server Pages(JSP)
    we have use following statement to set session variable
    session.setAttribute("userClient",id);
    we have use following statement to destroy session variable
    session.setAttribute("userClient","");
    and
    the session.invalidate() is not working
    Plz. solve this probem

    code to set and destroy session variables in Java
    Server Pages(JSP)
    we have use following statement to set session
    variable
    session.setAttribute("userClient",id);
    we have use following statement to destroy session
    variable
    session.setAttribute("userClient","");Perhaps if you tried using
    session.setAttribute("userClient", null);
    or
    session.removeAttribute("userClient");
    and
    the session.invalidate() is not workingNot working how?
    >
    Plz. solve this probem

  • How to set a new session variable?

    Hi all,
    Can anybody say how to set a new session variable in istore?

    Hi,
    you can use either
    pageContext.getAttribute(VAR, PageContext.REQUEST_SCOPE);
    or
    <%@page session="true" %>
    session.putValue
    session.getValue
    Hope this will help.
    Thanks
    Gurjeet

  • Using HttpHeader to set value for session variables

    Hi,
    We want to set values for 2 session variables (USER and ROLEID) using HttpHeader in obiee 11g. Has anyone tried this? How can we achieve this?
    I found the below note on the forum for setting value for the USER session variable. how can we set the ROLEID session variable also? is it possible to set values for 2 variables?
    for setting the USER session variable,
    You should add this in $BI_HOME/bifoundation/web/display/authenticationschemas.xml:
    <SchemaKeyVariable source="httpHeader" nameInSource="Proxy-Remote-User" forceValue="SSO"/>
    <AuthenticationSchema name="SSO" displayName="Single Sign On" userID="IMPERSONATE" proxyUserID="NQ_SESSION.RUNAS" options="noLogoffUI noLogonUI">
    <RequestVariable source="httpHeader" type="auth" nameInSource="Proxy-Remote-User" biVariableName="IMPERSONATE" options="required"/>
    </AuthenticationSchema>
    Please suggest.
    Thanks.

    I think maybe your SnmpValue type or value is not corrent.
    1.3.6.1.4.1.7064.201.1.200.100.0 is Enum control type
    when I use
    SnmpValue val = new SnmpString("0");
    It doesn't work, but when I use
    SnmpValue val = new SnmpInt(0);
    It works. I think the JDMK should give some warning message when the type is not correct. :)
    The code is following:
    final SnmpVarBindList setList = new SnmpVarBindList(" set varbind list ");
    SnmpOid oid = new SnmpOid("1.3.6.1.4.1.7064.201.1.200.100.0");
    SnmpValue val = new SnmpInt(0);
    SnmpVarBind valueBind = new SnmpVarBind(oid, val);
    setList.addVarBind( valueBind );
    SnmpRequest setRequest = session.snmpSetRequest(null, setList);

  • Trying to move a list of form variables to session variables of the same name

    I am trying to move a list of form variables to session variables of the same name and I am having a lot of trouble.
    I have never had to post of this forum with a language question in all the 10 years I have been using ColdFusion. I was a qa Engineer @ Allaire/Macromedia back when it was going from one to the other. I have a pretty good grasp of the language.
    I have software that runs off a list. The fieldnames are variable and stored off in an array. It's survey software that runs off a "meta file". In this example; I have the number of fields in the survey set to 12 in the "metafile". I have each field declared in that file in array Session.SurveyField[1] and the above loop works fine. I include this "metafile" at the start of the process.
    I cfloop around a struct and it works wherever I have needed to use it; such as here - writing to the database for example;
    <CFQUERY NAME="InsertRec" DATASOURCE="Survey">
    INSERT into #variables.SurveyTableName#
    (EntryTime
    <cfloop from="1" to="#Session.NumberOfSurveyFields#" index="arrayindex">
    ,#Session.SurveyField[arrayindex]#
    </cfloop>
    <!--- EXAMPLE OF WHAT THE ABOVE GENERATES
    ,q01_name,q02_AcadTechORNA,q03_Water,q04_FirstAid,q05_CPR,q06_LifeGuard,q07_AED
    ,q08_ProjAdv,q09_Color,q10_SantaClaus,q11_Supervisor,q12_SupervisorOpinion --->
       VALUES
        ('#EntryTime#'
    <cfloop from="1" to="#Session.NumberOfSurveyFields#" index="arrayindex">
    <cfset thisname = "Session." & Session.SurveyField[arrayindex]>
    ,'#evaluate(variables.thisname)#'
    </cfloop>
    <!--- EXAMPLE OF WHAT THE ABOVE GENERATES
    ,'#Session.q01_name#','#Session.q02_AcadTechORNA#','#Session.q03_Water#','#Session.q04_Fi rstAid#'
    ,'#Session.q05_CPR#','#Session.q06_LifeGuard#','#Session.q07_AED#','#Session.q08_ProjAdv# ',
    ,'#Session.q09_Color#','#Session.q10_SantaClaus#','#Session.q11_Supervisor#','#Session.q1 2_SupervisorOpinion#' --->
    </CFQUERY>
    NOW HERE'S THE PROBLEM: I am running into trouble when trying to move the form variables to session variables of the same name. It is the only part of the software that I still need the datanames hard coded and that is a roadblock for me.
    <cfloop from="1" to="#Session.NumberOfSurveyFields#" index="arrayindex">
    <cfset thissessionfield = "Session." & Session.SurveyField[arrayindex]>
    <cfset thisformfield = "Form." & Session.SurveyField[arrayindex]>
    <cfset #thissessionfield# = #evaluate(thisformfield)#>
    </cfloop>
    I have tried it with or without the "evaluate"; same result. It doesn't give an error; it just ignores them (session variables look as such in the next page in the chain)
    q01_name=
    q02_acadtechorna=
    q03_water=
    q04_firstaid=
    q05_cpr=
    q06_lifeguard=
    q07_aed=
    q08_projadv=
    q09_color=
    q10_santaclaus=
    q11_supervisor=
    q12_supervisoropinion=
    Note: they exist because I CFPARAM them in a loop like the above at the start of the procedure) - and this works just fine!
    <cflock scope="Session" type="EXCLUSIVE" timeout="30">
    <cfloop from="1" to="#Session.NumberOfSurveyFields#" index="arrayindex">
    <cfset dataname = "Session." & Session.SurveyField[arrayindex]>
    <cfparam name="#variables.dataname#" default="">
    </cfloop>
    </cflock>
    I EVEN tried exploiting the Form.Fieldnames list using CFLoop over the list and the same sort of logic within and it still gives me nothing....
    Here's the FORM.FIELDNAMES value
    "Q01_NAME,Q02_ACADTECHORNA,Q03_WATER,Q04_FIRSTAID,Q05_CPR,Q06_LIFEGUARD,Q07_AED,Q08_PROJAD V,Q09_COLOR,
    Q10_SANTACLAUS,Q11_SUPERVISOR,Q12_SUPERVISOROPINION"
    Here's the logic; SAME RESULT - The session variables don't get set.
    <cfoutput>
    <cfloop list="#Form.FieldNames#" index="thisfield">
    <!--- <br>#thisfield# --->
    <cfscript>
    thisSESSIONfield = "Session." & thisfield;
    thisFORMfield = "Form." & thisfield;
    #thisSESSIONfield# = #thisFORMfield#;
    </cfscript>
    </cfloop>
    </cfoutput>
    The CFPARAM in a loop with variable output name works just fine; so does the post (which I included above) as does the SQL Create, Param Form Variables, Param Session Variables, etc.
    THIS even works for moving BLANK to each session variable, to zero them all out at the end of the process;
    <cflock scope="Session" type="EXCLUSIVE" timeout="30">
    <cfloop from="1" to="#Session.NumberOfSurveyFields#" index="arrayindex">
    <cfset thislocalfield = Session.SurveyField[arrayindex]>
    <cfscript>
    thissessionfield = "Session." & thislocalfield;
    </cfscript>
    <cfset #thissessionfield# = "">
    </cfloop>
    </cflock>
    Expanding on that code, you would think this would work, but it doesn't;
    <cfloop from="1" to="#Session.NumberOfSurveyFields#" index="arrayindex">
    <cfset thislocalfield = Session.SurveyField[arrayindex]>
    <cfscript>
    thissessionfield = "Session." & thislocalfield;
    thisformfield = "Form." & thislocalfield;
    </cfscript>
    <!--- debug --->
    <!--- <cfoutput>#thissessionfield# = "#evaluate(thisformfield)#"</cfoutput><br> --->
    <cfoutput>
    <cfset #thissessionfield# = "#evaluate(thisformfield)#">
    </cfoutput>
    </cfloop>
    And see that debug code in the middle? To add insult to injury... When I uncomment that it shows me this. So it certainly looks like this should work....
    Session.q01_name = "Me"
    Session.q02_AcadTechORNA = "N/A"
    Session.q03_Water = "Yes (certificate expired)"
    Session.q04_FirstAid = "Yes (certificate is current)"
    Session.q05_CPR = "No"
    Session.q06_LifeGuard = "Yes (certificate expired)"
    Session.q07_AED = "Yes (certificate expired)"
    Session.q08_ProjAdv = "Yes (certificate expired)"
    Session.q09_Color = "Gray"
    Session.q10_SantaClaus = "Yes"
    Session.q11_Supervisor = "Da Boss"
    Session.q12_SupervisorOpinion = "Not a bad thing"
    There must be some simpler way to do this. This way won't work against all odds even though it seems so much like it should.
    So I end up having to hardcode it; still looking for an automated way to set these #@%$*@!## session variables over the list from the form variables of the same @#@!$#%$%# name. Do I sound frustrated???
    No matter what I do, if I don't HARDCODE like this;
    <cfset Session.q01_name = Form.q01_name>
    <cfset Session.q02_AcadTechORNA = Form.q02_AcadTechORNA>
    <cfset Session.q03_Water = Form.q03_Water>
    <cfset Session.q04_FirstAid = Form.q04_FirstAid>
    <cfset Session.q05_CPR = Form.q05_CPR>
    <cfset Session.q06_LifeGuard = Form.q06_LifeGuard>
    <cfset Session.q07_AED = Form.q07_AED>
    <cfset Session.q08_ProjAdv = Form.q08_ProjAdv>
    <cfset Session.q09_Color = Form.q09_Color>
    <cfset Session.q10_SantaClaus = Form.q10_SantaClaus>
    <cfset Session.q11_Supervisor = Form.q11_Supervisor>
    <cfset Session.q12_SupervisorOpinion = Form.q12_SupervisorOpinion>
    I always get this from my next page because the session variables are empty;
    You must answer question 1.
    You must answer question 2.
    You must answer question 3.
    You must answer question 4.
    You must answer question 5.
    You must answer question 6.
    You must answer question 7.
    You must answer question 8.
    You must answer question 9.
    You must answer question 10.
    I tried duplicate as well, but I can not get the above to work...
    Can anyone help me do this thing that one would think is simple????

    I think if you use structure array syntax you should get the results you want.
    <cfloop from="1" to="#Session.NumberOfSurveyFields#" index="arrayindex">
          <cfset session[Session.SurveyField[arrayindex]] = Form[Session.SurveyField[arrayindex]]>
    </cfloop>
    Or probably even easier.
    <cfset session = duplicate(form)>

  • How to pass session variable value with GO URL to override session value

    Hi Gurus,
    We have below requirement.Please help us at the earliest.
    How to pass session variable value with GO URL to override session value. ( It is not working after making changes to authentication xml file session init block creation as explained by oracle (Bug No14372679 : which they claim it is fixed in 1.7 version  Ref No :Bug 14372679 : REQUEST VARIABLE NOT OVERRIDING SESSION VARIABLE RUNNING THRU A GO URL )
    Please provide step by step solution.No vague answers.
    I followed below steps mentioned.
    RPD:
    ****-> Created a session variable called STATUS
    -> Create Session Init block called Init_Status with SQL
        select 'ACTIVE' from dual;
    -> Assigned the session variable STATUS to Init block Init_Status
    authenticationschemas.xml:
    Added
    <RequestVariable source="url" type="informational"
    nameInSource="RE_CODE" biVariableName="NQ_SESSION.STATUS"/>
    Report
    Edit column "Contract Status" and added session variable as
    VALUEOF(NQ_SESSION.STATUS)
    URL:
    http://localhost:9704/analytics/saw.dll?PortalGo&Action=prompt&path=%2Fshared%2FQAV%2FTest_Report_By%20Contract%20Status&RE_CODE='EXPIRED'
    Issue:
    When  I run the URL above with parameter EXPIRED, the report still shows for  ACTIVE only. The URL is not making any difference with report.
    Report is picking the default value from RPD session variable init query.
    could you please let me know if I am missing something.

    Hi,
    Check those links might help you.
    Integrating Oracle OBIEE Content using GO URL
    How to set session variables using url variables | OBIEE Blog
    OBIEE 10G - How to set a request/session variable using the Saw Url (Go/Dashboard) | GerardNico.com (BI, OBIEE, O…
    Thanks,
    Satya

  • Clearing custom session variable in 5.0

    I have set a custom session variable in a method called in the OnAfterLogin PEI.
    Do I need to ckear this session variable on logout? If so, how do I do that?
    Or does the session variable clear on its own if teh session is abandoned or killed on logout?
    I just want to make sure I am not leaking any memory and do proper housekeeping.
    Thanks!
    Vanita
    Staples

    Sam,
    It appears that you are one of the few installations that actually used a display/formatting page under 4.x. Under 5.0 you have the option of going directly to the source of the card or gatewaying the card. Those are your only two options to my knowledge. I suppose that the answer might rest on using docfetch but this would require a custom CWS.
    Good Luck
    Phil Orion

  • Session variables being lost

    In my onApplicationStart method (which should tell you I'm
    using an Application.cfC, not cfM), I have a cfif loop that passes
    a value to a custom tag and returns a form variable. I'm then
    reassigning that variable to a session variable. In IE, this works
    just fine; in Firefox, though, the session variable is NOT being
    set.
    What might be causing this, and is there a workaround?

    The issue referred to an external CF custom tag, which called
    another demo application to set a testing user. However, after
    further testing, I realize that demo app won't function properly
    with this application, so I've removed it.
    Authentication is being set by an LDAP query; this
    application that I am working on is going to be a sub-application
    of a larger application, and the authenticated user is being set as
    a session variable as well (I think...). However, I'm creating a
    new session variable for this application, and simply passing the
    authenticated user into my app (the outer app uses the variable
    auth_user; I'm using the variable authuser, so there is no name
    conflict).
    Again, it is IE that is not persisting the session. Firefox
    is doing so. I have looked in the advanced settings for IE, and
    there is nothing about persisting session variables to check or
    uncheck. Also, this application will probably be used mostly by
    users using IE 6 with default settings, so I'm going to need to
    find a workaround for IE.
    Your help is most appreciated.

  • GO URL with Session Variable

    I want to use interaction between two reports in different dashboards, which do not share the same tables but the same values.
    When clicking on column A values in Report A, I want to create action link with option to open Report B, presenting column B, which is filtered by value A.
    I also want the prompts in Report B to present the value A, as it was selected by the user on Report A.
    I thought about using GOURL in action link to specific URL. I manage to open Report B, but it is not filtered by A.
    How can I transfer the value A in the URL? how should I add the value A into '&val1=XXX'?
    I also want to transfer other prompt values (e.g. val2 of col2) from A to B. I set this prompt value to session variable, but how can I add it in the GOURL syntax of '&val2=XXX'?

    Hi,
    Check those links might help you.
    Integrating Oracle OBIEE Content using GO URL
    How to set session variables using url variables | OBIEE Blog
    OBIEE 10G - How to set a request/session variable using the Saw Url (Go/Dashboard) | GerardNico.com (BI, OBIEE, O…
    Thanks,
    Satya

  • Checking session variables

    I have an external login service that I'm using to authenticate users.  After logging in, I get an XML file from which I can pull things like user ID and rights.
    The login page redirects to an index page in another folder (which is protected by the authentication service) and on that page, I have a <cfif> statement that looks at rights.
    The rights returned are "J" (for judge) and "A" (for admin), which I'm setting as the session variable: session.rights
    If I do this:
    <cfif session.rights eq "A">
    admin section
    <cfelseif session.rights eq "J">
    judge section
    <cfelse>
    redirect to the login page
    </cfif>
    The else is what triggers.  If I cfoutput #session.rights# I get J, but for some reason, J does not equal J.  I've tried trimming it and everything, to no avail.
    Any ideas?

    Yeah, I've trimmed everything everywhere, to no avail.
    Here's the dump result:
    struct
    emailaddr
    [empty string]
    newitem
    1
    rights
    xml element
    XmlName
    TPEA_USER_TYPE
    XmlNsPrefix
    XmlNsURI
    XmlText
    J
    XmlComment
    XmlAttributes
    struct [empty]
    XmlChildren
    sessionid
    f0306d37e90bce8a818d7d7843e36516f1e7
    tpeauser
    <?xml version="1.0" encoding="UTF-8"?> <NAME_FIRST>Dave</NAME_FIRST> <?xml version="1.0" encoding="UTF-8"?> <NAME_LAST>Johnson</NAME_LAST>
    trackingno
    0
    upacsid
    [empty string]
    upacsserver
    [empty string]
    urltoken
      CFID=26143&CFTOKEN=6071485a4b7e13-F5282421-A324-841F-59919221D2C51604&jsessionid=f0306d37 e90bce8a818d7d7843e36516f1e7 
    userid
    xml element
    XmlName
    USER_ID
    XmlNsPrefix
    XmlNsURI
    XmlText
    25481
    XmlComment
    XmlAttributes
    struct [empty]
    XmlChildren

  • Accessing session variables with php

    I am trying to access the  session variable  $_SESSION['MM_Username']  in one of my php pages, but it is somehow showing empty (i.e it does not contain the username that was entered during login).
    I checked and confirmed that my login.php function is properly setting the MM_Username session variable by echoing it  from the login function.
    So why can't I read it from another php file in the same session?  Do I need to do something else before the session variables can
    be properly read from any php file in the same session?  Any help would be appreciated.

    Here is a test code I am using to access the session variable $_SESSION['MM_username']  from  the php page  test.php. But it is not working.
    I get an empty string all the time for $username. Can any one see something wrong with this code?
    <?php require_once('Connections/MyTestingConn.php'); ?>
    <?php session_start(); ?>
    <?php
    $username = "-1";
    if (isset($_SESSION['MM_username'])) {
      $username = $_SESSION['MM_username'];
      echo $username;
    else
       echo "Eror: can not access session variable";
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Test</title>
    </head>
    <body>
    </body>
    </html>

  • Session Variables to control Datasource used by iBots

    Hello everyone,
    i'd like to know whether it is possible to control the session which is used by iBots.
    What i want to achieve is, that i can start an iBot within a certain session with given parameters, based on session variables.
    I have one SessionVariable "sDB" which can be set to =1 or =2. This is controled via the URL used to start OBIEE.
    Now i want to control my ibots by forcing them to start with sDB=1 or sDB=2 etc.
    Does anybody know a solution. Any hint might help aswell.
    Thanks!

    Thank you David for the response. As you guessed, I'm fairly new with session variables. What I'm looking for is as follows-
    On my Architecture website, I have an html form where clients would enter their design preferences and Submit. The website then sends an email to the client with the details they had entered; for confirmation. This had worked properly with form variables as the email is sent right after the form is filled.
    However, now I have added a License agreement page and a second form with other design details, which has to be filled in before the client's email is sent. So, I've set the Page1 form variables as session variables to carry over to the 4th page where it is sent as email. I am able to retrieve the session variables on the fourth page, but what I require is the correct syntax for using it in the subject field and the message body of the email, so that the clients get them in their email.
    I had earlier used the following php code for sending emails using form variables-
        $to="From: $email";
        $subject="$name, Thank you for visiting our website.";
        $from="[email protected]";
        $msg="Your Reg. details-\r\n\n$name\r\n$address\r\n\nPhone No: $phone \r\nE mail: $email \r\n\nMessage:\n$message";
        $fla=mail($to,$subject,$msg,$from);
    ; where the form variables are- $name, $address, $phone, $email, $message
    I have now set them as session variables-
    <?php
    session_start();
    $_SESSION['name'] = $name;
    $_SESSION['address'] = $address;
    $_SESSION['phone'] = $phone;
    $_SESSION['email'] = $email;
    $_SESSION['message'] = $message;
    ?>
    ; and I'm being able to retrieve them on the 4th subsequent page. As mentioned, what I am looking for is the correct syntax to use this data in a php email code.
    I will be very grateful if you could provide me with a sample php email code for sending an email with session variables in the 'from', 'to', 'subject' and 'message' fields.

  • Can I set a Session Variable from a Dashboard Prompt, using values that are

    Hi All
    Trying to set a Session Variable to an integer value, by letting users select a text value from the drop-down list on a Dashboard Prompt. The goal is to set the input parameter to the IndexCol function, but to provide the end users with a text description of what they are setting.
    Select Value Set Variable Value
    My 0
    My Team 1
    My Companies 2
    My Teams Companies 3
    Any suggestions on how to accomplish this? Certainly we could populate the drop-down from a data source, however I don't see how to populate a variable with something other than the values on the screen.
    The IndexCol function is referenced in a Filter in Answers, and I'm thinking to populate a Session variable using the (Presentation) variable value set from the prompt. But how to do this? I see a reference to a function NQSSetSessionValue(), but cannot find documentation on how it works.
    Any clue will be greatly appreciated.
    Thanks

    Hi kishore..
    Looks like the link u have sent uses advanced SQL tab to set session variables. I want to know if I can use "set variable NQ_SESSION.myvar= @something" in the "SQL results" -while creating a dashboard prompt-.
    Purpose: I want the session variable to be set based on whatever report that im currently in.
    And i dont want to use presentation variables because im using a reset button in my page.
    My reset script resets presentation variables and NOT session variables.
    Thanks in advance
    Loy

  • How to set a lable as the dynamic session variable ?

    I have created a dynamic session variable in admin tool and then I want to create a prompt in dashboard and set label to use this session variable
    I try to use the @{variable} or @{system.variable} in the label text ,but it is not work ,so what is the correct way or does the obiee not support to do like this?

    thx, for responded
    but I have read a topic said if left the label text empty the reference a presentation variable , then it can work , you can see it below:
    http://obiee101.blogspot.in/2009/04/obiee-multi-lingual-prompt.html

  • 'In Between' Date Prompt to set Session Variables???

    Hi
    Im very new to OBIEE and was hoping someone could help me. I have a date prompt using the 'in between' operator based on a date column.
    I am trying to set up a table in the Physical layer of the RPD using a stored proc (EXEC sp_name). The stored proc takes 2 input paramaters - a start data and an end date. These dates i would like to come from the in between prompt. I have set up the physical table structure to receive the results of the request.
    I looked at setting a session variable but it is asking me to insert sql to set the value and i dont want to hit the database outside of the stored proc. Also, even if i have session variables i cant see how to set them to the values in the prompt when using the 'In Between' operator.
    Im really very confused and i have been searching the net and the documentation for any clue.
    Any help would be appreciated
    Thanks

    In between operator doesn't support presentation variable..
    so break this into is into two prompts...and use equal to operator, then you can use them as request variables which will in turn override your session variables.
    in the report use operator between and use these variables in the filter..

Maybe you are looking for