Help Needed in checking session variable
In a sample site, I am calling a bounded task flow from an unbounded task flow. In the called taskflow the default activity is a router which checks the session variable, and the home page will be loaded only if the session variable is not null. If session variable is null router will lead to a page dispalying 'session expired'. But even after clearing the session if I copy pasted the previous url, the home page is loading. But when I call bounded taskflow from a bounded taskflow, it is working fine. Can anyone suggest any solution? Thanks in advance
Thanks for the reply. I'm using jdev 11.1.1.5.0.. I'm just trying with a sample example. I have a login page and when the user logins, the user name is stored in session. the loginpage view activity is in adfc config unbounded taskflow. The login credentials is validated in a backing bean and based on the return value, if the login is valid, a bounded taskflow 'hometaskflow' is called. In this bounded taskflow, the default activity is a router wchich checks the username stored in session. If the username is not null it will lead to the 'homepage' view. Else if it is null it will lead to a 'sessionexpired' view.
In the java class of login page I'm accessing the session variable as shown
public Username getSessionBean()
Username username =
(Username)resolveExpression("#{Username}");
return username;
public static Object resolveExpression(String expression)
FacesContext facesContext = FacesContext.getCurrentInstance();
Application app = facesContext.getApplication();
ExpressionFactory elFactory = app.getExpressionFactory();
ELContext elContext = facesContext.getELContext();
ValueExpression valueExp =
elFactory.createValueExpression(elContext, expression,
Object.class);
return valueExp.getValue(elContext);
On login button click the function being executed is as shown
public String onLoginClick() {
if(String.valueOf(itUserName.getValue()).equals("admin")
&& String.valueOf(itPassword.getValue()).equals("admin"))
Username username=getSessionBean();
username.setUsername(itUserName.getValue().toString());
return "success";
else {
return "invalid";
And to set username as null on logout, I used this function on logout click
public void clearSession()
Username username=getSessionBean();
username.setUsername(null);
The EL expression used to check the value of session variable is
#{sessionScope.Username.username==null} outcome is expired
#{sessionScope.Username.username!=null} outcome is active
This worked when I used in a bounded taskflow, which is being called from another bounded taskflow. But not working in this scenario...
Similar Messages
-
Need assistance with session variable
Hello All, I am new to BIEE product. I have defined an initialization block - called it 'NQ_SESSION' and a session variable 'REVENUE'.
Then, I created a sample report in Answers where I am attempting to use this variable. At report level, on a amount column I am adding a function
"Sales Facts".AMOUNT/VALUEOF(NQ_SESSION.REVENUE)
But the Answers does not return the correct value. Why? Thank you, SonyaPlease give us more details :
- what is the request of your init block ?
- what are the returned results ?
- can you copy the request generated by OBIEE ? (in the session logs)
Other question : When you just display the value of the variable, do you have the right value ? -
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 -
Help Needed in Checking data values.
There a table which has got the name, address, ph_number of the organisational division.These deailts are fetched from few other tables and stored in a table.
Could you suggest how to check the details(name,address,ph_number) stored in this table and to create/update a field in a table which has the following number ,along with other the details of the divisions,
‘2’ – Creation of the new New Divisions
‘3’ – Amendment – i.e. Changed Division (either in the Address, Name or Ph_number)
‘4’ – Not Changed
blank = undetermined
Could you pls help in this.
Thanks a lot.Hallo,
with trigger
Something like this
create or replace trigger scott.trg_org
before update or insert on scott.tbl_org
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
begin
if inserting THEN
:new.flag := '2';
else
if :old.adress != :new.adress
or :old.name != :new.name
or :old.phoneNr != :new.phoneNr
then
:new.flag := '3';
else
:new.flag := '4';
end if;
end if;
end;Regards
Dmytro Dekhtyaryuk -
Help needed in Customer exit variable
Hi Experts,
We have a scenario as below.
User enters fiscal year period.Based on the fiscal year period,entire year will be selected.
Row would contains
0fiscper3(Fiscal months from Jan to Dec)
Column contains Amount(Actual or Forecast)--There is a restricted keyfigure on amount.If value type=60 then forecast
and value type=10 then actual amount
If the user enters 002.2010 then it should give Actual values ie value type=10 for 001.2010 and 002.2010.For all values greater than 002.2010, it should give forecast values(value type=60)
Report Format.
Jan----
Actual Value(value type=10 in the column for amount)
Feb----
Actual Value(value type=10 in the column for amount)
Mar----
Forecast Value(value type=60 in the column for amount)
Apr----
Forecast Value(value type=60 in the column for amount)
May----
Forecast Value(value type=60 in the column for amount)
Jun----
Forecast Value(value type=60 in the column for amount)
Jul----
Forecast Value(value type=60 in the column for amount)
Aug----
Forecast Value(value type=60 in the column for amount)
Sep----
Forecast Value(value type=60 in the column for amount)
Oct----
Forecast Value(value type=60 in the column for amount)
Nov----
Forecast Value(value type=60 in the column for amount)
Dec----
Forecast Value(value type=60 in the column for amount)
I know that i have to create a customer exit variable for value type
But in this scenario.the value for value type may change in each row based on fisper3(month).
How can i obtain such a scenario in the customer exit
Your help will be appreciated.
Thanks,
Senoy
Edited by: senoy laxman on Feb 15, 2010 6:42 AMHi Senoy,
you have to create two customer exit variables for fiscal year period(0fiscper) as given below.
1. for actual values (value type=10), coding in cmod such that showing values less than and equal to user input values.
2. for forecasting values(value type=60,)coding such that showing values greating than user input values.
use the first varible in the first selction and the second varible in the second selection in the given below structure(use the structure in rows)
use the fiscal period user input varible in the third selection in the given structure below.
structure
selection - (Actual)-restrict with value 20 and first customer exit variable .
selection -(Forecast)-restrict with value type 60 and second customer exit variable.
Selection - 0fiscper
Add the key figure 0Amount in the columns or in rows(in the selection of second structure) as per your requirment.
hope this helps you. -
Help needed in servlet sessions
hi,
I m having following servlet with the logon and logout request..
and my problem is that I don't want 2session with same clientID
means a client want to log in ( who is currently logged in with say ClientID=5)
with same ClientID (=5) then he won't be able to do that.. and i m invalidating the session
when client hits logout button ( i don't want to use session time out) but what if he just
shut down his browser without logout. In that case i want to invalidate that session
immediately (as it is necessary for first requirement) i.e. if the session resides in memory
than client won't be able to log in again untill that session automatically invalidated...
so help me!!!!
thanks
bhups
some part of my code in which i m getting and invalidating session is given below.
class myServlet extends HttpServlet{
void doGet(req,res)
Client _client=null;;
HttpSession _session=req.getSession(false);
if(_session!=null)
client=(Client)session.getAttribute("_client");
if(requestID.equals("Login"))
String ClientID=req.getParameter("ClientID");
String Password=req.getParameter("Password");
String AuthenticationStatus=Authentication(ClientID,Password);
if(AuthenticationStatus.equals("Authenticated"))
_session=req.getSession(true);
session.setAttribute("client",new Client(Integer.parseInt(ClientID),Password));
res.sendRedirect("./inbox.html");
else
throw someException();
if(requestID.equals("Logout"))
if(_client!=null)
_session.invalidate();
res.sendRedirect("./login.html");
class Client
private int ClientID;
private String Password;
public Client(int cid,String password)
ClientID=cid;
Password=password;
public int getClientID()
return this.ClientID;
}Hey this can be done using javascript
U have to capture the window close event of the browser and for that event write a javascript function
which calls the logout.jsp page or any other necessary servlets to do the logout process.
a dummy example is given here
someJsp.jsp
<html>
<head>
<script>
function closeSession()
window.navigate("logoff.jsp");
</script>
</head>
<body onUnload="closeSession()">
</body>
</html> -
Help needed regarding check box
Hi,
I have report which displays all the records and at the end it has a check box column. If i select the check box and click on the button 'GO' a mail should be sent to those check box selected.
Please can any one help me in this.
Thanks,user12174050 wrote:
Here the mail is going but if i select more than one check box then mail is not going to the second one selected.Presumably because your call to apex_mail.send is taking place outside of the loop, so it should only send one mail.
And by the way, looking at your process, you have the call: P17_BASE_LOGIN := v_base_login; -if you select multiple chckboxes, :P17_BASE_LOGIN is going to get changed each time, is that your expected behaviour?
Also, don't forget to surround your code with: tags
Ta,
Trent -
Session variables or ???
First I should say I am very much a novice at web design, so
please go easy on me! :)
I am trying to create a "confirmation page" which will
display a recap of information input by the user from an online
registration form. I created a register page using php and MySQL
(which works fine), but I can't seem to figure out how to display
the person's information on a follow up confirmation page. I want
this follow up page to only show the information input by the
single user as a summary (as opposed to showing multiple records
from the database). I thought adding session variables was the
answer, but when I followed the instructions in my manual all I get
is a blank page.
Can anyone help me figure out the easiest way to accomplish
this task? Thanks!Remipub posted in macromedia.dreamweaver:
> Thanks so much for the reply Mark. I checked the php
website you
> provided and it sounds like the first method is the most
ideal.
> Unfortunately I wasn't quite clear on exactly how you
use the
> code. So if I may ask... my manual states that I need to
put in
> the following code at the top of the page:
>
> <?php if (!isset($_SESSION)) session_start(): >?
>
> Do I put this in as the first line on both the data
collection
> page AND the confirmation page?
Yes. On every page that you need to use session variables.
> And when using --
> $_SESSION['ID']=mysql_insert_id(); -- where do I place
this line?
You mentioned that you had a register page that is working
fine. I
assume that you have a mysql_query() with the INSERT command
in there.
Put it immediately after the mysql_query() line.
> Also, I'm assuming I need to add the auto increment
field to the
form. Can this be hidden? Would I need to place it on both
pages (and
can it be as a hidden field on both pages assuming it's even
necessary)?
You won't need it in the form at all. That's the beauty of
using
session variables.
When you want to show that user's information, use
$_SESSION['ID'] with
a MySQL SELECT to pull it from the database. Something like
the
following example[1]:
$query = "SELECT `first`,`last`,`phone` FROM `users` WHERE
`ID` =
$_SESSION['ID']";
$result = mysql_query($query) or die('yada, yada, yada');
if (mysql_numrows($result)) {
$aRow=mysql_fetch_assoc($result);
$first=htmlentities($aRow['first']);
$last=htmlentities($aRow['last']);
$phone=htmlentities($aRow['phone']);
And later, maybe in the HTML,
<p>Thank you, <?php echo $first;?></p>
[1] I'm away from my work machine, so there's a good chance
there are
syntax errors in the psuedo code. And, of course, I have no
idea what
your database looks like.
Mark A. Boyd
Keep-On-Learnin' :) -
Passing Session variable of DATE data type to opaque view filter
Hi Everyone,
Can you guys please help me in passing session variable of DATE data type in RPD's physical layer 'opaque view' filter for Oracle database
I tried following syntax, syntax wise I didn't got getting any error, but at the same time this opaque view is not fetching any records as well. my session variable is "END_DATE" and its value is 1998/12/31:00:00:00(as shown in RPD session windows, datatype is DATETIME)
SELECT AMOUNT_SOLD, CHANNEL_ID, CUST_ID, PROD_ID, PROMO_ID, QUANTITY_SOLD, TIME_ID FROM SH.SALES
WHERE TIME_ID =TO_DATE( 'VALUEOF(NQ_SESSION.END_DATE)','MM/DD/YYYY')
SELECT AMOUNT_SOLD, CHANNEL_ID, CUST_ID, PROD_ID, PROMO_ID, QUANTITY_SOLD, TIME_ID FROM SH.SALES
WHERE TIME_ID = TO_DATE( 'VALUEOF(NQ_SESSION."END_DATE")','MM/DD/YYYY')
SELECT AMOUNT_SOLD, CHANNEL_ID, CUST_ID, PROD_ID, PROMO_ID, QUANTITY_SOLD, TIME_ID FROM SH.SALES
WHERE TRUNC(TIME_ID) = TO_DATE( 'VALUEOF(NQ_SESSION."END_DATE")','MM/DD/YYYY')
In past, I was able to pass a session variable into a opaque view filter using DATEOF function, but that was in DB2.
I appreciate your time and helpFinally, I got right format. here it is
to_date(substr('valueof(NQ_SESSION.END_DATE)',1,10), 'yyyy-mm-dd')
and here is the source from where I got this information
Using OBIEE Session Variables in Select Tables in the Physical Layer -
FLEX & Session Variables: a BUG?.
TARGET:
Calling a Coldfusion Component with Remote Object to achieve
a boolean value as result.
If I declare the session variable inside the CF Function it
works.
If I declare the session variable before the CF Function was
called it fails.
See this test:
A Coldfusion page (index.cfm) that defines a sesssion variable
to start with:
<!--- SHOW SESSION VARIABLES AND LOAD FLEX SWF IF "sesVAR"
IS DEFINED, OTHERWISE DEFINE sesVar FIRST --->
<cfif isDefined('session.sesVar')>
<cfinclude template="index.html">
<cfelse>
<cfset session.sesVAR = "true">
<cfinclude template="index.html">
</cfif>
COLDFUSION COMPONENT (CFComp.cfc):
<!--- CHECK SESSION VARIABLE AND RETURN "TRUE" IF EXISTS
--->
<cffunction name="returnBoolean" access="public"
returntype="boolean">
<!--- UNCOMMENT FOLLOWING LINE AND EVERYTHING WORKS FINE
--->
<!---<cfset session.sesVar = 'yes'>--->
<cfif isDefined('session.sesVar')>
<cfset resultVal = TRUE>
<cfelse>
<cfset resultVal = FALSE>
</cfif>
<cfreturn resultVal>
</cffunction>
FLEX:"drongo79" wrote:
> Oh well sorted it out myself anyway.
Do you want to share, please? -
Need Help With Redirect That Uses Session Variable
I am new to dynamic sites, php, and developer toolbox, but I have been able to create a login site using the different form wizards fairly easily (in CS3 with Developers toolbox).
<br />
<br />I am trying to set a server behavior on a page that redirects the user to a new page if a session variable matches a recordset.
<br />
<br />I was using an extension (PHP Sessions - http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&extid=681308 ) that worked great, but when I installed developers toolbox, it stopped working (get error message about runtime/MX environment).
<br />
<br />Ive been struggling for days and this is what Ive come up with so far:
<br />------------------------------------
<br />session_start();
<br />if (!isset($HTTP_SESSION_VARS[$_SESSION['kt_firstname']]) || $HTTP_SESSION_VARS[$_SESSION['kt_firstname']] = $row_Recordsetfname['firstname']) {
<br /> header ("Location: ../firstname/firstname1.php");
<br />}
<br />------------------------------------
<br />
<br />It redirects regardless of the match. Any ideas on what I can do to get this working? Here is all of the code (with block from above inserted) up until the doc type:
<br />------------------------------------
<br /><?php require_once('../Connections/project1.php'); ?>
<br /><?php<br />// Load the tNG classes<br />require_once('../includes/tng/tNG.inc.php');<br /><br />// Make unified connection variable<br />$conn_project1 = new KT_connection($project1, $database_project1);<br /><br />//Start Restrict Access To Page<br />$restrict = new tNG_RestrictAccess($conn_project1, "../");<br />//Grand Levels: Any<br />$restrict->Execute();<br />//End Restrict Access To Page<br /><br />if (!function_exists("GetSQLValueString")) {<br />function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") <br />{<br /> $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;<br /><br /> $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);<br /><br /> switch ($theType) {<br /> case "text":<br /> $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";<br /> break; <br /> case "long":<br /> case "int":<br /> $theValue = ($theValue != "") ? intval($theValue) : "NULL";<br /> break;<br /> case "double":<br /> $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";<br /> break;<br /> case "date":<br /> $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";<br /> break;<br /> case "defined":<br /> $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;<br /> break;<br /> }<br /> return $theValue;<br />}<br />}<br /><br />// FELIXONE - 2002 SB by Felice Di Stefano - www.felixone.it<br />session_start();<br />if (!isset($HTTP_SESSION_VARS[$_SESSION['kt_firstname']]) || $HTTP_SESSION_VARS[$_SESSION['kt_firstname']] = $row_Recordsetfname['firstname']) {<br /> header ("Location: ../firstname/firstname1.php");<br />}<br /><br />$colname_Recordsetfname = "-1";<br />if (isset($_SESSION['kt_user_name'])) {<br /> $colname_Recordsetfname = $_SESSION['kt_user_name'];<br />}<br />mysql_select_db($database_project1, $project1);<br />$query_Recordsetfname = sprintf("SELECT firstname FROM registration WHERE user_name = %s", GetSQLValueString($colname_Recordsetfname, "text"));<br />$Recordsetfname = mysql_query($query_Recordsetfname, $project1) or die(mysql_error());<br />$row_Recordsetfname = mysql_fetch_assoc($Recordsetfname);<br />$totalRows_Recordsetfname = mysql_num_rows($Recordsetfname);<br /><br />$colname_Recordset1 = "-1";<br />if (isset($_SESSION['kt_user_name'])) {<br /> $colname_Recordset1 = $_SESSION['kt_user_name'];<br />}<br />mysql_select_db($database_project1, $project1);<br />$query_Recordset1 = sprintf("SELECT `Date` FROM registration WHERE user_name = %s", GetSQLValueString($colname_Recordset1, "text"));<br />$Recordset1 = mysql_query($query_Recordset1, $project1) or die(mysql_error());<br />$row_Recordset1 = mysql_fetch_assoc($Recordset1);<br />$totalRows_Recordset1 = mysql_num_rows($Recordset1);<br />?>
<br />
<br />------------------------------I am new to adobe toolbox... I ve created a ligin page but not sure how to pass the session variable. I am trying to direct successful login to a page like... index.php?id=filter
<br />
<br />been struggling all day with this. Please help!!!
<br />
<br /><?php require_once('Connections/comm.php'); ?>
<br /><?php<br />// Load the common classes<br />require_once('includes/common/KT_common.php');<br /><br />// Load the tNG classes<br />require_once('includes/tng/tNG.inc.php');<br /><br />// Make a transaction dispatcher instance<br />$tNGs = new tNG_dispatcher("");<br /><br />// Make unified connection variable<br />$conn_comm = new KT_connection($comm, $database_comm);<br /><br />// Start trigger<br />$formValidation = new tNG_FormValidation();<br />$formValidation->addField("kt_login_user", true, "text", "", "", "", "");<br />$formValidation->addField("kt_login_password", true, "text", "", "", "", "");<br />$tNGs->prepareValidation($formValidation);<br />// End trigger<br /><br />// Make a login transaction instance<br />$loginTransaction = new tNG_login($conn_comm);<br />$tNGs->addTransaction($loginTransaction);<br />// Register triggers<br />$loginTransaction->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "kt_login1");<br />$loginTransaction->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);<br />$loginTransaction->registerTrigger("END", "Trigger_Default_Redirect", 99, "{kt_login_redirect}");<br />// Add columns<br />$loginTransaction->addColumn("kt_login_user", "STRING_TYPE", "POST", "kt_login_user");<br />$loginTransaction->addColumn("kt_login_password", "STRING_TYPE", "POST", "kt_login_password");<br />$loginTransaction->addColumn("kt_login_rememberme", "CHECKBOX_1_0_TYPE", "POST", "kt_login_rememberme", "0");<br />// End of login transaction instance<br /><br />// Execute all the registered transactions<br />$tNGs->executeTransactions();<br /><br />// Get the transaction recordset<br />$rscustom = $tNGs->getRecordset("custom");<br />$row_rscustom = mysql_fetch_assoc($rscustom);<br />$totalRows_rscustom = mysql_num_rows($rscustom);<br /><br />?>
<br />
<br />
<br />
<br />
<br />
<br />
<script src="includes/common/js/base.js" type="text/javascript"></script>
<br />
<script src="includes/common/js/utility.js" type="text/javascript"></script>
<br />
<script src="includes/skins/style.js" type="text/javascript"></script>
<br /><?php echo $tNGs->displayValidationRules();?>
<br />
<br />
<br />
<br /><?php<br /> echo $tNGs->getLoginMsg();<br />?>
<br /><?php<br /> echo $tNGs->getErrorMsg();<br />?>
<br />
<form method="post" id="form1" class="KT_tngformerror" action="%3C?php%20echo%20KT_escapeAttribute(KT_getFullUri());%20?%3E">
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<table cellpadding="2" cellspacing="0" class="KT_tngtable">
<tr>
<td class="KT_th">
<label for="kt_login_user">Username:</label>
</td>
<td>
<input type="text" name="kt_login_user" id="kt_login_user" value="<?php echo KT_escapeAttribute($row_rscustom['kt_login_user']); ?>" size="32" />
<br /> <?php echo $tNGs->displayFieldHint("kt_login_user");?> <?php echo $tNGs->displayFieldError("custom", "kt_login_user"); ?></td>
</tr>
<tr>
<td class="KT_th">
<label for="kt_login_password">Password:</label>
</td>
<td>
<input type="password" name="kt_login_password" id="kt_login_password" value="" size="32" />
<br /> <?php echo $tNGs->displayFieldHint("kt_login_password");?> <?php echo $tNGs->displayFieldError("custom", "kt_login_password"); ?></td>
</tr>
<tr>
<td class="KT_th">
<label for="kt_login_rememberme">Remember me:</label>
</td>
<td>
<input <?php if (!(strcmp(KT_escapeAttribute($row_rscustom['kt_login_rememberme']),"1"))) {echo "checked";} ?> type="checkbox" name="kt_login_rememberme" id="kt_login_rememberme" value="1" />
<br /> <?php echo $tNGs->displayFieldError("custom", "kt_login_rememberme"); ?></td>
</tr>
<tr class="KT_buttons">
<td colspan="2">
<input type="submit" name="kt_login1" id="kt_login1" value="Login" />
<br /></td>
</tr>
</table>
<br />
<a href="forgot_password.php">Forgot your password?</a>
<br /></form>
<br />
<p> </p>
<br />
<br /> -
Dreamweaver need to create a session variable or Cookie or something Help
I have been working for weeks I am very close but can't get over one last hurdle. I am trying to call a session variable much like dreamweaver calls mm_username. It is in the same user table as username - password - access level - Customer_id. I need to pull the session variable or cookie or however I can do it to access the customer id number so I can have customer specific information and pricing. There will be mulitple users for each customer so I need another variable besides mm_username. Help I use dreamweaver cs4 aspvbscript and sqlserver ...help
I soon as I put the red line of code in it is custoemr _id instead of user id in my table. Dreamweaver removes the user id function. is it in the wrong place ...what am i doning wrong ....it is fine with the first part you did but the second part it doesnt like in red.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include virtual="/Connections/p21.asp" -->
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString <> "" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername = CStr(Request.Form("username"))
If MM_valUsername <> "" Then
Dim MM_fldUserAuthorization
Dim MM_redirectLoginSuccess
Dim MM_redirectLoginFailed
Dim MM_loginSQL
Dim MM_rsUser
Dim MM_rsUser_cmd
MM_fldUserAuthorization = "Access_Level"
MM_redirectLoginSuccess = "/mainmenu.asp"
MM_redirectLoginFailed = "/loginfailed.asp"
MM_loginSQL = "SELECT customer_id, Login_Name, password"
If MM_fldUserAuthorization <> "" Then MM_loginSQL = MM_loginSQL & "," & MM_fldUserAuthorization
MM_loginSQL = MM_loginSQL & " FROM dbo.btb_web_login WHERE Login_Name = ? AND password = ?"
Set MM_rsUser_cmd = Server.CreateObject ("ADODB.Command")
MM_rsUser_cmd.ActiveConnection = MM_p21_STRING
MM_rsUser_cmd.CommandText = MM_loginSQL
MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param1", 200, 1, 20, MM_valUsername) ' adVarChar
MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param2", 200, 1, 10, Request.Form("password")) ' adVarChar
MM_rsUser_cmd.Prepared = true
Set MM_rsUser = MM_rsUser_cmd.Execute
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username") = MM_valUsername
Session ("MM_USERID") = MM_rsUser.Fields.Item("customer_id").value
If (MM_fldUserAuthorization <> "") Then
Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
Else
Session("MM_UserAuthorization") = ""
End If
if CStr(Request.QueryString("accessdenied")) <> "" And false Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied")
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%><!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>Brown Live Online Login</title>
<style type="text/css">
<!--
body {
background-image: url(/images/gradientblacktowhite.jpg);
background-repeat: repeat-x;
.style1 {
color: #FFFFFF;
font-weight: bold;
.style3 {color: #000000; font-weight: bold; }
.style5 {
font-size: xx-large;
color: #0000FF;
.style6 {color: #000000}
-->
</style></head>
<body>
<p class="style5"><img src="/images/BTBlogosmall.jpg" width="322" height="53" /></p>
<p class="style5">Brown Live Online 2.0 </p>
<form ACTION="<%=MM_LoginAction%>" id="form1" name="form1" method="POST">
<p>
<label><span class="style3"> User Name</span>
<input name="username" type="text" id="username" size="20" />
</label>
</p>
<p>
<label><span class="style1"><span class="style6">Password</span></span>
<input name="password" type="password" id="password" size="20" />
</label>
</p>
<p>
<label>
<input type="submit" name="button" id="button" value="Login" />
</label>
</p>
</form>
<p><a href="/index.html"><img src="/images/brown2.0.jpg" width="100" height="100" /></a> Click Image to return to <a href="http://www.browntransmission.com">www.browntransmission.com</a></p>
</body>
</html> -
HELP NEEDED:: variable SESSION is undefine
Guys, help me out; PLEASE. I'm stuck on this for days and am
running out of options.
I have a CFC that checks some session variables for
validation (client login etc), and I have a RemoteObject call to
said CFC.
All my other CFCs that do not reference session variables
work fine; this one bunks right when my CFC checks the session
variables.
I tried webservices, no-go (hell, I couldn't even see the
faultString!!).
I played around with my CF8 server settings and tried
everything.
I tried Ben Forta's blogs (and posted a question there) but
didn't get much help,
HOW CAN I ACCESS A CFC THAT REFERENCES SESSION VARIABLES
WITHOUT CREATING A GET/SET METHOD TO GET/SET THESE SESSION
VARIABLES!!!! (Obvious security risk).Thank you for your reply John,
Sorry I wasn't clear in my description.
I do -in fact- have a CFC check my client's log-in and return
a true or false, however in subsequent site functionality, it is
the norm to see whether the session has expired or not. From Flex I
am using a RemoteObject call to a CFC; the CFC has the following if
statement:
<cfif IsDefined(SESSION.CLIENT.boolClientLoggedIn)>
<cfif SESSION.CLIENT.boolClientLoggedIn eq "true">
<cfthrow message="Attempting to call fncClientWebSignup
when client is logged in.">
</cfif>
</cfif>
The faultString I get in Flex is 'Variable SESSION is
undefined.'
Also, I did try to change my wrapper from html to cfm and
still no success. Not only that, but I've tried Webservices (which
failed miserably because I couldn't even get the details of the
SOAP fault!!!).
I built a test cfm page that tests my cfcs (instead of Flex
calling them, I had the cfm call the same cfcs) and Session
variables were defined and everything went well.
It so happens that when Flex calls the SAME cfcs, the SESSION
variable is undefined.
I hope this clears up my problem. -
Help with session variable please - CS5.5 PHP
Hi all,
I am needing a little assistance with using a session variable and hope that someone may point me in the right direction.
I have created a PHP page that uses the Dreamweaver 'User Authentication' feature, and the basics of this works fine, directing a user to the correct pages depending on whether they are or are not a valid user. I would like however to personalise the 'valid user' page with the persons Username as entered in the User Authentication table....a seemingly simple task using a session variable, but one that I just don't seem to be able to get working!
The code generated for the UA on page 1 is as follows:
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
if (isset($_POST['txtfirst_name'])) {
$loginUsername=$_POST['txtfirst_name'];
$password=$_POST['txtsurname'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "member_update.php";
$MM_redirectLoginFailed = "login.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_panto, $panto);
$LoginRS__query=sprintf("SELECT firstname, surname FROM web_access WHERE firstname=%s AND surname=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $panto) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
header("Location: " . $MM_redirectLoginSuccess );
else {
header("Location: ". $MM_redirectLoginFailed );
?>
Firstly, the text highlighted in red above appears to be setting the session variable that I require. Is This correct?
If so, what is the code that I need to place in page 2 to use that session variable? or
Do I need to do something else on page 1 to properly assign the session variable?
Would really appreciate your expertise
MarkIt looks as though you've set the columns incorrectly in the User Authentication server behavior. This is the SQL query that checks the user's credentials:
$LoginRS__query=sprintf("SELECT firstname, surname FROM web_access WHERE firstname=%s AND surname=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
You're looking for firstname and surname, whereas you should be looking for the user's login name and password.
$_SESSION['MM_Username'] is a session variable that stores the user's login name. To use it in a subsequent page, all that's needed is for the page to begin with session_start(). You can then echo the value to display it.
If you want to display the person's real name, you need to create a recordset in the second page using $_SESSION['MM_Username'] to find the firstname and surname. Alternatively, you can edit the existing code like this (I've copied only part of it):
$LoginRS__query=sprintf("SELECT firstname, surname FROM web_access WHERE firstname=%s AND password=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $panto) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
$row = mysql_fetch_assoc($LoginRS);
$_SESSION['full_name'] = $row['firstname'] . ' ' . $row['surname'];
if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
You can then use $_SESSION['full_name'] in a subsequent page that begins with session_start(). -
Login session variable - pls help before i slot myself
im brand new to this guys and really struggling with logging
in a member to their particular account as opposed to a general
members section using dreamweavers login application and some basic
php coding.
i just cant seem to figure it out it (im stuck on the session
variables i think..) and unfortunately my php is very poor at them
moment!
pls HELP!!
below is the dreamweaver generated code from its basic login
application.
im using it in a dreamweaver template so im not sure if thats
the issue but bascially im using 2 SQL tables i constructed to
achieve this-
1.) tblaccesslevel
intLevelID (unsigned + auto increment + primary key)
txtAccess
(ive allocated various numerical access levels into
txtAccess. ie. 1-7
and
2.) tblplayeraccount
intUserID (unsigned + auto increment + primary key)
txtFirstName
txtLastName
txtEmailAddress
txtPassword
intAccessLevel
(ive generated 2 users in the above table tp test)
in dreameavers server behaviors the recordset generated by
the login server behavior simply says Log In User
obviously i need a session variable somewhere to get the
intUserId....
also a relationship needs to be generated in the sql
statement to connect the intAccessLevel but i think i can manage
that (i think..)
below is the code this application generated -
if someone can give me some hints or if they've done
something similiar pls provide the required code ...it would be a
huge help!! i dont know what im doing wrong!!!
<?php require_once('../Connections/Rugby.php'); ?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
if (isset($_POST['emailaddress'])) {
$loginUsername=$_POST['emailaddress'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "intAccessLevel";
$MM_redirectLoginSuccess = "../player_home.php";
$MM_redirectLoginFailed = "../failed.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_Rugby, $Rugby);
$LoginRS__query=sprintf("SELECT txtEmailAddress, txtPassword,
intAccessLevel FROM tblplayeraccount WHERE txtEmailAddress='%s' AND
txtPassword='%s'",
get_magic_quotes_gpc() ? $loginUsername :
addslashes($loginUsername), get_magic_quotes_gpc() ? $password :
addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $Rugby) or
die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'intAccessLevel');
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
header("Location: " . $MM_redirectLoginSuccess );
else {
header("Location: ". $MM_redirectLoginFailed );
?>Are you wanting to redirect them to a specific page based on
their username or to the same page with dynamic content based on
their username?
Maybe you are looking for
-
I have 4 children under the age of 11. I would love it if there was an app that said you have to do a certain amount of minutes on educational apps first THEN you could do fun games. At the very least have a running total at the end of each day and w
-
How to populate the master column in a table
Hi Experts, I am trying to implement a hierarchy structure in a table. For that I have inserted a master column of TreeByNestingTableColumn type. The value which are getting displayed in a table are hard coded by me, but I am not able to understand h
-
How to attach a document to an email without embedding it
When I attach a document or PDF to an email it automatically embeds itself - how do I make the attach?
-
Object variable or With block variable not set error message
When processing the Rate application I get a "Object variable or With block variable not set error message" What is causing this error and how do I fix it?
-
Passing Variable to air app when launch using Badger
Hi all, I am going to desperately to develop my application. Hope someone can help me........ I am using badger for air which I get it here http://www.adobe.com/devnet/air/articles/badger_for_air_apps.html and it launch my app correctly, but I can't