Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 20th, 2006, 4:36 AM   #1
TecBrain
Hobbyist Programmer
 
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 5 TecBrain is on a distinguished road
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.
TecBrain is offline   Reply With Quote
Old Feb 20th, 2006, 5:12 AM   #2
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4 Polyphemus_ is on a distinguished road
Could you provide somewhat more information, like what exactly happens... do you get errors, does nothing happen? If so, what does not happen exactly?
Polyphemus_ is offline   Reply With Quote
Old Feb 20th, 2006, 7:21 AM   #3
TecBrain
Hobbyist Programmer
 
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 5 TecBrain is on a distinguished road
Quote:
Originally Posted by Polyphemus_
Could you provide somewhat more information, like what exactly happens... do you get errors, does nothing happen? If so, what does not happen exactly?
Actually noting happens, i only get a blank page, that’s all.

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.
TecBrain is offline   Reply With Quote
Old Feb 20th, 2006, 7:33 AM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Feb 20th, 2006, 7:36 AM   #5
TecBrain
Hobbyist Programmer
 
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 5 TecBrain is on a distinguished road
Quote:
Originally Posted by DaWei
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.
Could you explain a bit more DaWei.

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.
TecBrain is offline   Reply With Quote
Old Feb 20th, 2006, 8:00 AM   #6
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Feb 20th, 2006, 10:57 AM   #7
TecBrain
Hobbyist Programmer
 
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 5 TecBrain is on a distinguished road
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.
TecBrain is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:55 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC