Error with login script


Posted on 16th Feb 2014 07:03 pm by admin

I am getting an error with my login script:

Error:
Code: Warning: Cannot modify header information - headers already sent by (output started at /home/bucket/public_html/inc/config.php:7) in /home/bucket/public_html/checklogin.php on line 24
checklogin.php
<?php
include "inc/config.php";
// username and password sent from form
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM `admin` WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
// Register $myusername, $mypassword and redirect to file "accounts.php"
session_register("myusername");
session_register("mypassword");
header("location:accounts.php");
}
else
{
header( 'Location: accounts-login.php' ) ;
}
?>

Does anyone spot the problem?

No comments posted yet

Your Answer:

Login to answer
86 Like 44 Dislike
Previous forums Next forums
Other forums

Need help with unexpected T-STRING error
I'm a newbie and I'm still learning PHP. However this error has me stumped. I've googled, searched t

Select Lists into MYSQL
Hello All, I am new to PHP @ 1 week. So borrowing code anywhere I can. I am making progress, but h

How would I convert this into code using an if statement?
ES equals exam score m equals $mean s equals $total. I already coded my mean and total so I'm not g

Help With editting and deleting form
So look at this image :

http://img194.imageshack.us/img194/8272/snapshot5f.png
This table

Get ID from Database when Posting with a HTML Form
I have a form I am submitting to a MySql database. Each product has an ID # attached to it that auto

Table sorting
Hi,

I'm trying to modify the following in order to make the output table sorted alphabeticall

how to insert value
I am having file bookissueadd.php..... in which i am having tag

<td height="21&q

puting for loop in 1 value
hi ,

how do i put this code in 1 value:
Code: <?php
for ($i=1; $i<=5; $i

Somebody hacked into my site and changed coding >>> URGENT HELP NEEDED <<<
I am not that much into programming , but somebody is hacking to my site and injecting some kind of

php code generators
All

Whilst enjoying learning a new language i have come accross a number of free code generat

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash