Hi guys
I have got a login script that uses a session to display the username on a profile page once they have logged in. The login came to me as a srcipt, I use dreamweaver and I’m trying to create a user account kind of thing on the profile page, so when a customer logs in they see only their estimates and invoices.
Here is the code form the profile page
[php]<?php require_once('../Connections/new.php'); ?>
<?php $maxRows_Recordset1 = 10; $pageNum_Recordset1 = 0; if (isset($_GET['pageNum_Recordset1'])) { $pageNum_Recordset1 = $_GET['pageNum_Recordset1']; } $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1; $colname_Recordset1 = "1"; if (isset($_SESSION['$login_session'])) { $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_SESSION['$login_session'] : addslashes($_SESSION['$login_session']); } mysql_select_db($database_new, $new); $query_Recordset1 = sprintf("SELECT * FROM login WHERE username = '%s'", $colname_Recordset1); $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1, $new) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); if (isset($_GET['totalRows_Recordset1'])) { $totalRows_Recordset1 = $_GET['totalRows_Recordset1']; } else { $all_Recordset1 = mysql_query($query_Recordset1); $totalRows_Recordset1 = mysql_num_rows($all_Recordset1); } $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1; $colname_Recordset1 = "1"; if (isset($_SESSION['<?php echo $login_session; ?>‘])) { $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_SESSION[’<?php echo $login_session; ?>’] : addslashes($_SESSION[’<?php echo $login_session; ?>’]); } mysql_select_db($database_new, $new); $query_Recordset1 = sprintf(“SELECT * FROM login WHERE username = ‘%s’”, $colname_Recordset1); $Recordset1 = mysql_query($query_Recordset1, $new) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?>
<?php include('session.php'); ?> Your Home Pageid | username | password |
<?php echo $row_Recordset1['id']; ?> | <?php echo $row_Recordset1['username']; ?> | <?php echo $row_Recordset1['password']; ?> |
I have created the recordset to display the ID, Username and Password but it returns blank fields, so I’m assuming I’ve not setup something.
The session works as it grabs the username from the login page, and on the profile page it says “welcome - Alex” alex being a test username?
The page can be seen at http://scotair.noip.me
Any help would be great