Jump to content

login not working?


localhost

Recommended Posts

well see, i made a login that used to work and doesnt anymore, displays no error, just reshows the box :( no idea what went wrong!

[code]<?php
ob_start();
$uname = @$_POST['uname'];
$pass = @$_POST['pwd'];
print "<centeR>";
require('includes/connect.php');
require('includes/config.php');
require('global/global_header.php');
//encrypt password before checking against SQL database
$encpass = md5($pass);
//connect to database and check passwaord username combination and get permissions
$query = "SELECT * from users where username = '$uname' and password = '$encpass'";
$result = mysql_query($query) or die('Query failed: ' . mysql_error() . '<hr>There has been an error in the application, please contact the administrator<hr><b>Error: E001</b>');
$uid="";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$permissions =$row['auth'];
$uid = $row['uid'];
}
if ($LOGIN_METHOD == "COOKIE")
{
if ($uid!="")
{
setcookie("DotOmega1", $uname);
setcookie("DotOmega2", $permissions);
setcookie("DotOmega3", $uid);
print "<head>
<title>.Omega alpha testing</title>
<link href=\"omega_themes/default/default.css\" rel=\"stylesheet\" type=\"text/css\" />
</head>";
echo "<br>You have logged in as: ".$uname;
print "<br><br><br><a href=\"index.php\">If you are not redirected automaticaly please follow this link</a>";
echo '<script>document.location = "index.php";</script>';
} else {
print "<head>
<title>$PAGE_TITLE - Login</title>
<link href=\"omega_themes/default/default.css\" rel=\"stylesheet\" type=\"text/css\" />
</head>";
print "<font face=tahoma size=2 color=336ab3><b><br><br>";
echo 'You did not log in sucessfully please try again.
<form method=post action=login.php>
Username:<input type="text" name="uname" id="uname"><br>
Password:<input type="password" name="pwd" id="pwd"><br>
<input type="submit" value="Log In">
</form>
<a href=user_registration.php>Register</a>
';
print "</font></b>";
}
}
if ($LOGIN_METHOD == "SESSION")
{
session_start();
$_SESSION['user_name'] = $uname;
$_SESSION['auth'] = $permissions;
$_SESSION['uid'] = $uid;
if ((isset($_SESSION['user_name']))&&(isset($_SESSION['auth']))&&(isset($_SESSION['uid'])))
{
print "<head>
<title>.Omega alpha testing</title>
<link href=\"omega_themes/default/default.css\" rel=\"stylesheet\" type=\"text/css\" />
</head>";

echo "<br>You have sucessfully logged in as: ".$_SESSION['user_name'];
print "<br><br><br><a href=\"index.php\">If you are not redirected automaticaly please follow this link</a>";
echo '<script>document.location = "index.php";</script>';
} else {
print "<head>
<title>$PAGE_TITLE</title>
<link href=\"omega_themes/default/default.css\" rel=\"stylesheet\" type=\"text/css\" />
</head>";
echo 'You did not log in sucessfully please try again.
<form method=post action=login.php>
Username:<input type="text" name="uname" id="uname"><br>
Password:<input type="password" name="pwd" id="pwd"><br>
<input type="submit" value="Log In">
</form>';
}
}
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/13339-login-not-working/
Share on other sites

it is from config.php which is included and traces all the way back to SESSION

so I have no idea whats going on, it used to work perfectly, then on the main page say welcome, username. and when you posted on the forums it put your username in as the poster. now it doesnt work at all.
Link to comment
https://forums.phpfreaks.com/topic/13339-login-not-working/#findComment-51487
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.