Session Variables - Need Help
Hi,
I am working on a requirement - I need to filter one subject area based on users.
I want to know how can we populate a variable from database with comma separated values.
Example - In the database the table is something like this
Profit Center Name Profit Center Number
A 105
B 106
C 107
D 108
Requirement is For - User X - Data for 105 and 106
For - User Y - Data for 107 and 108.
How can I populate a variable with comma separated values. Because I want to use IN clause in the filter conditions like 'IN(105,106)'.
So I need a variable with comma separated values so that I can use
'IN VALUEOF(<variable>)'
Any inputs? Or any other easy way to achieve this?
Thanks in advance,
Prashanth.
Hi,
I am working on a requirement - I need to filter one subject area based on users.
I want to know how can we populate a variable from database with comma separated values.
Example - In the database the table is something like this
Profit Center Name Profit Center Number
A 105
B 106
C 107
D 108
Requirement is For - User X - Data for 105 and 106
For - User Y - Data for 107 and 108.
How can I populate a variable with comma separated values. Because I want to use IN clause in the filter conditions like 'IN(105,106)'.
So I need a variable with comma separated values so that I can use
'IN VALUEOF(<variable>)'
Any inputs? Or any other easy way to achieve this?
Thanks in advance,
Prashanth.
Similar Messages
-
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? -
OLAP variable / bex variable, need help !
Dear All,
I will definitely award point for this solution.
I have a new assignment on another client, and they had activate BW customer exit, RSR00001 BW: Enhancements for global variables in reporting for almost 5 years ago.
As a consequences, include ZXRSRU01 is almost 1000 lines .
Here is the problem, I copy paste a piece of the include here:
WHEN 'TCTSD017'.
IF I_STEP = 2.
LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
WHERE VNAM = 'TA_DTE7'.
CLEAR L_S_RANGE.
L_S_RANGE-LOW = '19000101'.
L_S_RANGE-HIGH = LOC_VAR_RANGE-LOW.
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'BT'.
APPEND L_S_RANGE TO E_T_RANGE.
ENDLOOP.
ENDIF.
My 2 questions,
1. where is TCTSD017 defined ?
2. where is TA_DTE7 defined ?
Please help me and again, I will definitely award points
Many Thanks reader...
Ahmad.HEY WELCOME ON BOARD AND IN BW WORLD
THANK YOU FOR YOUR ANSWER.
IF YOU WANT A CORRECT ANSWER PLEASE ASK THE QUESTION PROPERLY OK !
YOU ASK WHERE YOUR VARIABLES ARE DEFINED YOU HAVE THE ANSWER.
I DO NOT ACCCEPT EITHER THIS KIND OF RESPONSE.
WHEN YOU ARE A BEGINNER ON A TOPIC LIKE REPORTING AS YOU SEEM TO BE , TALK TO PEOPLE WITH HUMILITY.
"So digging queries 1 by 1 is not an acceptable answers."
RESPECT PEOPLE WHO TOOK TIME TO READ YOU AND MAKING EFFORT ON PROVIDING YOU HELP.
BYE AND GOOD LUCK
BOUJEMA -
Re: A problem with local variables, need help.
I don't actually get any error with the code when
compiling,I know. You get it when running. The error is that it doesn't behave like you want. What I was looking for was "at such and such line, I expected this variable to have this value, but it was actually this other value."
Your explanation did clear it up though.http://java.sun.com/docs/books/tutorial/java/javaOO/variables.html
-
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> -
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 /> -
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... -
Hi, all. I posted questions before when I was stuck, and you
all were very friendly and helpful. I am having difficulty
understanding how to create, POST() to, and then REQUEST()
information stored in session variables using Dreamweaver. I am
developing the pages using PHP, and have a MySQL database uploaded
and working. Displaying, editing, and adding to the database is
ongoing, as I type!
Adobe has thankfully started the session for me with the
<?php if(!isset($_SESSION)) { session_start(); } ... because I
have a log in/log out server behavior on the pages.
I need to add two pieces of information collected from the
page, one value of which is inputted by the user on a form, and the
other value is obtained from values from the part of the recordset
shown on the page. What I expect I need is something like a
2-dimensional array to store both sets as a pair, but while I
expect I can do this, I am really not sure. The documentation ends
before fully explaining this part.
An example of what I am trying to do is a product detail page
from an on-line store catalog, with an "add to cart" button. The
person has navigated to that page, shows the information for
productID=1497 with an input field for quantity, so a person can
order more than one of that product if they choose, and an "add to
cart" button which would write the productID and quantity values to
the session variable. Is there a simple and easy to use Dreamweaver
feature I am missing that can do this?
If I need to code this myself, are there good resources for
figuring this out? What I've found thus far is either too basic, or
too advanced. I've been using Dreamweaver's Insert>Date
Objects> menu to get everything done thus far.
Of course, once the session variables are created I will need
to $_REQUEST() the information on a later page and display it on
one of Dreamweaver's dynamic tables. I hope that once I understand
how to $_POST() the values to the session variable, $_REQUEST()ing
the information on another page will be apparent.
Also, please don't assume I know anything more than what I
wrote in my post. I may be an old school programmer, think punch
cards and FORTRAN, but I can get lost easily on things most people
nowadays think are pretty basic.I got it fixed. It took two weeks to figure out the solution,
but...
It all boils down to the fact that you can get away with
sloppy programming if your MySQL database is located on 'localhost'
that you can't get away with if it is located remotely.
Basically, you need to activate the database before you make
a mysql_query. My bad. Problem solved. And now that I know I need
to do this, problem never rediscovered.
~ Scott
oldcountrypeddler.com -
Help with php session variables
I am using Dreamweaver 8 to set up a dynamic app with PHP and
MySQL. I want the code that the user logs in with ('UPN') to be
stored as a session variable so that recordsets on subsequent pages
can be set to display personalised data.
I have set the session variable like this: $_SESSION['UPN'] =
'UPN' (UPN is the name of the form textfield, also set as the
username for logging in)
On the data page, I have called the variable like this:
$query_Recordset1 = ("SELECT pupils.pupilID, pupils.UPN,
pupils.forename, pupils.surname FROM pupils WHERE UPN = '" .
$_SESSION['UPN'] . "'");
The recordset returns nothing- the dynamic table returns ony
the column headings (both as headings and immediately under where
you would expect the data to be).
Can anyone help?
ThanksOn Wed, 17 Oct 2007 11:43:04 +0000 (UTC), "denman"
<[email protected]> wrote:
> I have set the session variable like this:
$_SESSION['UPN'] = 'UPN' (UPN is
>the name of the form textfield, also set as the username
for logging in)
Your code assigns the literal string UPN to the session
variable. If
it's coming from POSTed form data, you'd need to do it like:
$_SESSION['UPN'] = $_POST['UPN'];
Gary -
Urgent help required...for replacing JSP session variables
I am trying to enhance the performance of a j2ee based webapp which use session variables to store the data...
Is there any alternative for session variables..The project is based on j2ee-Struts frame work..But the amount of code maintainance should be minimum ....so i can't create beanforms for all these data...
Is there any XML based methods available...??ok... thanks... i created a fla file and inthe action script
pasted the following code
var nc:NetConnection = new NetConnection();
nc.connect("rtmp://flash.ispstream.com/ondemand/unikron/my_video_dj/");
var ns:NetStream = new NetStream(nc);
contentMain.myVideo.attachVideo(ns);
ns.setBufferTime(5);
ns.play("dvd_r");
nothing is working if i tried to load... can u help me out -
Hi,
I'm using Adobe Flash CS3 Professional version of Flash
software,
I need help and guidance on
Different approaches to setting variables in a Flash movie,
what I should do in the fla file, and in the html file.
Thanks, GilHi petro_jemes,
Just a little claritification, you need to add the value to the variable "[string]$ou", and also change the language in the variable "$emailbody" in the function "Get-ADUserPasswordExpirationDate".
I hope this helps. -
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(). -
Need help with the session state value items.
I need help with the session state value items.
Trigger is created (on After delete, insert action) on table A.
When insert in table B at least one row, then trigger update value to 'Y'
in table A.
When delete all rows from a table B,, then trigger update value to 'N'
in table A.
In detail report changes are visible, but the trigger replacement value is not set in session value.
How can I implement this?You'll have to create a process which runs after your database update process that does a query and loads the result into your page item.
For example
SELECT YN_COLUMN
FROM My_TABLE
INTO My_Page_Item
WHERE Key_value = My_Page_Item_Holding_Key_ValueThe DML process will only return key values after updating, such as an ID primary key updated by a sequence in a trigger.
If the value is showing in a report, make sure the report refreshes on reload of the page.
Edited by: Bob37 on Dec 6, 2011 10:36 AM -
I am having the same problem as user "Gabe the animator" in a post sent in 2007.
"my recordset that drives a dynamic table won't filter results based on a session variable. I know session variables are working because I have the session variable echo on the page (dragged-n-dropped my session variable from the Bindings panel to my page), and that works fine. So why can't I filter my recordset with the same session variable???"
here is the code:
<?php require_once('Connections/mockconn.php'); ?>
<?php
session_start();
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
return $theValue;
if(!session_id()){
session_start();
$colname_info = "-1";
if (isset($_SESSION['email'])) {
$colname_info = $_SESSION['email'];
mysql_select_db($database_mockconn, $mockconn);
$query_info = sprintf("SELECT name, last_name, email, password FROM registration WHERE email = %s", GetSQLValueString($colname_info, "text"));
$info = mysql_query($query_info, $mockconn) or die(mysql_error());
$row_info = mysql_fetch_assoc($info);
$totalRows_info = mysql_num_rows($info);
?>
<!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>home</title>
</head>
<body>
<div id="info">hello <?php echo $row_info['']; ?></div>
<?php
if (isset($_SESSION['email'])) {
echo 'your email: '.' '. $_SESSION['email'] .' '.'good job';}
?>
</body>
</html>
PLEASE PLEASE HELP.... I have been at this for day's...
how do I get the record set to filter based on the value of the session variableSorry I forgot to mension the error I am getting?
( ! ) Notice: Undefined index: in C:\wamp\www\mock\home.php on line 59
Call Stack
Time
Memory
Function
Location
1
0.0093
389024
{main}( )
..\home.php:0
Why is this error coming up? -
Please Help Session variables disappear
Hi. I am having issues with the developer's version of CF MX
7. I recently set up the developer's version on a test server, and
moved over code from a properly working site using MX 6. I have an
application.cfm file set will the correct <cfapplication> tag
attributes, and the session management is set in the CF admin. When
working on MX 6 the session variables I set were working. Now using
MX 7 none of my sessions are holding. When I first login the
sessions exist, if I click any other page, the variables disappear.
Again, this does not happen on MX 6.
Please help!
Thanks,
jlgDouble-check your sessiontimemout
Try setting up a simple test application using something
similar to the example at
http://livedocs.adobe.com/coldfusion/7/htmldocs/00000217.htm
Maybe you are looking for
-
Can we open more than one "folder" at a time in Bridge?
When I click on a folder icon, the images appear in the Bridge workspace. Then when I click on another, different, folder icon, the previously displayed images are gone, and only the second folder's images appear. A priori, this seems to be an unnece
-
Error while running the RFC on ECC 6.0 server
Hello Champs, The problem I am facing while sending the data for validation and invalidation from RFC on ECC server to Pi server to be send to a webservice. This scenario was working perfectly fine when the RFC was run on R/3 4.7 server. On upg
-
Profit Center wise ROI report considering BS items
Dear Expert, As part of our SAP implementation 1.client wants , Profit center wise reporting for balance sheet items, for calculating ROI per profit center, can it be done? If yes, what balance sheet items , SAP standard willl consider while generati
-
DW8: linking object to photo
I apologise for this - I created this thread many months ago, but have forgotten the extremely helpful advice I received (only because I haven't been doing any site-building since). I have a travel site in which an image of a camera links to a photo
-
PLS-00382 Type error in the select statement in the Cursor.
Hi, I am trying to combine several different sql statements to form one large cursor for my java layer. I have attached the PL/SQL procedure that I am using and when I am trying to compile it is giving PLS-00382 error. Please help me. PL/SQL Code. CR