How to back previous page with values just entered
Moderators: tjay, seadap, Rogue4ngel, matthewhayashida
Forum rules
How to back previous page with values just entered
currently i am working with login forum (components/com_register)
Here when any one register as new user then if the username is already entered then currently a message is showing 'This username/password already in use. Please try another.' and returning the previous page all the fields left blank. I want such that when it will return the previous page then all the fields without username and password will be filled by the values just entered.
thanks.
Here when any one register as new user then if the username is already entered then currently a message is showing 'This username/password already in use. Please try another.' and returning the previous page all the fields left blank. I want such that when it will return the previous page then all the fields without username and password will be filled by the values just entered.
thanks.
- lobos
- Joomla! Apprentice
- Posts: 30
- Joined: Wed Jul 19, 2006 3:33 pm
- Location: Sao Paulo, Brasil
- Contact:
Re: How to back previous page with values just entered
I guess there are a few ways to do this... you could always save the get / post variables to a session var on the error page, something like this:
at the top of the page:
session_start();
$_SESSION['formvalues'] = $_REQUEST; //this will save all post and get variables.
Then you hack the registration form and add the variables to the form values like this:
//top of page
session_start();
extract($_SESSION['formvalues']); //this extracts the $_SESSION['formvalues'] array into variables - eg $_SESSION['formvalues']['myvar'] becomes $myvar;
//hack the form values
" />
-Lobos
at the top of the page:
session_start();
$_SESSION['formvalues'] = $_REQUEST; //this will save all post and get variables.
Then you hack the registration form and add the variables to the form values like this:
//top of page
session_start();
extract($_SESSION['formvalues']); //this extracts the $_SESSION['formvalues'] array into variables - eg $_SESSION['formvalues']['myvar'] becomes $myvar;
//hack the form values
" />
-Lobos
Respect and honour, sempre isso, the tribal way, the only way.
http://en.wikipedia.org/wiki/Tribes_Vengeance
http://en.wikipedia.org/wiki/Tribes_Vengeance
-
- Joomla! Fledgling
- Posts: 3
- Joined: Sat Jan 26, 2008 7:48 pm
- Contact:
Re: How to back previous page with values just entered
When I use the code
It puts the values into an array within the $_session array, so then when I want to get a value out I need to do something like:
Is there an easy way to expand the fromvalues array as I put it into the $_session array so that I can just use $_Session['risk5']?
Thanks,
David
http://www.ignoranceoffsets.com
Code: Select all
$_SESSION['formvalues'] = $_REQUEST;
It puts the values into an array within the $_session array, so then when I want to get a value out I need to do something like:
Code: Select all
echo "risk5 : ",$_SESSION['formvalues']['risk5'];
Is there an easy way to expand the fromvalues array as I put it into the $_session array so that I can just use $_Session['risk5']?
Thanks,
David
http://www.ignoranceoffsets.com
-
- Joomla! Fledgling
- Posts: 3
- Joined: Sat Jan 26, 2008 7:48 pm
- Contact:
Re: How to back previous page with values just entered
Never mind: Problem solved. In case anyone else wants to know, I used:
David
Code: Select all
$_SESSION = array_merge($_SESSION,$_REQUEST);
David
- lobos
- Joomla! Apprentice
- Posts: 30
- Joined: Wed Jul 19, 2006 3:33 pm
- Location: Sao Paulo, Brasil
- Contact:
Re: How to back previous page with values just entered
davidannis wrote:Never mind: Problem solved. In case anyone else wants to know, I used:Code: Select all
$_SESSION = array_merge($_SESSION,$_REQUEST);
David
be careful with this, it has security nightmare written all over it... one could set any session variable from the url, well maybe... not sure... but be careful
-Lobos
Respect and honour, sempre isso, the tribal way, the only way.
http://en.wikipedia.org/wiki/Tribes_Vengeance
http://en.wikipedia.org/wiki/Tribes_Vengeance
-
- Joomla! Fledgling
- Posts: 3
- Joined: Sat Jan 26, 2008 7:48 pm
- Contact:
Re: How to back previous page with values just entered
I am just using the $_session variable to store values that I collect on a few consecutive screens so that I can use them to do calculations and create a report. The program will be similar to one that was written by a professional programmer for me at http://www.freevaluationsonline.com to do business valuations. He hard coded the name of every variable and I figured there had to be a better way.
Perhaps it's because I'm a real newcomer to this language, but I don't see the risk. As far as I can tell the $_SESSION variable only contains a SESSION ID and the values that were input on the various screens, which the user picks anyway. Am I wrong and there's something else in the $_SESSION array or something that's not in it and really shouldn't be. Is it a Joomla related security issue? Perhaps I should have posted to PHPBuilder.com, but I found the answer here first.
Thanks,
David
http://www.ignoranceoffsets.com/
Perhaps it's because I'm a real newcomer to this language, but I don't see the risk. As far as I can tell the $_SESSION variable only contains a SESSION ID and the values that were input on the various screens, which the user picks anyway. Am I wrong and there's something else in the $_SESSION array or something that's not in it and really shouldn't be. Is it a Joomla related security issue? Perhaps I should have posted to PHPBuilder.com, but I found the answer here first.
Thanks,
David
http://www.ignoranceoffsets.com/
- lobos
- Joomla! Apprentice
- Posts: 30
- Joined: Wed Jul 19, 2006 3:33 pm
- Location: Sao Paulo, Brasil
- Contact:
Re: How to back previous page with values just entered
Well I dunno for sure like I said, but I know for one of my components there are sessions that are set which, if compromised, could cause a significant risk, maybe other components could have problems as well. This is why it would be better to set the session in a sub-dimension of the sessions array as opposed to the root.
But anyway if no one knows the inner workings of your code it's probably not such a risk, but I just thought I would warn you.
-Lobos
But anyway if no one knows the inner workings of your code it's probably not such a risk, but I just thought I would warn you.
-Lobos
Respect and honour, sempre isso, the tribal way, the only way.
http://en.wikipedia.org/wiki/Tribes_Vengeance
http://en.wikipedia.org/wiki/Tribes_Vengeance