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

Files in current folder. Should be an easy fix.
Never mind. I've asked about this before and just found my answer. Anyway to delete this?

Why use interfaces in PHP (OOP)
I am learning OOP in PHP and its been a pretty good learning experience so far. What I didn't unders

PHP Upload issue
Hi guys,

I have stumble across an interesting issue with my script and is doing my head in.

Displaying Column Names
I have a question regarding the ability to show the column names from my table/query.
What I'm lo

Mass activity scheduling
Hi experts,

Im facing some problems to deal with mass activity jobs.
When I run some

simple ping code
been searchin the site/web and found code thats simple but doesnt work.

I have a personal we

PHP Thumbnail Creation
Ok so i use this function to create thumbnails:

Code: [Select]function createthumb($name,$fil

Need Successful Return
Hello I am currently working a form here, and I have everything figured out except when I click the

Formatting echo from database
So I have a database that stores First and last names, then echos them back to a website, as of now

CURL XML Request [From C to PHP]
Hi,

I need some help converting this into something that will work with PHP.

Code: #

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