Session problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • NurAzije

    Session problem

    I have this code:
    <?php session_start() ;
    if(!empty($_SES SION["username"]))
    {
    $usern=$_SESSIO N["username"];
    $passw=$_SESSIO N["password"];
    }else{
    echo "<meta http-equiv=\"refresh \"
    content=\"0;URL =index.php?aler t=1\">";
    }
    include "functions.php" ;
    include "config.php ";
    $userid=$_GET['userid'];
    $username=$_GET['username'];
    $password=$_GET['password'];
    $firstname=$_GE T['firstname'];
    $lastname=$_GET['lastname'];
    $fatherid=$_GET['fatherid'];
    $motherid=$_GET['motherid'];
    $registered=$_G ET['registered'];
    $birthdate=$_GE T['birthdate'];
    $partnerid=$_GE T['partnerid'];
    $birthplace=$_G ET['birthplace'];
    $deathdate=$_GE T['deathdate'];
    $deathplace=$_G ET['deathplace'];
    $graveplace=$_G ET['graveplace'];
    $userlevel=$_GE T['userlevel'];
    $gender=$_GET['gender']; ?>
    <head>
    <title>Modify the Tree</title>
    <style type="text/css">
    <!--
    ..url {
    color: #cccccc;
    text-decoration: none;
    cursor: hand;
    }
    -->
    </style>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    </head>
    <body bgcolor="#FFFFF F" leftmargin="0" topmargin="0" marginwidth="0"
    marginheight="0 ">
    <br><br><br>
    <table border="1" align="center" cellpadding="0" cellspacing="5"
    bordercolor="#C CCCCC" bgcolor="#00000 0">
    <tr>
    <td align="center" bgcolor="#CCCCC C"><a
    href="home.php" >Home</a></td>
    <td bgcolor="#CCCCC C">&nbsp;</td>
    </tr>
    <tr>
    <td width="140" bgcolor="#00000 0" valign="top"><t able width="100%"
    height="200" border="1" align="center" cellpadding="10 " cellspacing="0"
    bordercolor="#C CCCCC" bgcolor="#CCCCC C">
    <tr>
    <td height="10%" bgcolor="#CCCCC C">
    <div align="left"></div></td>
    </tr>
    <tr>
    <td height="10%" bgcolor="#00000 0">
    <div align="left"><f ont color="#CCCCCC" ><strong><a
    href="view.php? userid=<? echo $_SESSION["userid"]; ?>" target="_self"
    class="url">Vie w
    Own Tree</a></strong></font></div></td>
    </tr>
    <tr>
    <td height="10%" bgcolor="#00000 0">
    <div align="left"><f ont color="#CCCCCC" ><strong><a
    href="search.ph p" target="_self" class="url">Sea rch
    the Tree</a></strong></font></div></td>
    </tr>
    <?
    if($_SESSION["userlevel"]==1)
    { ?>
    <tr>
    <td height="10%" bgcolor="#00000 0">
    <div align="left"><f ont color="#CCCCCC" ><strong><a
    href="add.php" target="_self" class="url">Add
    a User</a></strong></font></div></td>
    </tr><? } ?>
    <tr>
    <td height="10%" bgcolor="#00000 0">
    <div align="left"><f ont color="#CCCCCC" ><strong><a
    href="logout.ph p" target="_self"
    class="url">Log out</a></strong></font></div></td>
    </tr>
    <tr>
    <td height="50%" bgcolor="#CCCCC C">
    <div align="left"></div></td>
    </tr>
    </table></td>
    <td align="center" bgcolor="#ccccc c">
    <table><tr><td> <div style="overflow :auto; width:550px;
    height:400px;">
    <form action="modify. php" method="get">
    <table width="55%" border="0" cellpadding="2" cellspacing="1"
    align="center">
    <tbody>
    <tr>
    <th width="27%">Fie ld</th>
    <th width="73%">Val ue</th>
    </tr>
    <tr>
    <td bgcolor="#d5d5d 5"><b>userid </b></td>
    <td bgcolor="#d5d5d 5"> <? echo $userid; ?><input name="userid"
    value="<? echo $userid; ?>" type="hidden">
    </td>
    </tr>
    <tr>
    <td bgcolor="#d5d5d 5"><b>passwo rd</b></td>
    <td bgcolor="#d5d5d 5"> <input name="password" value="<? echo
    $password; ?>" size="40" type="text">
    </td>
    </tr>
    <tr>
    <td bgcolor="#e5e5e 5"><b>userna me</b></td>
    <td bgcolor="#e5e5e 5"> <input name="username" size="40"
    type="text" value="<? echo $username; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#e5e5e 5"><b>firstname </b></td>
    <td bgcolor="#e5e5e 5"> <input name="firstname " size="40"
    type="text" value="<? echo $firstname; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#d5d5d 5"><b>lastna me</b></td>
    <td bgcolor="#d5d5d 5"> <input name="lastname" size="40"
    type="text" value="<? echo $lastname; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#e5e5e 5"><b>father id</b></td>
    <td bgcolor="#e5e5e 5"> <input name="fatherid" size="40"
    type="text" value="<? echo $fatherid; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#d5d5d 5"><b>mother id</b></td>
    <td bgcolor="#d5d5d 5"> <input name="motherid" size="40"
    type="text" value="<? echo $motherid; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#e5e5e 5"><b>registera tion date</b></td>
    <td bgcolor="#e5e5e 5"> <input name="registere d" size="40"
    type="text" value="<? echo $registered; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#d5d5d 5"><b>birthdate </b></td>
    <td bgcolor="#d5d5d 5"> <input name="birthdate " size="40"
    type="text" value="<? echo $birthdate; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#e5e5e 5"><b>partnerid </b></td>
    <td bgcolor="#e5e5e 5"> <input name="partnerid " size="40"
    type="text" value="<? echo $partnerid; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#d5d5d 5"><b>birthplac e</b></td>
    <td bgcolor="#d5d5d 5"> <input name="birthplac e" size="40"
    type="text" value="<? echo $birthplace; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#e5e5e 5"><b>deathdate </b></td>
    <td bgcolor="#e5e5e 5"> <input name="deathdate " size="40"
    type="text" value="<? echo $deathdate; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#d5d5d 5"><b>deathplac e</b></td>
    <td bgcolor="#d5d5d 5"> <input name="deathplac e" size="40"
    type="text" value="<? echo $deathplace; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#e5e5e 5"><b>graveplac e</b></td>
    <td bgcolor="#e5e5e 5"> <input name="graveplac e" size="40"
    type="text" value="<? echo $graveplace; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#e5e5e 5"><b>userlevel </b></td>
    <td bgcolor="#e5e5e 5"> <input name="userlevel " size="40"
    type="text" value="<? echo $userlevel; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#e5e5e 5"><b>gender </b></td>
    <td bgcolor="#e5e5e 5"> <input name="gender" size="40"
    type="text" value="<? echo $gender;?>">
    </td>
    </tr>
    </tbody>
    </table><center>
    <input name="submit" value="Add" type="submit">
    <input type="reset"></center></form>
    </div></td></tr></table>
    </td>
    </tr>
    </table></body><? //just an end
    ?>
    The error is:
    Warning: session_start() : Cannot send session cache limiter - headers
    already sent (output started at
    /home/imtecba/public_html/sedin/add.php:1) in
    /home/imtecba/public_html/sedin/add.php on line 1

    Please help me,

  • Janwillem Borleffs

    #2
    Re: Session problem

    NurAzije wrote:[color=blue]
    > Please help me,
    >[/color]

    I already did. As I said, make sure that there's noting before the first
    opening PHP-tag.


    JW


    Comment

    • Pedro Graca

      #3
      Re: Session problem

      NurAzije wrote:[color=blue]
      > I have this code:
      > <?php session_start() ;[/color]
      <snip>[color=blue]
      > meta http-equiv="Content-Type" content="text/html; charset=utf-8">[/color]
      _______________ _______________ _______________ _______________ _^^^^^__

      <snip amount="huge"/>
      [color=blue]
      > ?>
      > The error is:
      > Warning: session_start() : Cannot send session cache limiter - headers
      > already sent (output started at
      > /home/imtecba/public_html/sedin/add.php:1) in
      > /home/imtecba/public_html/sedin/add.php on line 1[/color]

      What editor are you using to edit add.php?
      Are you sure it is not adding something to the beginning of the file?
      .... maybe a BOM [ http://www.unicode.org/faq/utf_bom.html#22 ]

      --
      Mail to my "From:" address is readable by all at http://www.dodgeit.com/
      == ** ## !! ------------------------------------------------ !! ## ** ==
      TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
      may bypass my spam filter. If it does, I may reply from another address!

      Comment

      • NurAzije

        #4
        Re: Session problem

        Sorry for posting twice, I am using Dreamweaver and am sure there is no
        white spacing, but does the includes effect something ??

        Comment

        • Jerry Stuckle

          #5
          Re: Session problem

          NurAzije wrote:[color=blue]
          > Sorry for posting twice, I am using Dreamweaver and am sure there is no
          > white spacing, but does the includes effect something ??
          >[/color]

          I used dreamweaver in the past. You probably DO have white space.

          You need to examine your source code *very* carefully. Even a blank
          line at the end of an include file will cause problems.

          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstucklex@attgl obal.net
          =============== ===

          Comment

          • NurAzije

            #6
            Re: Session problem

            I have solved the problem, it was a hidden space after <?php, but I
            discovered something weird, when I go from one page to another I lose
            the registered session, I must on every page register them again, any
            help with that please ??

            Comment

            • Shelly

              #7
              Re: Session problem


              "NurAzije" <nurazije@gmail .com> wrote in message
              news:1135888408 .415878.143480@ g43g2000cwa.goo glegroups.com.. .[color=blue]
              >I have solved the problem, it was a hidden space after <?php, but I
              > discovered something weird, when I go from one page to another I lose
              > the registered session, I must on every page register them again, any
              > help with that please ??
              >[/color]

              Do you have session_start() at the beginning of every page?

              Also, include files, even if included withing a <?php ?> group, need their
              own <?php ?> in order for the php to work.

              Shelly


              Comment

              Working...