Hi guys
I got dreamweaver to create my authenticated login system which works perfectly but I need a log of users who log into the system.
I have created a seperate table to hold the details: ID, Username and Date
Here is the code from the login page
[php]
<?php $colname_Recordset1 = "1"; if (isset($_SESSION['MM_Username'])) { $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']); } mysql_select_db($database_Harry, $Harry); $query_Recordset1 = sprintf("SELECT * FROM users WHERE Username = '%s'", $colname_Recordset1); $Recordset1 = mysql_query($query_Recordset1, $Harry) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); mysql_select_db($database_Harry, $Harry); $query_Recordset2 = "SELECT * FROM logs"; $Recordset2 = mysql_query($query_Recordset2, $Harry) or die(mysql_error()); $row_Recordset2 = mysql_fetch_assoc($Recordset2); $totalRows_Recordset2 = mysql_num_rows($Recordset2); session_start() ?> <?php mysql_query("INSERT INTO logs SET Date = NOW()"); $colname_Recordset1 = "1"; if (isset($_SESSION['MM_Username'])) { $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']); } mysql_select_db($database_Harry, $Harry); $query_Recordset1 = sprintf("SELECT BalanceDue, AccountStatus FROM users WHERE Username = '%s'", $colname_Recordset1); $Recordset1 = mysql_query($query_Recordset1, $Harry) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?>[/php]
I managed to get this working [php]mysql_query(“INSERT INTO logs SET Date = NOW()”);[/php]
and it displays the Date properly but I cannot seem to get a username put in