开发者

how to hidden and replace html block with session?

If user press (sign in) to my site. (login block) will be hidden and replace with (sign out block)

i know this will made with session but i cant do it so i need some help.....

                                     <div class="sidebar">

<!-- ---------------------------------------------------------------------------------------- -->
                               <!-- Begin Sign in block  -->


         <div class="art-Block">
                            <div class="art-Block-tl"></div>
                            <div class="art-Block-tr"></div>
                            <div class="art-Block-bl"></div>
                            <div class="art-Block-br"></div>
                            <div class="art-Block-tc"></div>
                            <div class="art-Block-bc"></div>
                            <div class="art-Block-cl"></div>
                            <div class="art-Block-cr"></div>
                            <div class="art-Block-cc"></div>
                            <div class="art-Block-body">
                                           <div class="art-BlockHeader">
                                            <div class="l"></div>
                                            <div class="r"></div>
                                            <div class="art-header-tag-icon">
                                             <div class="t">Sign in</div>
                                             </div>
                                             </div><div class="art-BlockContent">
                                             <div class="art-BlockContent-body">





  <form action="login.php" method="post" >
  <table width="171" border="0" >
  <tr>
    <td width="97">
    <input class="put" name="uname"  type="text" size="10" />    </td>
    <td width="64" align="right" class="text_un">User Name</td>
  </tr>
  <tr>
    <td>
    <input  type="password" size="10" name="password" /></td>
    <td align="right" class="text_pw">Pass Word</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td align="right" valign="top"><input class="button" type="submit" name="button" id="button" value="Sign in " /></td>
  </tr>

  </table>
  </form>




                                  </div>
                                  </div>
                                  </div>
                                  </div>


                            <!-- End Sign in block -->

<!-- ---------------------------------------------------------------------------------------- -->


                           <!-- Begin Sign Out Block  -->

         <div class="art-Block">
                            <div class="art-Block-tl"></div>
                     开发者_运维知识库       <div class="art-Block-tr"></div>
                            <div class="art-Block-bl"></div>
                            <div class="art-Block-br"></div>
                            <div class="art-Block-tc"></div>
                            <div class="art-Block-bc"></div>
                            <div class="art-Block-cl"></div>
                            <div class="art-Block-cr"></div>
                            <div class="art-Block-cc"></div>
                            <div class="art-Block-body">
                                           <div class="art-BlockHeader">
                                            <div class="l"></div>
                                            <div class="r"></div>
                                            <div class="art-header-tag-icon">
                                             <div class="t">Sign out </div>
                                             </div>
                                             </div><div class="art-BlockContent">
                                             <div class="art-BlockContent-body">





  <form action="login.php" method="post" >
  <table width="171" border="0" >

  <tr>
    <td>&nbsp;</td>
    <td align="right" valign="top"><input class="button" type="submit" name="button" id="button" value="Sign Out " /></td>
  </tr>

  </table>
  </form>





                                  </div>
                                  </div>
                                  </div>
                                  </div>

                            <!-- End Sign Out Block  -->

                                  </div>
                                  </div>


When you start the session, you have a variable in it, right? So you have to create a simple if statement:

if (isset($_SESSION['your_variable'])) {
    // display the "log in" code
}
else {
    // display the "log out" code
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜