Advanced search  

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

Pages: [1]   Go Down

Author Topic: Code Help Please.  (Read 4336 times)

0 Members and 1 Guest are viewing this topic.

Justttt

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 170
    • Trippy-ILLusion.Co.Uk
Code Help Please.
« on: May 07, 2006, 03:37:33 pm »

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...

Code: [Select]
<!--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 //-->
« Last Edit: May 07, 2006, 10:57:05 pm by GauGau »
Logged
J U S T T T T

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Code Help Please.
« Reply #1 on: May 07, 2006, 04:04:05 pm »

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:
Code: [Select]
<?php
if (USER_NAME == '') {
   print <<< EOT
<table>
  <tr>
    <td>foo</td>
  </tr>
</table>
EOT;
}
?>
or like this
Code: [Select]
<?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.
Logged

Justttt

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 170
    • Trippy-ILLusion.Co.Uk
Re: Code Help Please.
« Reply #2 on: May 07, 2006, 04:40:44 pm »

Thanks Problem Solved ;)
Logged
J U S T T T T
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 21 queries.