I am using a PHP for my development. but at the time of login I am getting error as PHP Warning: session_start(): Cannot send session cache limiter - headers already sent
This is my session file and added at top of the page.
My code - connection_config.php
<?php
session_start();
//ob_start();
//error_reporting(1);
$server ='localhost';
$user ='**********';
$password ='*********';
$database = '**********';
define ('DB_HOST', $server);
define ('DB_USER', $user);
define ('DB_PASSWORD', $password);
define ('DB_NAME', $database);
function get_connection()
{
$connection=mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME);
// Check connection
if (mysqli_connect_errno())
{
echo 'Failed to connect to MySQL: ' . mysqli_connect_error();
}else
{
return $connection;
}
}
?>
In mysql_function.php
<?php
require_once("connectin_config.php");
In function.php
<?php
require('mysql_functions.php');
In index.php
<?php
include('function/function.php');
login.php
<?php
include('function/function.php');
$mess='';
if(isset($_POST['submit'])){
record_set('get_data','SELECT * FROM `admin` WHERE `email`="'.$_POST['email'].'" and password="'.md5($_POST['password']).'"' );
if($totalRows_get_data){
$row_get_data= mysqli_fetch_assoc($get_data);
$mess='login Successfully';
$_SESSION['admin_id']=$row_get_data['id'];
$_SESSION['admin_phone']=$row_get_data['phone'];
$_SESSION['admin_fname']=$row_get_data['fname'];
$_SESSION['admin_lname']=$row_get_data['lname'];
$_SESSION['user_type']=$row_get_data['user_type'];
$_SESSION['admin_image']=$row_get_data['image'];
$_SESSION['admin_cdate']=$row_get_data['cdate'];
reDirect('index.php');
}else{
$mess='Username or Password Invalid';
}
}
?>