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

Wierd if else problem
Hi guys,

this probably aint wierd for you, but it seems like php is playin up to me. may b i

Converting numbers to months
The porgram works -just need the last function(month_convert_ to convert numbers to months -thanks.

Product categories for registration
Dear all,

We are going live with the Supplier registered next week. At standard, the 'sel

Image loading
Hi Developers,

I'm trying to display an image from images/image.gif getting the url from mysq

Libraries in C++
Hi all,

I have two libraries. one is based targeted on linux platform and uses another li

If statement help please.
Hello on my site I have 2 content boxes. 1 is for the main content (which is the biggest one) and th

php/mysql problem
Hey all,

Problem: im trying to setup a shop where people can use a drop-down list to select t

Preg_match unknown modifyer
Hello,

Im trying to write a little script for my forums i need to get the reply from my forum

MII Netweaver Server stopped due to CPIC connection Problem
Dear Experts,
We have SAP XMII 12.0 setup running on Netweaver 2004s,7.0, Java Stack only.

Finding digits in variable containing text, and IDing them
$romanstock = "http://www.remoteprice.com/data.asp?storeid=123&itemcode=456&typ

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