Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 After Creating Login - Creating User pages

Author  Topic 

crossroads
Starting Member

2 Posts

Posted - 2011-06-08 : 15:15:46
I've created a login/logout backend as practice.

It seems that the login and logout are working properly. When asking for the username, the correct username came up. however, when I try to call on different columns than the username or password columns, it can't seem to differentiate admin1 from admin2.

so when anyone logs in, it shows the correct username, but always shows the other information (blurb, image, status) for admin1.

I'm using a script I found here: http://www.intechgrity.com/create-login-admin-logout-page-in-php-w/

It works fine, the logging in and out is working. How can I call upon other columns in that specific row? So admin1 (id=1) can only see data in the row associated with id=1?

I'm assuming my issue is with my mysql query, as I'm brand new to that coding.
So in short, the two users are supposed to have different images, different blurbs, and different statuses. But it only shows the first admin's info no matter which is logged in.

Here's the admin page code:
<?php
session_start(); //Start the session
define(ADMIN,$_SESSION['name']); //Get the user name from the previously registered super global variable
if(!session_is_registered("admin")){ //If session not registered
header("location:login.php"); // Redirect to login.php page
}
else //Continue to current page
header( 'Content-Type: text/html; charset=utf-8' );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Welcome To Admin Page Demonstration</title>
</head>
<body>
<h1>Welcome To Admin Page </h1><br />
You are logged in as <?php echo ADMIN /*Echo the username */ ?> |
<a href="logout.php">Logout</a> <!-- A link for the logout page -->
<?php
$row = $_SESSION['column']


?>

<?php
echo "<br /><br />"; ?>
Image: <img src="<?php echo $row['image']; ?>"><br />
<?php
echo "Status: ".$row['status'];
echo "<br />";
echo "Blurb: " ?><?php
$quote_style = ENT_QUOTES;
echo html_entity_decode(html_entity_decode($row['blurb'], $quote_style), ENT_QUOTES);
?>


<p>Change your status:
<form name="Availability" action="changestatus.php" method="get">
<input type='radio' name='status' value='available' />Available
<input type='radio' name='status' value='busy' />Busy
<input type='radio' name='status' value='unavailable' />Unavailable
<input type='submit' value='Submit' />
</form>
<!-- <form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="10000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form> -->

<p><form method="post" action="changeblurb.php">
<textarea rows="5" cols="60" wrap="physical" name="comments">
<?php $quote_style = ENT_QUOTES;
echo html_entity_decode(html_entity_decode($row['blurb'], $quote_style), ENT_QUOTES); ?>
</textarea>
<input type="submit" value="Submit">
</form>
</p>


Thank you in advance.

Skorch
Constraint Violating Yak Guru

300 Posts

Posted - 2011-06-08 : 18:55:33
How does this relate to SQL Server?

Some days you're the dog, and some days you're the fire hydrant.
Go to Top of Page

crossroads
Starting Member

2 Posts

Posted - 2011-06-08 : 21:01:35
"I'm assuming my issue is with my mysql query, as I'm brand new to that coding."

I know this is php code, but it relates directly to calling upon information from the mySQL database. I've posted about this in PHP forums, as well, to cover my bases, but figured to try a few routes. Hopefully someone can help me with this.
Go to Top of Page

Skorch
Constraint Violating Yak Guru

300 Posts

Posted - 2011-06-09 : 18:22:14
I would try posting on the MySQL forums also. This is a Microsoft SQL Server forum, so you're unlikely to find answers here.. Although someone with MySQL experience is certainly welcome to chime in.
Go to Top of Page
   

- Advertisement -