Creating a session variable with PHP
Can anyone offer me a PHP script that creates a session
variable? The Dreamweaver CS3 Help documentation offers coding
samples for ColdFusion and ASP but not for PHP. I tried this
without success:
"$_SESSION['usermail']= $_POST['sub_email'];" in which I am
trying to capture an email address from a form and save it to use
in a confirmation email to a new subscriber. Any help would be
sincerely appreciated.
[email protected]
I use this -
<?php
if (!isset($_SESSION)) {
session_start();
?>
at the top of the page, and then this within the code block
where you are
processing the form's data -
$_SESSION['usermail']= $_POST['sub_email'];
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"Jugdish" <[email protected]> wrote in
message
news:gb8aov$691$[email protected]..
> Can anyone offer me a PHP script that creates a session
variable? The
> Dreamweaver CS3 Help documentation offers coding samples
for ColdFusion
> and ASP
> but not for PHP. I tried this without success:
> "$_SESSION['usermail']= $_POST['sub_email'];" in which I
am trying to
> capture
> an email address from a form and save it to use in a
confirmation email to
> a
> new subscriber. Any help would be sincerely appreciated.
> [email protected]
>
Similar Messages
-
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> -
How to Create a Session variable in JSP?
How to create a session variable and add attributes to it?
For example i want to create a session variable called "name" and add value "user" to it? if i try to do it with setAttribute(), it is giving error as both is of type string? how to do it? kindly help meThis is variable what is working in my aplication
String variable;
if(user == null){
user=new String("");
}//if you don'y do this you will have null pointer exception
session.setAttribute("user",user);//put value
String name=(String)session.getAttribu("user"); //get value;
I hope this will help -
How to create a session variable in Apex?
Hello colleagues,
Is there someone do know how to create a session variable in Apex?
How to get them?
Thanks
Best RegardsHello,
What do you mean by 'session variable'? You mean something that stores the value int he users session state?
I really recommend reading the 2-Day Developer guide documentation, there is a complete section on session state -
http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10499/concept.htm#CIHCFHBD
Hope this helps,
John
Blog: http://jes.blogs.shellprompt.net
Work: http://www.apex-evangelists.com
Author of Pro Application Express: http://tinyurl.com/3gu7cd -
How to auto create a global variable with specific variable name in a global vi ?
how to auto create a global variable with specific variable name in a global vi using lv ? Because i need to add a lot of global variable in this global vi. But you know, if i manually add them , it will be a much time-costing work. So i want to use someway to auto generate ? Can i ?? Thanks a lot !
Hi
what aartjan is saying is the way for you. but you can develop an utility which will actually help you create global variables. To get the details on this just have a look at VI Scripting section on LAVA forum.
But i would like you to suggest few things
1. If your programs have so many global variables (Thats why u want utility) then you should take out some time to read about LabVIEW design patterns. I think if programmer follows these practicess he dont need a single global variable.
2. Their are some other ways to achieve similar functionality as of global variables (Uninitialized Shift Registers, Single Element Qs and so on) but they are much faster than global variables.
I am Attaching Whatever Resources i am having I will also attach the template of the design pattern i generaly use in short duration
Message Edited by Tushar Jambhekar on 10-06-2005 07:33 PM
Message Edited by Tushar Jambhekar on 10-06-2005 07:36 PM
Tushar Jambhekar
[email protected]
Jambhekar Automation Solutions
LabVIEW Consultancy, LabVIEW Training
Rent a LabVIEW Developer, My Blog
Attachments:
LabVIEWDesignPatterns.zip 1505 KB
Large_Code_Implementation.zip 522 KB
Database Tests.zip 868 KB -
How to generate a random session variable in php
i want to generate a random session variable and insert the variable in a mysql record to use later to validate an account set up.
person fills out form to create account and submits; inserts form information in mysql record.
i want the random variable to be inserted from a hidden field and the page sends an email with a link to click on to compare the variable to validate the user.
Not sure how to generate a random session variable and get that to the hidden field value to be inserted with the other form information.
thanks for your help,
Jim BalthropTo insert the key I would personally do something like...
$key = md5($username . $password . $salt);
Insert that into your MySQL database, then send them a email with it, my next code shows how to activate it.
This is to activate the account.
<?php
$key;
$errors = array();
if(isset($_GET['key']){
$key = $_GET['key'];
$sql = 'SELECT * FROM users WHERE key = \'' . $key '\' LIMIT 1';
$result = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($result)){
$sql2 = 'UPDATE users SET active = 1 WHERE key = \'' . $key '\' LIMIT 1';
$result2 = mysql_query($sql2) or die(mysql_error());
if($result2){
//successfully activated account
else{
//Something Went Wrong!
else{
$errors[] = 'Invaild Key, Please try again!';
else{
$errors[] = 'Invaild Key, Please try again!';
?> -
Using Session Variable with Conditional Formatting Filter
Hi,
I'm trying to add a condition to my report in order to flag all opportunities that have a close date that is in the past. The way I'm trying to do this is by adding a condition to say when close date is less than current_date, flag the column with an image.
Issue I'm having is that the filter window within conditional format tab appears to not have the session variable option as you do when you create a filter on a column the normal way. A colleague told me to use an SQL expression, but again this option seems to be unavailable too within the conditional format tab.
Can anybody assist please?
ThanksCreate a new column and write a CASE WHEN condition like case when close date < current_date then 'Y' ELSE 'N' END.
Then on your actual date column, you can do conditional analysis based on the newly created column for values having Y then the image.
finally, you can hide the newly created column. -
Passing Session Variable from PHP to Applet
I'm trying to pass a session variable from a PHP script to a third party applet. The applet needs to accept the variable as a string into a parameter. I think the htnl has to be dynamically created to turn the session variable into a string for the parameter value. Any suggestions ?
This is really a PHP question. You might get better results on a PHP forum.
-
Is it Possible to Create System Session variable
Hi Gurus,
I am creating a new Session variable but it is created under non-system variable. Is it any way to create a System Session variable. I am using User and GROUP the defualt Session System variable, i want to creat a new one for my requirement. Is it possible to do it? If so please give me some steps todo.
Thanks in advance
Regards
@liHi
as far my knowledge, it's not possible...
All system variables are predefined.. if you want to define anything you will have to satisfy with Non-System variable
But curious, why do you want to create session variable there only??? -
Error while creating a Characteristic Variable with Replacement Path
Hi all,
I am trying to create the Characteristic Variable ZVLOWDT (Low Date') with Replacement Path on characteristic ZSTARTDT (Start Date) and it gives the error 'Source to replace 'Low Date' is not defined.
I have created a User Entry Variable VAR_DATE (Start Date) with interval like '01/01/2009 - 01/15/2009' and Customer Exit variable ZVCPDAY (does some calculation based on the input of VAR_DATE) on the same ZSTARTDT characteristic. I want to get the 01/01/2009 (lower range date of the selection) into this Characteristic Variable ZVLOWDT. We are in BI 7.0 and the following are it's properties:
General Tab:
Description: Low Date
Technical Name: ZVLOWDT
Type of Variable: Characteristic Value
Processing by: Replacement Path
Reference Characteristic: ZSTARTDT Start Date
Details Tab:
Variable Represents : Single value
Variable is: Mandatory
Variable is Ready for Input : unchecked
Replacement Path Tab: Replacement Rule
Replace Variable with : Variable
Variable : VAR_DATE
Replace with : KEY
Why I am getting this error, PLEASE ?
Thanks,
Venkat.Hi Khaja,
We could derive a Variable value from another Variable with out Customer Exit. There is a white paper.
First have the User Entry Variable (ZV_X) and it accepts the date range like '01/01/2009 - 01/31/2009'. Next create the Characteristic variable (ZV_Y) of Replacement Path for which source variable will be ZV_X and we could get the 'FROM Date' (01/01/2009) from the selection (ZV_X) into it (ZV_Y).
While creating the Characteristic variable (ZV_Y) of Replacement Path, I didn't find my newly created ZV_X variable in the list of available variables under 'Variable' header in 'Replacement Path' tab and it is causing the error 'Source to replace variable ZV_Y is not defined'. How could I create the Characteristic variable of Replacement Path, PLEASE ?
Thanks,
Venkat. -
Use Session Variable with row-wise initialization
Hello,
I use an initialization block in order to load some translations in my repository (version is 11.1.1.6.BP1) :
SQL :
SELECT CODE_KEY, STRING_VALUE FROM "TABLES" WHERE LANGUAGE_KEY= 'VALUEOF(NQ_SESSION.USERLOCALE)'
Values :
CN_INCOMING, Incoming, en
CN_OUTGOING, Outgoing, en
CN_INCOMING, Réception, fr
CN_OUTGOING, Emission, fr
etc ...
I checked the row-wise intialization.
The query is correct and returns the right values (I check in the log file ..).
So far, So good.
But when I want to use session variables in a column expression (in repository) like :
CASE WHEN "column"="xx" THEN VALUEOF(NQ_SESSION."CN_INCOMING") ELSE VALUEOF(NQ_SESSION."CN_OUTGOING") END
I got the error: [nQSError: 23006] The session variable, NQ_SESSION.CN_OUTGOING, has no value definition.
If I used the same formula directly in Answers it's working correctly.
Do I have to necessarily do this in answers or is there a way to do this in the repository.
Thanks in advance
Regards
BenjaminYes I already tested this point, when I don't use a row wise initialization it's working, but I don't want to create one variable for each translations that I need to use in column formula if you know what I mean.
I don't understand why we can't use this kind of variable in this context ..but if I have to create the column in my analysis, I will do that, but it's not really user friendly
Anyway thanks for your time. -
I am new to web applications, but for what I need is to know
how to use session variables. When a user logins I want thier
information stored so when they visit my account they are able to
see thier information and not someone elses. Any help should be in
PHP format. Thank you in advance.prashi123 wrote:
> I am new to web applications, but for what I need is to
know how to use session
> variables. When a user logins I want thier information
stored so when they
> visit my account they are able to see thier information
and not someone elses.
> Any help should be in PHP format. Thank you in advance.
http://www.php.net/manual/en/features.sessions.php
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/ -
Session variable with list of availalble dashboards?
Hello,
Is it possible to populate a -row-wize?- session variable (using an initialization block & system variable :USER) with a list of dashboards the user will have access to (like the list of dashboards displayed at the top of the webportal) once he has logged on?
My customer has stated the requirement to provide each user with a default 'Home' dashboard (different from 'My dashboard') that will provide an overview of the available dashboards, accompagnied by a description of each dashboard.
Of so, what would be the syntax to be used?
Thanks!
RandallHi Randall,
The BI-server isn't aware of the presentation server. This means it doesn't know to which dashboards a user has access. What you could do is populate a table in the DB and use guided navigation to give access to dashboard.
regards
John
http://www.obiee101.blogspot.com/ -
Create User and Password with PHP
I have a PHP script that can create a user in eDirectory using the
ldap_add function. I can successfully add the user, but I don't know how
to set the password. How can I accomplish this with PHP? I know I can
use the ICE utility, but I would prefer not to. Can I do this with the
native functions that are builtin to PHP?
blntskul
blntskul's Profile: http://forums.novell.com/member.php?userid=10433
View this thread: http://forums.novell.com/showthread.php?t=370448Found it. It's the 'userpassword' attribute.
blntskul
blntskul's Profile: http://forums.novell.com/member.php?userid=10433
View this thread: http://forums.novell.com/showthread.php?t=370448 -
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>
Maybe you are looking for
-
I have been given permission for unlocking my iphone 3 GS from Orange. I want to set up the phone for my wife to use with a new number and carrier. Do I unlock under my itunes account first ( I now have a new iphone on this account) or set one up for
-
Unable to access internet when static IP address is configured
Hi I am facing the problem for not getting the internet in AD Server(DC) if configured with static IP address. If we set DHCP it will connect to internet. When I check the IPCONFIG on DHCP settings its showing the external address of the ISP router.
-
Hello fellow posters, IAAL practicing in the IP field. I mostly represent those being sued for patent infirngement. I wanted to give a perspecti've from a legal United States POV. ) No modder has ever been prosecuted, under United Staes IP Law, for I
-
Hi Experts, How we can Map the Source Structure Fields without Auto Field Mapping, if there are more than 200 fields and all are required fields?? Very very urgent. Thanks in Advance, and points rewarded. Regards, -Syed.
-
Hi, i am new to EJB and eclipse ? i am using eclipse 2.1.3 and weblogic 9.2. so, how i can configure weblogic in eclipse ? pls, help me ....