Copy link to clipboard
Copied
I use dreamweaver's Login behavior and would like to add a timestamp into the database table. So if someone logs in, the current date will be inserted into the table. I have no success in combining the login and the update database behavior. Could someone show me the way?
Leolux
Copy link to clipboard
Copied
Hi,
You can insert the current timestamp that only matches the PhpMyadmin db when uses Dreamweaver by adding this value to the column that stores the login_date as follow:
In the registration form select the date field and set it`s value to whether to hidden or default value to:
<input type="hidden" name="date_gs" value="<?php $now = date('Y-m-d-H:i:s'); echo $now; ?>" />
Also see the attahements to see how i added the current date_time to my db field.
Open the attachements...
Copy link to clipboard
Copied
Thank you for your input, Waleed.
In the source code I have this:
if (isset($_POST['username'])) {
$loginUsername=sha1($_POST['username']);
$password=sha1($_POST['password']);
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "welcome.php";
$MM_redirectLoginFailed = "login.php";
$MM_redirecttoReferrer = false;
Would that be the right place to put in the update behavior? Or should I put it under that code?
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
Regards
Leolux
Copy link to clipboard
Copied
Hi, actually it won`t work that way, i think it will need more work to do that just entering the current date value!
The work should be done:
#1: You have to create another table in your database to store recent login information.
a) this table structure is:
- Primary_key = ID
- Foreign_key = Current Login Member ID {$_SESSION['kt_login_id']}
- Last Login Date = you can use the default value mentioned before = <?php $now = date('Y-m-d-H:i:s'); echo $now; ?>
- IP Address = REMOTE_ADDR
#2: Apply an insert transaction or custom_trigger "if required" to insert the above information into the new created table depending on the current logged in user ID which is: $_SESSION['kt_login_id']
__
Best Regards
Waleed Barakat
Developer-Online Creator and programmer
Copy link to clipboard
Copied
Thank you - I will work on your suggestion. Nevertheless I wonder why there is no way to put that whole thing into the login-behavior-code. Perhaps the cold days in winter will clean my brain
Cheers
Leolux