Code makes box appear after log-in

Discussion in 'PHP' started by chrisj, Aug 24, 2010.

  1. #1
    I'm using this web script that works successfully. It has a section where I can add a text box to appear upon a web user log-in. Instead, what I'd like to do is make the log-in box (form) disappear as soon as the user logs-in. Can you tell where(how) I can change this code to accomplish that? Thanks for any help.

    <form action="login.php" method="post" accept-charset="UTF-8" class="middletext">
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label><font class="font4_15">Username</font></label><span class="username"><input type="text" name="user_name_login" size="9" style="width:70px;" />
    &nbsp;&nbsp;<label><font class="font4_15">Password</font></label><span class="password"><input type="password" name="password_login" size="9" style="width:70px;" />
    <input type="submit" value="[var.lang_login_now]" class="btn_vid1" /></a><!--<a href="login.php"></a>-->
    <input type="hidden" name="submitted" value="yes" />
    <input type="hidden" name="remember_me" value="remember_me" />
    </form>
    </td></tr></table>
    
    <!--Begin Text Box-->
      <!--<div id="txt-box">-->
      <table id="tabX44">
          				<tbody>
    				<tr><td>
      <!--<div class="header-narrow">Text Box</div>-->
      <div class="txt-narrow">
    
      </div>
      <!--<div class="container-narrow-bottom"></div>-->
      <!--[onload_337;block=div;when [var.show_login_box]!=1;comm]-->
            </td></tr>
      	  				</tbody>
    				</table>
      <!--</div>-->
      <!--End Text Box--> 
          
    
    Code (markup):
     
    chrisj, Aug 24, 2010 IP
  2. Rainulf

    Rainulf Active Member

    Messages:
    373
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    85
    #2
    It looks like it's hard-coded. You need to output the form through PHP, not HTML. If user is not logged in, echo the login form, no otherwise.
     
    Rainulf, Aug 24, 2010 IP
  3. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #3
    Something like this:

    
    <?php
    if ( $something = $something) { // You need to put a condition here
    
    echo "Welcome",$member_name;
    
    }else{ echo '<form action="login.php" method="post" accept-charset="UTF-8" class="middletext">
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label><font class="font4_15">Username</font></label><span class="username"><input type="text" name="user_name_login" size="9" style="width:70px;" />
    &nbsp;&nbsp;<label><font class="font4_15">Password</font></label><span class="password"><input type="password" name="password_login" size="9" style="width:70px;" />
    <input type="submit" value="[var.lang_login_now]" class="btn_vid1" /></a><!--<a href="login.php"></a>-->
    <input type="hidden" name="submitted" value="yes" />
    <input type="hidden" name="remember_me" value="remember_me" />
    </form>
    '; }
    
    ?>
    
    PHP:
     
    MyVodaFone, Aug 24, 2010 IP