I built a registration page in Dreamweaver using Developer's Toolbox. I'm trying to figure out how to keep users logged in after they register, instead of having to immediately log back in as they have to now. I asked this question a while back, but didn't get very far. I think the reason why is that code is tricky because it's designed in Developer's toolbox. But I found some more instructions recently:
--------------------------
---
Next you have to add the automatic login functionality. A user is considered logged-in (from the MX Kollection 3 point of view) when two session variables are set (three if using access levels): kt_login_id and kt_login_user. The first stores the user ID and the second stores the user name. So, in order to login the user, you just have to set the correct values for these session variables after the registration process completes. To execute an action after the registration takes place, you must add a Custom Trigger of the AFTER type.
To implement the automatic login, follow the next steps:
Open the register page in Dreamweaver if necessary.
Add a Custom trigger from the Server Behaviors tab > + > MX Kollection > Forms > Custom trigger.
In the Basic tab of the user interface that opens you must add the code that sets the session variable values. Copy and paste the section of code that matches your particular server model below:
For PHP:
$_SESSION['kt_login_id'] = $tNG->getPrimaryKeyValue()
;
$_SESSION['kt_login_user']
= $tNG->getColumnValue('name
_usr');
Next you have to edit the Insert transaction added by the User Registration Wizard, so that it will no longer redirect to the login page. Double click the Insert Transaction in the register page. Replace the value in the After inserting, go to text field with the index page - click the Browse button to select it from the site root or the page that you intend the user to go after successfully logging in
--------------------------
----------
----------
----------
----------
--
So this gives me more to work with than I had before. Based on these instructions, I created the following session variable triggers:
<?php if (!session_id()) session_start(); if ($_SERVER["REQUEST_METHOD"
] == "POST") { $_SESSION["kt_login_user"]
= $tNG->getColumnValue('name
_usr');
}?>
<?php if (!session_id()) session_start(); if (isset($_POST["KT_Insert1"
])) { $_SESSION["kt_login_id"] = $tNG->getPrimaryKeyValue()
;
}
?>
I still can't get the registration form to stay logged in, but I think it may because I have the syntax wrong in the above code. Any ideas on what the code should look like to give it a better chance of working? Thanks for any help. - Dale
Start Free Trial