login.php

  <?php 
  session_start();
    ?>
<!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=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="main.css" />
<link  rel="stylesheet" type="text/css"href="menu.css" />
<title>iWebTechnik</title>
<link rel="shortcut icon" href="image/favicon.ico" type="x-icon" />
<link rel="icon" href="image/favicon.ico" type="x-icon" />
<style type="text/css">
<!--
   .style1 {font-family: Arial, Helvetica, sans-serif}
      -->
</style>
<link href="a.css" rel="stylesheet" type="text/css" />
 <script  src="js-image-slider.js" type="text/javascript"></script>

 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

<link href="conatiner2.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
 .style3 {
font-family: "Times New Roman", Times, serif;
font-size: 16px;
color: #FFFFFF;
}
.style4 {color: #CCCCCC}
 -->
 </style>
 </head>
 <body>
<?php 
include('header.php');
 ?>
<div id="header1"></div>
<div id="wrapper">
<div id="navigator">
<ul id="menu-bar">
 <li ><a href="index.php"><img src="image/W-home.png" width="15px" height="15px" alt="iwebhomepage" />Home</a><span    class="hold">welcome</span></a></li>
       <li><a href="aboutus.php">AbouUs</a><span class="hold">corporate profile</span></li>
     <li><a href="work.php">Services</a><span class="hold">what we offers</span>
    <div class="menu-container-4">
   <div class="column-1">
    <h3>WebSite</h3>
 <ul >

     <li ><a href="webdesign.php">Web Design</a></li>
    <li ><a href="webdevelopment.php">Web Development</e></a></li>

    <li ><a href="webhosting.php">Web Hosting</a></li>
   <li ><a href="webmaintenance.php">Website Maintenance</a></li>
    <li ><a href="logodesign.php">Logo Design</a></li>
    <li><a href="graphicdesign.php">Graphic Design</a></li></ul></div>
   <div class="column-3">
    <h3> Search Engine Optimization</h3>
    <ul>
   <li ><a href=""><span class="style1">SEO Services</span></a></li>
   <li><a href="webpromotion.php">SEO Package</a></li>
       <li><a href="webpromotion.php">SEO Consulting</a></li>
   <li ><a href="webpromotion.php">Local SEO Marketing</a></li>
       <li><a href="webpromotion.php">Social Media Marketing</a></li> 
       <li ><a href="webpromotion.php">Search Engine Marketing</a></li></ul></div></li>

    <li><a href="client.php">Our Portfolio</a><span class="hold">our work</span></li>
     <li><a href="requestquote.php">Request Quote</a><span class="hold">to know more</span></li>
    <li><a href="career.php">Career </a><span class="hold">join with us</span></li>
        <li><a href="meetus.php"> Contact Us</a><span class="hold">how to reach us</span></li>
 </ul>
 </div>
        <div id="container6">
    <?php
    include('loginproc.php');
    ?>
      <table width="900" border="0" cellspacing="0.1" cellpadding="0.1">
   <tr>
   <td  align="center" style="margin-top:100; padding-top:100"><p><a href="logout.php"><img src="image/images.jpg" height="100" width="100" alt="back" longdesc="http://back" /></a></p></td>
    </tr>
    </table>

       </div>
     <div id="container7">
      <h2> </h2>
   <h2> </h2>
      <h1><span class="style3">How can I apply for a job? </span> </h1>
       <div align="center"><br> 
     <span class="style4">If you are interested in applying for a position with iwebtechnik, please visit our job search engine. Create/update your profile here in order to apply to jobs, track existing applications and make your resume visible to all recruiters.</span></div>
           </div>
          </div>
    </body>
   </html>


    securedpage.php
        <?php
      ob_start();?>
   <?php
    session_start();
      // Inialize session
     // Check, if username session is NOT set then this page will jump to login page
    if (!isset($_SESSION['userName'])) {
         header('Location: career.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=iso-8859-1" />
    <link rel="stylesheet" type="text/css" href="main.css" />
    <link  rel="stylesheet" type="text/css"href="menu.css" />

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 <link href="a.css" rel="stylesheet" type="text/css" />
   <script  src="js-image-slider.js" type="text/javascript"></script>
       <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
       <link href="style.css" rel="stylesheet" type="text/css">

     <title>iWebTechnik</title>
       <style type="text/css">
     <!--
    .style1 {font-family: Arial, Helvetica, sans-serif}
  -->
     </style>


    <link href="a.css" rel="stylesheet" type="text/css" />
  <script  src="js-image-slider.js" type="text/javascript"></script>

   <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

     <link href="conatiner2.css" rel="stylesheet" type="text/css" />
      <style type="text/css">
   <!--
     .style14 {
    font-family: "Times New Roman", Times, serif;
font-weight: bold;
font-size: 16px;
color: #FFFFFF;
}
-    ->
     </style>
  <script type="text/javascript" src="dropdowncontent.js">
   </script>
    <style type="text/css">
     <!--
   .style1 {
font-family: "Times New Roman", Times, serif;
font-size: 16px;
color: #FFFFFF;
font-weight: bold;
     }
  -->
  </style>
  </head>

     <body>
    <?php 
     include('header.php');
     ?>
   <div id="header1"></div>
 <div id="wrapper">
  <div id="navigator">
<ul id="menu-bar">
       <li ><a href="index.php"><img src="image/W-home.png" width="15px" height="15px" alt="iwebhomepage" />Home</a><span  class="hold">welcome</span></a></li>
    <li><a href="aboutus.php">AbouUs</a><span class="hold">corporate profile</span></li>
   <li><a href="work.php">Services</a><span class="hold">what we offers</span>
  <div class="menu-container-4">
       <div class="column-1">
    <h3>WebSite</h3>


      <ul >

      <li ><a href="webdesign.php">Web Design</a></li>
         <li ><a href="webdevelopment.php">Web Development</e></a></li>

      <li ><a href="webhosting.php">Web Hosting</a></li>
        <li ><a href="webmaintenance.php">Website Maintenance</a></li>
      <li ><a href="logodesign.php">Logo Design</a></li>
    <li><a href="graphicdesign.php">Graphic Design</a></li></ul></div>
         <div class="column-3">
    <h3> Search Engine Optimization</h3>
    <ul>
     <li ><a href="webpromotion.php">SEO Services</a></li>
     <li><a href="webpromotion.php">SEO Package</a></li>
       <li><a href="webpromotion.php">SEO Consulting</a></li>
      <li ><a href="webpromotion.php">Local SEO Marketing</a></li>
       <li><a href="webpromotion.php">Social Media Marketing</a></li> 
     <li ><a href="webpromotion.php">Search Engine Marketing</a></li></ul></div></li>

      <li><a href="client.php">Our Portfolio</a><span class="hold">our work</span></li>
    <li><a href="requestquote.php">Request Quote</a><span class="hold">to know more</span></li>
    <li><a href="career.php">Career </a><span class="hold">join with us</span></li>
      <li><a href="meetus.php"> Contact Us</a><span class="hold">how to reach us</span></li>
     </ul>
       </div>
   <div id="container9">

    <div id="container10">
     <table width="1200" border="0" cellspacing="0.1" cellpadding="0.1" style="margin-top:15px; padding-top:25px;">
<tr>
<td width="819"> </td>
<td width="375" style="float:right"><table width="334"  border="0" cellpadding="0.1" cellspacing="0.1">
<tr>
<td width="144"><a href="securedpage.php" style="text-decoration:none" ><h2 class="style14"><?php echo $_SESSION['userName']; ?></h2></a></td>
<td width="22"> </td>
<td width="81"><p><div id="searchlink" rel="subcontent">
 <h3 class="style1"><img src="image/cog2.png" alt="setting" width="14" height="14" /> Setting</h3>
    </div>



         <DIV id="subcontent" style="position:absolute; visibility: hidden; border: double orange; background-color: white; width:200px; padding:8px;">

       <div style="width:49%; float: left" >
    <p><a href="profileview.php" style="text-decoration: none">Profile View</a><br>
    ..................................................</p>
   <p><a href="profileedit.php" style="text-decoration: none">Profile Edit</a>     <br>..................................................</p>
        <p><a href="http://www.cssdrive.com" style="text-decoration: none">CSS Drive</a><br>..................................................</p>
      <p><a href="http://www.codingforums.com" style="text-decoration: none">Coding Forums</a>
    </div>
      <script type="text/javascript">
      //Call dropdowncontent.init("anchorID", "positionString", glideduration, "revealBehavior") at the end of the page:
      dropdowncontent.init("searchlink", "right-bottom", 500, 'mouseover')
     </script></div>
      </td>
      <td width="23"> </td>
    <td width="85"><p><a href="logout.php" style="text-decoration:none">Logout</a></p></td>
    </tr>
    </table>
       </td>
        </tr>
       </table>
    </div>
   </div>
    </div>
        </body>
    </html>
     <?php ob_clean_flush(); ?>

        loginproc.php
     <?php
    ob_start(); 
   session_start();
       ?>
       <?php
   // Include database connection settings
    $hostname = '...';        // Your MySQL hostname. Usualy named as 'localhost',     so you're NOT necessary to change this even this script has already     online on the internet.
   $dbname   = '...'; // Your database name.
     $username = '...';             // Your database username.
    $password = '...';                 // Your database password. If your database has no     password, leave it empty.
  $dbusername = '';
       $dbpassword = '';
   // Let's connect to host
      mysql_connect($hostname, $username, $password) or DIE('Connection to host is failed,perhaps the service is down!');
  // Select the database
     mysql_select_db($dbname) or DIE('Database name is not available!');

    /*if ($_GET["op"] == "login")
    {
if (!$_POST["username"] || !$_POST["password"])
{
die("You need to provide a username and password.");
}*/
   // Retrieve username and password from database according to user's input
  /*if(isset($_POST['submit']))
  {
   $userName="" .mysql_real_escape_string($_POST['userName']). ""; 
 $passWord="" .mysql_real_escape_string($_POST['passWord']). ""; 
      $encrypt_password=md5($password); // Encrypted Password*/
if(isset($_POST['submit']))
     {
          function check_input($value)
  {
 // Stripslashes
 if (get_magic_quotes_gpc())
  {
      $value = stripslashes($value);
    }
// Quote if not a number
   if (!is_numeric($value))
 {
   $value = "" . mysql_real_escape_string($value) . "";
}
      return $value;
 }
      $u=check_input($_POST['userName']);
       $p=check_input($_POST['passWord']);
      $encrypt_password=md5($p);
   //*********retrieving data from Database********** 

    $query = "SELECT * FROM members WHERE userName='$u' and passWord='$encrypt_password'";
    //$login = mysqli_query("SELECT userName,password FROM 'member' WHERE userName= $_post['username'] AND passWord= $_post['password'])");
      // Check username and password match
     $res = mysql_query($query);
    $rows = mysql_num_rows($res);
  if ($rows==1) {
   // Set username session variable
     while ($row = mysql_fetch_assoc($res))
      {
            $dbusername = $row['userName'];
            $dbpassword = $row['passWord'];
        }
    if ($u==$dbusername && $encrypt_password==$dbpassword)
        {
      $_SESSION['userName'] = $u;
   // Jump to secured page
  //session_destroy(); 
    header ("Location: securedpage.php");
    //window.location= securedpage.php;
     //exit(header("Location: securedpage.php"));
   }}
      //else {
   //Jump to login page
  //echo "user name and password not found";
   }
       else 
        {
            // admin login
            $query2 = mysql_query("SELECT * FROM admin WHERE userName ='$u' AND passWord ='$encrypt_password'");
            $numrow2 = mysql_num_rows($query2);
            if ($numrow2!=0)
            {
                while ($row = mysql_fetch_assoc($query2))
                {
                    $dbusername = $row['userName'];
                    $dbpassword = $row['passWord'];
                }

                //Check to see if they match
              if ($u==$dbusername&&$encrypt_password==$dbpassword)
                {

                    $_SESSION ['userName']=$u;
                    echo "this is admin";
                    header("Location: addurl.php");

                }
                else{

                    echo "Incorrect password";
                }

            }
                else{
            if ($u!=$dbusername&&$encrypt_password!=$dbpassword)
            {die("That user does not exist!");
            }
            }
        }
?>
      <?php ob_flush(); ?>



      please help me i m getting frusted ,help me one

in which page you got the error ?
this mean there is somthing outputed before the session start, check any spaces or any html codes, give the whole error you had.
Normally ob_start(); solve this but apparently you have something outputted before this, like in header.php.

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.