![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 5
![]() |
Cant Login, Code Support
Ok i did define in my access table the following:
alter table access add password varchar(32); This is my login page: <?php require_once("tcurrency.php"); ?>
<?php
session_start();
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($accesscheck)) {
$GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}
if (isset($_POST['username'])) {
$loginUsername=$_POST['username'];
$password=md5($_POST['password']);
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "admin.php";
$MM_redirectLoginFailed = "login.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database, $dbcnx);
$LoginRS__query= sprintf("SELECT username, password FROM access 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, $dbcnx) 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.0 Transitional//EN">
<html>
<head>
<title>Currecny System Login</title>
<style>
*{ FONT-SIZE: 8pt;
FONT-FAMILY: verdana; }
b { FONT-WEIGHT: bold; }
.listtitle
{ BACKGROUND: #425984; COLOR: #EEEEEE; white-space: nowrap; }
td.list { BACKGROUND: #EEEEEE; white-space: nowrap; }
</style>
</head>
<body onLoad="document.form.username.focus();">
<center><br><br><br><br>
<h1>Currency System Login</h1>
<table cellspacing=1 cellpadding=5 border="0" style="border-style:solid; border-width:1px; " align=center bordercolor="#000000">
<tr>
<td class=listtitle colspan=2>Please enter your Username and Password</td></tr>
<form name="frmlogin" method="POST" action="<?php echo $loginFormAction; ?>">
<input type=hidden name=referer value="/">
<tr><td class=list align=right>Username:</td><td class=list><input type=text name=username></td></tr>
<tr><td class=list align=right>Password:</td><td class=list><input type=password name=password></td></tr>
<tr><td class=listtitle align=right colspan=2><input type=submit value='Login'></td></tr>
</form>
</table>
</center></body></html>But I cant login, not sure where is my mistake..... Thanks.
__________________
Personal Portfolio TecBrain Support Forum Linux VS Windows ... Dont Even Think of it .. Distribution: Slackware if (OS==Linux) return success There are 10 kinds of people, those who can read binary numbers and those who can't. |
|
|
|
|
|
#2 |
|
Expert Programmer
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4
![]() |
Could you provide somewhat more information, like what exactly happens... do you get errors, does nothing happen? If so, what does not happen exactly?
|
|
|
|
|
|
#3 | |
|
Hobbyist Programmer
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 5
![]() |
Quote:
I added echo $LoginRS__query and this is what i get: SELECT username, password FROM access WHERE username='admin' AND password='014d35ee757dc31274874e3bab645771' Warning: Cannot modify header information - headers already sent by (output started at d:\apache\htdocs\currency\login.php:24) in d:\apache\htdocs\currency\login.php on line 42
__________________
Personal Portfolio TecBrain Support Forum Linux VS Windows ... Dont Even Think of it .. Distribution: Slackware if (OS==Linux) return success There are 10 kinds of people, those who can read binary numbers and those who can't. |
|
|
|
|
|
|
#4 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
The error message is pretty plain. And true. You can't send header stuff after you've sent other page content. When the material you post references a line, please highlight or otherwise indicate that line in your post.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#5 | |
|
Hobbyist Programmer
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 5
![]() |
Quote:
Thanks.
__________________
Personal Portfolio TecBrain Support Forum Linux VS Windows ... Dont Even Think of it .. Distribution: Slackware if (OS==Linux) return success There are 10 kinds of people, those who can read binary numbers and those who can't. |
|
|
|
|
|
|
#6 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
HTTP is a protocol. Headers describing and controlling the transfer are sent, then the material itself. You might get away with sending a letter to your mom, and ending it with "Dear Mom,", but not with HTTP. I recommend consulting the PHP manual and possibly an RFC.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#7 |
|
Hobbyist Programmer
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 5
![]() |
Got it fixed, I added this line and its working fine, thanks guys.
$_SESSION['basic_is_logged_in'] = true;
__________________
Personal Portfolio TecBrain Support Forum Linux VS Windows ... Dont Even Think of it .. Distribution: Slackware if (OS==Linux) return success There are 10 kinds of people, those who can read binary numbers and those who can't. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|