Log in Error Need Help

This is a discussion on "Log in Error Need Help" within the PHP Forum section. This forum, and the thread "Log in Error Need Help are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Feb 20th, 2007, 05:32
Up'n'Coming Member
Join Date: Jul 2006
Location: manila
Age: 28
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Log in Error Need Help

i got this error can anybody help me below is the code..

Warning: Cannot modify header information - headers already sent by (output started at C:\Server\htdocs\index.php:7)


<?php
ob_start();
//include the header.php file
require("config.php");
//Write the login form out
echo "<form method=post action=index.php?action=check><table><tr><td>Usern ame:</td><td><input type=text name=Uname></td></tr><tr><td>Password:</td><td><input type=password name=Pword></td></tr>
<tr><td><a href=forgotpassword.php>Forgot password</a></td><td><input type=submit value=Login></td></tr></table>
Don't have an account yet? <a href=register.php>Register Here</a><br></form>";

//check the input
if($_GET['action'] == 'check')
{
//find the user
$result = mysql_query("SELECT * FROM loginphp WHERE Uname='{$_POST['Uname']}'") or die(mysql_error());
$row = mysql_fetch_array( $result ); //set $row to result
if($row['Uname'] == "")
{
echo error();
}
else
{
//$enc = md5($_POST['Pword']);
$enc = $_POST['Pword'];
if($row['Pword'] == $enc)
{
$_SESSION['Uname'] = $_POST['Uname'];
$_SESSION['lp'] = 'pl';
header("Location: main.php");
exit;
}
else
{
echo error();
}
}
}
function error()
{
echo "<b>The username/password is incorrect</b>";
}
?>
Reply With Quote

  #2 (permalink)  
Old Feb 20th, 2007, 08:28
Ryan Fait's Avatar
SuperMember

SuperMember
Join Date: May 2006
Location: Las Vegas
Posts: 3,786
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Log in Error Need Help

You can only use redirects before anything is written to the page. You need to stick header("Location: main.php"); above the echos.
Reply With Quote
Reply

Tags
login

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Getting the &quot;Microsoft JET Database Engine error '80040e14'&quot; error. VegaLA Classic ASP 3 Jan 26th, 2008 00:12
Keep getting error message Microsoft VBScript runtime error '800a01a8' cpando1974 Classic ASP 2 Aug 7th, 2007 12:00
Error 500 - Internal server error JasonStanley PHP Forum 3 Apr 23rd, 2007 17:56


All times are GMT. The time now is 18:32.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43