Jump to content

user echo


techker

Recommended Posts

hey guys im having a problem trying to echo the user that is logged in in the login script my client has.

any body know login manager v3?

if not it does not mater.

so i have tried with echo $username but after it tells me undefined variable..

i need to know were to start with this when you already have a script made up..

cause what is confusing me is how will it know witch user is logged in?

in this script.there is the form that referes to :


<?


setcookie ("LMUSERNAME", $_POST['username']);
setcookie ("LMPASSWORD", $_POST['password']);

include_once ("auth_member.php");
include_once ("admin/authconfig.php");

$username = $_POST['username'];
$password = $_POST['password'];

$Auth = new auth();
$detail = $Auth->authenticate($username, $password,$dbhost,$dbusername,$dbpass,$dbname);
if (($detail==0)||($detail['uname'] == $adminusername))
{
?><HEAD>
<SCRIPT language="JavaScript1.1">
<!--
location.replace("<? echo "$failure"; ?>");
//-->
</SCRIPT>
</HEAD>
<?
}
else
{
$connection = mysql_connect($dbhost, $dbusername, $dbpass);
$SelectedDB = mysql_select_db($dbname);
$result = mysql_query("select distinct welcome from authuser where uname='$username'");
while($row = mysql_fetch_array($result, MYSQL_NUM)) {
$v_welcome=$row[0];
}
if ($v_welcome=='1'){
mysql_query("update authuser set welcome='0' where uname='$username'");
mysql_close($connection);
echo "<meta http-equiv=\"refresh\" content=\"0; URL=$welcome\">";
exit;
}
else {
mysql_close($connection);
echo "<meta http-equiv=\"refresh\" content=\"0; URL=$success\">";
exit;
}

}
?>


witch calls
[code=php:0]
<?


class auth{
// AUTHENTICATE
function authenticate($username, $password,$dbhost,$dbusername,$dbpass,$dbname) {
$enpass=base64_encode("$password");
$query = "SELECT * FROM authuser WHERE uname='$username' AND passwd='$enpass' AND status <> '0'";
$UpdateRecords = "UPDATE authuser SET lastlogin = NOW(), logincount = logincount + 1 WHERE uname='$username' and status='1'";
$connection = mysql_connect($dbhost, $dbusername, $dbpass);
$SelectedDB = mysql_select_db($dbname);
$result = mysql_query($query);
$numrows = mysql_num_rows($result);
$row = mysql_fetch_array($result);
// CHECK IF THERE ARE RESULTS
if ($numrows == 0) {
return 0;
}

else {

$Update = mysql_query($UpdateRecords);
return $row;
}
} // End: function authenticate


function page_check($username, $password,$dbhost,$dbusername,$dbpass,$dbname) {
$enpass=base64_encode("$password");
$query = "SELECT * FROM authuser WHERE uname='$username' AND passwd='$enpass' AND status <> '0'";
$connection = mysql_connect($dbhost, $dbusername, $dbpass);
$SelectedDB = mysql_select_db($dbname);
$result = mysql_query($query);
$numrows = mysql_num_rows($result);
$row = mysql_fetch_array($result);
if ($numrows == 0) {
return false;
}
else {
return $row;
}
} // End: function page_check



} // End: class auth
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.