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
44
Other forums
Uploading/Downloading files stored in MySQL database
Hey all,
This problem just came up in my website and I'm having a hard time figuring out what
Format timestamp from mysql
When I tried this:
Code: date("m/d/Y H:i A", $row['timestamp'])
I got 12/31/1969 18:
PHP and Javascript
Hi Guys,
Im trying to load the contents of an html file into a text area for editing, this is
C++ Http request?
Code:
string Response = "LOGIN_UNSUCCESSFUL";
System.Net.WebRequest request = Sy
help with email script...
hey
I need help with my mail script
when the form on http://www.mcgdesignstudio.com/c
PHP page is blank
Hi Everyone,
I have a site in which I am able to open the first PHP webpage in my browser but
help with image upload code
Hello,
right now this code I have resizes images and then places them into the uploads folder
I need to increse 6hours more, and i don't know how???
I need to increse 6hours more, and i don't know how???
<tr>
<t
Secure FTP
Hi experts,
There is no SFTP action in MII workbench.
This means it needs developing custo
question about header() security
is is safe to just use the header() function to redirect someone if they are, say, not logged in? or