0

<?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..

Edited by Dani: Fixed code

2
Contributors
6
Replies
7
Views
5 Years
Discussion Span
Last Post by pritaeas
0

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

0

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

0

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

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.