gwh362692
04-07-2009, 06:30 AM
Hi everyone,
I'm creating an application where people can register for an event. I planned for there to be 3 pages to this application. I've started by creating the registration page where the user fills in their contact details. I built this using security assist. This works well and on the press of the submit button it inserts all the details into a visitors table and redirects to the second page of the application.
I'm onto this second step now trying to create the second page. At the top of this page I'd like for the information that they just filled out on the previous page to be visible as 'static' information just so that they can confirm that everything was entered correctly. When I used the security assist wizard on the previous page, it created a visitors_Profile.php page where users could update their information, so I planned to have a link to this profile page on the second page of my application so that if their details need updating they can do it on this profile page. I'm having problems though figuring out how to get the current user's data from the database table onto the page in a 'static' form. Can someone tell me which parts of the super suite I'd use to accomplish this? Maybe provide brief instructions how to get it done? Would it include using session variables or something?
Appreciate any help.
Ray Borduin
04-07-2009, 07:26 AM
Instead of SecurityAssist, you should probably use dataassist. Security Assist is mainly about login and if you don't want login, DataAssist is a better solution for database manipulation in general.
You may want to redo your registration page with dataassist, or at least remove the insert record server behavior currently applied and apply the one from dataAssist instead.
This will automatically store the newly inserted record ID into a session variable that you can then use to filter a recordset on your second page that will allow you to display the newly inserted results.
gwh362692
04-07-2009, 07:40 AM
Thanks for the reply,
The thing is that I actually do need login because on the registration page itself, as well as there being a form for new registrations, there will also be a smaller form for people who have previously registered to log in. The application will be used over and over again as this not-for-profit organisation offers events to its members throughout the year, so as events come up people will either register or login as the case may be.
... or at least remove the insert record server behavior currently applied and apply the one from dataAssist instead.
If I apply the one from dataAssist will everything else stay intact, ie. everything that I'd done through the security assist wizard?
This will automatically store the newly inserted record ID into a session variable that you can then use to filter a recordset on your second page that will allow you to display the newly inserted results.
I understand how to create a recordset but can you explain briefly how I'd use the session variable to filter the recordset? Which dialogue box do I do this in?
Ray Borduin
04-07-2009, 07:53 AM
1) yes everything else will stay intact.
In the simple recordset interface you can choose to filter from a session variable directly from the dropdown and enter the session variable name.
gwh362692
04-07-2009, 08:06 AM
Ok great.
Just one other thing - when I used the security assist wizard it created a separate visitor_login.php page. I mentioned earlier that I wanted this login form to be on the same page as the new registration form. Can you tell me how to move this login form so that it's actually on this first rego page? If I just copy and paste the code how would I know where to place the php code so that it doesn't mess with the code already on the rego page?
Ray Borduin
04-07-2009, 08:13 AM
Just copy and paste the form and set the form action to submit to the original page... You don't need to move any php code if the form submits to the page with the php code.
gwh362692
04-07-2009, 08:25 AM
Just copy and paste the form and set the form action to submit to the original page... You don't need to move any php code if the form submits to the page with the php code.
Just need a bit more clarification - sorry I'm a real beginner - you were saying to set the form action to submit to the original page – The following is the current form action:
<form action="<?php echo ($_SERVER["PHP_SELF"].(isset($_SERVER["QUERY_STRING"])?"?".htmlentities($_SERVER["QUERY_STRING"]):""));?>" method="post" name="WAATKLogInForm" id="WAATKLogInForm">
...how do I change the code so that the action is submitting to the rego page? Is this right - I mean the rego page is the page with the php code right? I'm confused.
Also are you saying that I don't need all this extra code below? I was following the tutorials in the Introduction to SecurityAssist solution recipe to encrypt the passwords - won't I need all this on the other page?
<?php require_once("WA_SecurityAssist/WA_SHA1Encryption.php"); ?>
<?php
if (!isset($_SESSION)) {
session_start();
}
?>
<?php require_once('Connections/localhost.php');?>
<?php require_once('Connections/localhost.php');?>
<?php require_once('Connections/localhost.php');?>
<?php require_once( "WA_SecurityAssist/Helper_PHP.php" ); ?><?php
if ((((isset($_POST["autologinoption"]))?$_POST["autologinoption"]:"") != "")) {
setcookie("AutoLoginPWD", "".((isset($_POST["userpassword"]))?$_POST["userpassword"]:"") ."", time()+(60*60*24*30), "/", "", 0);
}
?><?php
if ((((isset($_POST["autologinoption"]))?$_POST["autologinoption"]:"") != "")) {
setcookie("AutoLoginUN", "".((isset($_POST["username"]))?$_POST["username"]:"") ."", time()+(60*60*24*30), "/", "", 0);
}
?><?php
if ((((isset($_POST["remembermeoption"]))?$_POST["remembermeoption"]:"") != "")) {
setcookie("RememberMePWD", "".((isset($_POST["userpassword"]))?$_POST["userpassword"]:"") ."", time()+(60*60*24*30), "/", "", 0);
}
?><?php
if ((((isset($_POST["remembermeoption"]))?$_POST["remembermeoption"]:"") != "")) {
setcookie("RememberMeUN", "".((isset($_POST["username"]))?$_POST["username"]:"") ."", time()+(60*60*24*30), "/", "", 0);
}
?><?php
if (isset($_POST["LogIn_x"]) && !isset($_POST["remembermeoption"])) {
setcookie("RememberMePWD", "", time()+(60*60*24*30), "/", "", 0);
}
?><?php
if (isset($_POST["LogIn_x"]) && !isset($_POST["remembermeoption"])) {
setcookie("RememberMeUN", "", time()+(60*60*24*30), "/", "", 0);
}
?>
<?php
if($_SERVER["REQUEST_METHOD"] == "POST"){
$WA_Auth_Parameter = array(
"connection" => $localhost,
"database" => $database_localhost,
"tableName" => "visitors",
"columns" => explode($WA_Auth_Separator,"VisitorUserName".$WA_Auth_Separator."VisitorPassword"),
"columnValues" => explode($WA_Auth_Separator,"".((isset($_POST["username"]))?$_POST["username"]:"") ."".$WA_Auth_Separator."".WA_SHA1Encryption(((isset($_POST["userpassword"]))?$_POST["userpassword"]:"")) .""),
"columnTypes" => explode($WA_Auth_Separator,"text".$WA_Auth_Separator."text"),
"sessionColumns" => explode($WA_Auth_Separator,"VisitorID"),
"sessionNames" => explode($WA_Auth_Separator,"VisitorID"),
"successRedirect" => "rego_step2.php",
"failRedirect" => "visitors_EmailPW.php",
"gotoPreviousURL" => FALSE,
"keepQueryString" => TRUE
);
WA_AuthenticateUser($WA_Auth_Parameter);
}
?>
<?php
if((((isset($_SESSION["VisitorID"]) && $_SESSION["VisitorID"] != "")?"LoggedIn":"") == "")&&(((isset($_COOKIE["AutoLoginUN"]))?$_COOKIE["AutoLoginUN"]:"") != "")&&(((isset($_COOKIE["AutoLoginPWD"]))?$_COOKIE["AutoLoginPWD"]:"") != "")){
$WA_Auth_Parameter = array(
"connection" => $localhost,
"database" => $database_localhost,
"tableName" => "visitors",
"columns" => explode($WA_Auth_Separator,"VisitorUserName".$WA_Auth_Separator."VisitorPassword"),
"columnValues" => explode($WA_Auth_Separator,"".WA_SHA1Encryption(((isset($_POST["userpassword"]))?$_POST["userpassword"]:"")) ."".$WA_Auth_Separator."".((isset($_COOKIE["AutoLoginPWD"]))?$_COOKIE["AutoLoginPWD"]:"") .""),
"columnTypes" => explode($WA_Auth_Separator,"text".$WA_Auth_Separator."text"),
"sessionColumns" => explode($WA_Auth_Separator,"VisitorID"),
"sessionNames" => explode($WA_Auth_Separator,"VisitorID"),
"successRedirect" => "rego_step2.php",
"failRedirect" => "",
"gotoPreviousURL" => FALSE,
"keepQueryString" => TRUE
);
WA_AuthenticateUser($WA_Auth_Parameter);
}
?>
Ray Borduin
04-07-2009, 09:07 AM
<form action="loginpage.php" >
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.