Discussions
Categories
Groups
Advertisement
Child Item
Home
Topics
Technology & Internet
Software & Web Development
Design
Login Problem.
off.the.walls
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /Applications/XAMPP/xamppfiles/htdocs/cart/admin/admin_login.php:2) in /Applications/XAMPP/xamppfiles/htdocs/cart/admin/admin_login.php on line 4
Thats the error
This is the code
<?php
session_start();
if(isset($_SESSION)){
header("location: index.php");
exit();
}
?>
<?php
if(isset($_POST) && isset($_POST)){
$manager = preg_replace('#[^A-Za-z0-9]#i', '' , $_SESSION);
$password = preg_replace('#[^A-Za-z0-9]#i', '' , $_SESSION);
include '../storescripts/mysql_connect.php';
$sql = mysql_query('SELECT id FROM admin WHERE username="$manager" AND password="$password" LIMIT 1');
$existCount = mysql_num_rows($sql);
if($existCount == 1){
while($row = mysql_fetch_array($sql)){
$id = $row;
}
$_SESSION = $id;
$_SESSION = $manager;
$_SESSION = $password;
header("location: index.php");
exit();
}else{
echo'That information is incorrect, try again <a href="index.php"> Click Here</a>';
exit();
}
}
?>
Find more posts tagged with
Quick Links
All Categories
Recent Posts
Activity
Unanswered
Groups
Best Of
Advertisement
Advertisement
Comments
Mo14
I had this error a few days ago. I came across this:
http://stackoverflow.com/questions/8028957/headers-already-sent-by-php
I got around it by adding
ob_start()
before the header call.
I don't claim to be a PHP expert so if any come along and this is considered bad practice, don't hurt me.