Jump to content

Archived

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

Darren2005

Login Help

Recommended Posts

I have a simple login script setup for a website im designing, only when i preview it in my browser no matter what i type in the username and password fields, it always denies me access to the locked page. (even if i enter the correct username and password). Below is the source from the login page:

 

<?php require_once('Connections/Login.php'); ?>

<?php

// *** Validate request to login to this site.

session_start();

 

$loginFormAction = $_SERVER['PHP_SELF'];

if (isset($accesscheck)) {

$GLOBALS['PrevUrl'] = $accesscheck;

session_register('PrevUrl');

}

 

if (isset($_POST['textfield'])) {

$loginUsername=$_POST['textfield'];

$password=$_POST['textfield'];

$MM_fldUserAuthorization = "";

$MM_redirectLoginSuccess = "Granted.php";

$MM_redirectLoginFailed = "Denied.php";

$MM_redirecttoReferrer = false;

mysql_select_db($database_Login, $Login);

 

$LoginRS__query=sprintf("SELECT Username, Password FROM login WHERE Username='%s' AND Password='%s'",

get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));

 

$LoginRS = mysql_query($LoginRS__query, $Login) or die(mysql_error());

$loginFoundUser = mysql_num_rows($LoginRS);

if ($loginFoundUser) {

$loginStrGroup = "";

 

//declare two session variables and assign them

$GLOBALS['MM_Username'] = $loginUsername;

$GLOBALS['MM_UserGroup'] = $loginStrGroup;

 

//register the session variables

session_register("MM_Username");

session_register("MM_UserGroup");

 

if (isset($_SESSION['PrevUrl']) && false) {

$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];

}

header("Location: " . $MM_redirectLoginSuccess );

}

else {

header("Location: ". $MM_redirectLoginFailed );

}

}

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Login</title>

<style type="text/css">

<!--

.style1 {

font-family: Georgia, "Times New Roman", Times, serif;

font-weight: bold;

font-size: 14px;

}

.style2 {color: #CC99FF}

.style4 {font-family: Georgia, "Times New Roman", Times, serif; font-weight: bold; font-size: 12px; color: #FFFFFF; }

-->

</style>

</head>

 

<body>

<form name="form1" method="POST" action="<?php echo $loginFormAction; ?>">

<p> </p>

<p> </p>

<p align="center" class="style1"> </p>

<p align="center" class="style1"> </p>

<table width="233" border="2" align="center" bordercolor="#0000FF">

<tr bordercolor="#0000FF" bgcolor="#000000">

<td colspan="2"><div align="center"><span class="style4">Please Enter your Login Details </span></div></td>

</tr>

<tr bordercolor="#0000FF">

<td width="73"><strong>Username:</strong></td>

<td width="144" bgcolor="#CC99FF"><input type="text" name="textfield"></td>

</tr>

<tr bordercolor="#0000FF">

<td><strong>Password:</strong></td>

<td bgcolor="#CC99FF"><input type="password" name="textfield"></td>

</tr>

<tr bordercolor="#0000FF">

<td bordercolor="#0000FF" bgcolor="#CC99FF"> </td>

<td bgcolor="#CC99FF"><div align="right" class="style2">

<input type="submit" name="Submit" value="Login">

</div></td>

</tr>

</table>

<div align="center"></div>

<div align="center"></div>

</form>

</body>

</html>

 

If anyone has any ideas how this problem can be resolved please let me know.

Many thanks

Share this post


Link to post
Share on other sites

×

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.