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

Operating System
How in PHP or other language can I detect Operating system, ie Windows XP Home, Windows 7 Ultimate,

how to remove in php string display
My code is

$message="We're looking at developing our website.";

$body= "

File upload issues
Hi Guys,

Can anyone see any issues with this code:
Code: [Select]$setImage= 'productimages

why this query can delete duplicates ?
why this query can delete duplicates ? Anybody can give me the detailed explanation ?

Tha

eregi to preg
Im converting my regex for php 5.3 and I am stuck on the following

Code: [Select]if((eregi(&q

Querying info from one table based on info in another
Hi, I am currently trying to make a part for my user driven website where one user can subscribe to

Help Import Animoto and Youtube
CAn someone help me urgently want to allow users on my website to import youtube/revver/dailymotion

How to update this array?
I am saving a string that looks this: username1, username2, username3...
into a single cell in a

Calling strings from other php class
I have test1.php{
$string1;
$string2;
....
... //10 strings in this class <

Streaming local file from PHP while it’s been written to by a CURL process
I am creating a simple Proxy server for my website. Why I am not using mod_proxy and mod_cache is a

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