Code Help Please. Code Help Please.
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Code Help Please.

Started by Justttt, May 07, 2006, 03:37:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Justttt

hey i have tried to create this code but i get unexpected errors and dont no what am doing wrong could i have a little help pleaseee...

<!--loginbox //-->
<?

if (USER_NAME == Anonymous) {
   print <<< EOT
  ?>     
<TR>
          <TD>
            <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
              <TBODY>
              <TR>
                <TD class=infoBoxHeading height=14><IMG height=14 alt=""
                  src="default_files/corner_right_left.gif" width=11
border=0></TD>
                <TD class=infoBoxHeading width="100%" height=14>Login Here</TD>
                <TD class=infoBoxHeading noWrap height=14><IMG height=14
                  alt="" src="default_files/pixel_trans.gif" width=11
                border=0></TD></TR></TBODY></TABLE>
            <TABLE class=infoBox cellSpacing=0 cellPadding=1 width="100%"
            border=0>
              <TBODY>
              <TR>
                <TD>
                  <TABLE class=infoBoxContents cellSpacing=0 cellPadding=3
                  width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD><IMG height=1 alt=""
                        src="default_files/pixel_trans.gif" width="100%"
                        border=0></TD></TR>
                    <TR>
                      <TD class=boxText align=middle>
 
              <form action="../album/login.php?referer=$referer " method="post" name="loginbox" id="cpgform">
<!-- Start standard table -->
<table  width="16%" cellpadding="0" cellspacing="1" class="maintable">
        <tr>
                <td class="tableh1" colspan="2">User Name </td>
        </tr>
                 
                 
                  <tr>
                        <td class="tableb" width="40%"><input type="text" class="textinput" name="username" style="width: 100%" tabindex="1" /></td>
                  <tr>
                    <td colspan="2" align="center" class="tableb"><div align="left">Password <br>
                      <input type="password" class="textinput" name="password" style="width: 100%" tabindex="2" />
                      Remember me
                      <input name="remember_me" type="checkbox" class="checkbox" value="1" tabindex="3" />                   
                      </div></td>
                  </tr>
</table>

  <INPUT title=" Login "
                              type=image alt=Login
                              src="default_files/button_login.gif" border=0>
</form>

                        <br>
                        <table align="center" width="89%" cellspacing="1" cellpadding="0" class="maintable">
       </TABLE></TD></TR>
                    <TR>
                      <TD><IMG height=1 alt=""
                        src="default_files/pixel_trans.gif" width="100%"
                        border=0></TD></TR></TABLE></TD></TR></TABLE></TD></TR>
<? EOT;

} else {
?>

<TR>
          <TD>
            <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
              <TBODY>
              <TR>
                <TD class=infoBoxHeading height=14><IMG height=14 alt=""
                  src="default_files/corner_right_left.gif" width=11
border=0></TD>
                <TD class=infoBoxHeading width="100%" height=14>Welcome</TD>
                <TD class=infoBoxHeading noWrap height=14><IMG height=14
                  alt="" src="default_files/pixel_trans.gif" width=11
                border=0></TD></TR></TBODY></TABLE>
            <TABLE class=infoBox cellSpacing=0 cellPadding=1 width="100%"
            border=0>
              <TBODY>
              <TR>
                <TD>
                  <TABLE class=infoBoxContents cellSpacing=0 cellPadding=3
                  width="100%" border=0>
                    <TBODY>
                    <TR>
                      <TD><IMG height=1 alt=""
                        src="default_files/pixel_trans.gif" width="100%"
                        border=0></TD></TR>
                    <TR>
                      <TD class=boxText align=middle>
 
              <br>

                        <table align="center" width="89%" cellspacing="1" cellpadding="0" class="maintable">
       </TABLE></TD></TR>
                    <TR>
                      <TD><IMG height=1 alt=""
                        src="default_files/pixel_trans.gif" width="100%"
                        border=0></TD></TR></TABLE></TD></TR></TABLE></TD></TR>
 
   

<? } ?>
<!-- loginbox_eof //-->
J U S T T T T

Joachim Müller

1) Don't use short tags like <? , but long ones like <?php
2) Either use the heredoc syntax or end php, but not both nor a mixture

You code should look like this:<?php
if (USER_NAME == '') {
   print <<< EOT
<table>
  <tr>
    <td>foo</td>
  </tr>
</table>
EOT;
}
?>
or like this<?php
if (USER_NAME == '') {
?>

<table>
  <tr>
    <td>foo</td>
  </tr>
</table>
<?php
}
?>
However, the constant USER_NAME will probably not be "Anonymous", and checking for strings must be done by putting the content into quotes. Checking for a user not being logged in works differently. This is very basic PHP, you should do some reading - http://www.php.net/manual/en/
There are postings that describe what you need to do to display a login form for visitors who aren't logged in.

Justttt

J U S T T T T