...

View Full Version : login



j2freak
12-21-2003, 02:35 AM
<?
include("include/header.php");
include("include/connect.php");
echo "Login</b></td><tr><td class=third>";

if($notice != "")
{
echo"<font class=limegreen><center>$notice</center></font><br>";
}

if($login == "Login")
{
session_register('log_username');
session_register('log_pass');

$query = mysql_query("SELECT * FROM varinder_login_users WHERE username=\"$log_username\" AND pass=\"$log_pass\"");

if($query)
{
die("test");

$check = mysql_fetch_array($query) or die(mysql_error());

if($check[pass] == $log_pass AND $log_pass != "" AND $check[username] == $log_username AND $log_username != "" )
{
function gethostname()
{
$ip = getenv('REMOTE_ADDR');
if (!$ip) { $ip = getenv('REMOTE_HOST'); }
$ip = @GetHostByAddr($ip);
return $ip;
}

$ip = gethostname();
$clock = date("d F H:i:s");

mysql_query("UPDATE varinder_login_users SET last_log=\"$clock\", online=1, ip=\"$ip\" WHERE username=\"$log_username\" AND pass=\"$log_pass\"") or die(mysql_error());

echo "<font class=limegreen><center>Successful login.";
include("include/footer.php");
die();
//Header("Location: game/main.php");
//exit;
}
else
{
session_unregister('log_username');
session_unregister('log_pass');

echo "<font class=limegreen><center>Inavlid login information.";
include("include/footer.php");
die();

//header("Location: login.php?notice=Inavlid login information.");
//exit;
}
}
else
{
echo "<font class=limegreen><center>Inavlid login information.";
include("include/footer.php");
die();
}
}


echo "<form method=post action=login.php>
<center>
<b>Username:</b><input type=text name=log_username size="20"><br>
<b>&nbsp; Password:</b><input type=password name=log_pass size="20"><br>
<br>
<input type=submit name=login value=Login>
</center>
</form>";

include("include/footer.php");
?>

j2freak
12-21-2003, 02:35 AM
once u click the login it doesnt really go to the next page and i want
the next page to retreve info from the database like Users Username and
display it.

i also have a forum thingy and something else that goes with it but the
prob is its very long complecated work.

u have to scan through the whole bloody code deleting bits editing the
database name and a hell lot of other rubbish.

at the momment im just concerned with the login.php file and to actually
make it go to the next page and work properly ect. its half working
theres mento be something else but god knows wots up with it.

zapa
12-21-2003, 03:25 AM
<form method=post action=login.php>

is what you have to edit if you want it to goto newpage.html then change action=login.php to action=newpage.html

you can use print "$fildname" to print username from login.php page

so in newpage.html it would be something line...

<body>
welcome <? print "$login_username" ?>
</body>
</html>

login_username is the your field name for Login.php file Username.

j2freak
12-21-2003, 02:50 PM
thank you database in php is really confusing...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum