My code is this. this is a login page. i am creating session after submitting the form. but session is not creating here. but i have created a session at the top just to test, its working. my php version is 5.3+. it was working well before. but the hosting company has a update and the problem begins. all other things are okay.
<?php
ob_start();
session_start();
$_SESSION['sessid'] = 123456789;
print_r($_SESSION);
include('db_connect.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="css.css" type="text/css" />
<title>test</title>
</head>
<body class="oneColElsCtrHdr">
<div id="container">
<div id="header"> <a href="index.php?category=all"><img src="main_logo1.png" border="0" alt="logo" height="100" /></a>
<h2>Celebrating Life Admin Panel</h2>
<div class="clr"></div>
</div>
<div class="clr"></div>
<div id="mainContent">
<?php
if(isset($_POST['submit2']))
{
$username = mysql_real_escape_string($_POST['username']);
$password = md5($_POST['password']);
$query = "SELECT COUNT(*) as num FROM user WHERE username = '$username' AND password = '$password'";
$result = mysql_fetch_assoc(mysql_query($query));
//$result); die();
if($result['num'] > 0)
{
$_SESSION['logged_in'] = TRUE;
}
else
$_SESSION['error'] = "Wrong username or password.";
mysql_close($conn);
}
echo '<h3>Admin Login</h3>';
if($_SESSION['error']!=""){
echo '<div class="error">'.$_SESSION['error'].'</div>';
unset($_SESSION['error']);
}
?>
<?php if(!$_SESSION['logged_in']){ $_SESSION['sessidd'] = 123456789564656;?>
<form action="login.php" method="post">
<table width="300" border="0" cellspacing="0" cellpadding="6" style="margin:0 auto 20px">
<tr>
<th colspan="2" scope="col"> </th>
</tr>
<tr>
<td>Username</td>
<td><input type="text" name="username" /></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password" /></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="submit2" value="Login" /></td>
</tr>
</table>
</form>
<?php }else{ ?>
<table width="300" border="0" cellspacing="0" cellpadding="6" style="margin:0 auto 20px">
<tr>
<th colspan="2" scope="col">
You have successfully logged in.<br />
<a href="index.php?category=all">SHOW ALL REGISTRATION DATA</a>
</th>
</tr>
</table>
<?php } ?>
</div>
<div id="footer">
</div>
</div>
</body>
</html>
<?php ob_flush(); ?>