Hi,
I was wondering how I could display the current user's username on a page other than the members.php page.
<?php
include_once("config.php");
checkLoggedIn("yes");
$currentuser = $_SESSION["login"];
$lvpassword = "1";
$result = mysql_query("SELECT * FROM users WHERE login ='$currentuser'");
$row = mysql_fetch_array( $result );
if ($_POST['txtPassword'] != $lvpassword) {
?>
<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<p><label for="txtpassword">Password:</label>
<br /><input type="password" title="Enter your password" name="txtPassword" /></p>
<p><input type="submit" name="Submit" value="Login" /></p>
</form>
<br />
Your current score is <? echo $row['score']; ?>
<?php
}
else {
?>
<p>Level 1</p>
<?php
}
?>
As you can see, I want to use this user's login name to query a database so I can tell him his score. Thanks for reading! :lol:
Joel