<?php ob_start(); session_start( );

include 'authenticate.php'; ?>

aurheticate.php--------->

<?php 
mysql_connect("localhost", "root", "")  or die (mysql_error());
mysql_select_db("pms") or die (mysql_error());
              if (!isset( $_SESSION['user_id']))
              {
                 if(!isset($_POST['txtuser_name']))
                 header('location:login(Admin).php');

                  $value=mysql_real_escape_string($_POST['user_value']);
                  $user_name = $_POST['txtuser_name'];
                  $pass = $_POST['txtpassword'];
                  //user isentification
                     if($value==1)   
                         {  $query="select admin_name , admin_id from admin where admin_name='$user_name' AND admin_password='$pass'";
                          $sql = mysql_query ($query);

                         if ($result = mysql_fetch_array($sql))
                          {
                                                        //echo'inside fetch array';
                            $_SESSION['user_name'] = $result['admin_name'];
                            $_SESSION['user_id'] = $result['admin_id'];
                            $_SESSION['user_type']=$value;

                          }
                        else 
                       {

                         header('location:login(Admin).php');
                       }
                    }
                    else if($value==2)   
                         {  $query="select leader_name , leader_id from projectleader where leader_name='$user_name' AND leader_password='$pass'";
                           $sql = mysql_query ($query);
                          if ($result = mysql_fetch_array($sql))
                          {
                                                        //echo'inside fetch array';
                            $_SESSION['user_name'] = $result['leader_name'];
                            $_SESSION['user_id'] = $result['leader_id'];
                            $_SESSION['user_type']=$value;
                           }  
                        else 
                       {

                         header('location:login(Admin).php');
                       }
                    }
                    else if($value==3)   
                          {  $query="select client_name , client_id from client where client_name='$user_name' AND client_password='$pass'";

                          $sql = mysql_query ($query);

                          if ($result = mysql_fetch_array($sql))
                          {
                                                        //echo'inside fetch array';
                            $_SESSION['user_name'] = $result['client_name'];
                            $_SESSION['user_id'] = $result['client_id'];
                            $_SESSION['user_type']=$value;


                          }
                         else 
                       {

                         header('location:login(Admin).php');
                       }


                     }

            //end of user check




               }//end of session setting


    ?>

m getting this problem.. even after trying all d solutions given on previous such problems..

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Users\harshit\xampp\htdocs\collegeproject\main(admin).php:1) in C:\Users\harshit\xampp\htdocs\collegeproject\main(admin).php on line 2

had format as utf-8...
made it to ansi.. and problem got solved... thanx all who tried to look for it!!

I know you solved it, but I think the problem is that session_start has to go before ob_start

commented: thnx! :) +0

ohh faced anoder problem recently.. :|
will place ob_start after session_start!! :) thnq!
problem as header warning on line 44!!

it worked!!! thanx a lot!! :) but y do we need ob_start and all output buffer??

Who says you need it? It's a choice, I never use it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.