Stupid PHP ;-;

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Xestrix
    FFR Player
    • Jul 2006
    • 156

    #1

    Stupid PHP ;-;

    I haven't coded PHP in a few years, and I pulled this out of my gmail archives, a code I wrote for a website a couple years ago, and I wanted to implement it. But, it seems to have some errors, and I've been away from PHP so long I can't even remember what I'd be looking for :X Any help would be appreciated :3

    Originally posted by PHP
    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in trade-darkbeauty.php on line 38
    Originally posted by trade-darkbeauty.php
    <?php

    @set_time_limit(0);

    require_once 'smtp_mail.php';

    $to = "[email protected]";
    $from = "$_POST[email]";
    $subject = "Ethereal Cards - Info Change - $_POST[name]";

    $headers = "MIME-Version: 1.0\r\n".
    "Content-type: text/html; charset=iso-8859-1\r\n".
    "From: \"$_POST[name]\" <".$from.">\r\n".
    "To: \"[email protected]\" <".$to.">\r\n".
    "Date: ".date("r")."\r\n".
    "Subject: ".$subject."\r\n";

    $msg = "<center><hr>\n";
    $msg .= "$subject<br>\n";
    $msg .= "<hr></center>\n";
    $msg .= "<b>Name:</b> $_POST[name]<br>\n";
    $msg .= "<b>E-Mail:</b> $_POST[email]<br>\n";
    $msg .= "<b>Website:</b> $_POST[website]<br>\n";
    $msg .= "<b>New E-Mail:</b> $_POST[newmail]<br>\n";
    $msg .= "<b>New Website:</b> '$_POST[newsite]'<br>\n";
    $msg .= "<b>Comments:</b> $_POST[message]<br>\n";
    $msg .= "<b>Sender IP Address:</b> " . $_SERVER['REMOTE_ADDR'] . "<br>\n";
    $msg .= "<b>Sent From:</b> http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]\n";

    // here you can use Check Mail extension to validate $to e-mail address format
    // like: if(checkmail($to)) ...


    $response = smtp_mail($to, $subject, $msg, $from, $headers);

    if($response[0]) echo "
    //[THANK YOU PAGE - START]
    //Type all of the HTML for the "Thankyou" page here. Remember all ["] have to have
    //a [/] in front of them, so instead of ["] it should be [\"] The easiest way to do
    //this is to copy all of your html into notepad and use the "replace all" tool ^^
    <html>
    <head><title>{{ ETHEREAL CARDS }} your eyes only</title>
    </title></head>
    </HEAD>
    <BODY>

    <STYLE TYPE=\"text/css\">

    <!--

    body {scrollbar-face-color: #C0D0CF;
    scrollbar-shadow-color: #73A09E;
    scrollbar-highlight-color: #C0D0CF;
    scrollbar-3dlight-color: #73A09E;
    scrollbar-darkshadow-color:#C0D0CF;
    scrollbar-track-color: #E9EFEF;
    scrollbar-arrow-color:#C0D0CF}

    cursor:default;
    font-size: 7.5pt;
    font-family: \"tahoma\";
    color:#4E7A78;
    line-height:12px;
    letter-spacing:0pt;
    }

    .sub {color: #4E7A78; width: 100%; border-bottom: solid #4E7A78; border-bottom-width: 1; font-size: 8pt; text-transform: lowercase; font-weight:bold; text-align: right;}
    b{color: #EBF1F1; font-weight: bold;}

    .sub2 {color: #4E7A78; width: 100%; border-bottom: dotted #4E7A78; border-bottom-width: 1; font-size: 1pt; text-transform: lowercase; font-weight:bold; text-align: right;}

    p {font-family: tahoma; font-size: 7pt; font-color:#4E7A78;
    line-height: 150%;}

    a:link {color: #74A09F; font-weight: bold}
    a:visited {color: #74A09F; font-weight: bold}
    a:active {color: #74A09F; font-weight: bold}
    a:hover {color: #74A09F; font-weight: bold}

    table { font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.5pt; font-family: tahoma; line-height: 12pt; color: #4E7A78}

    input, textarea
    { background: transparant;
    font-family: tahoma;
    size: 1px;
    color: #4E7A78;
    border-style: dotted;
    border-color: #4E7A78;
    border-width: 1px }

    -->
    </STYLE>
    </head>
    <body>

    <div style=\"position:absolute; top: 0; left: 0;\">
    <img src=\"site/images/001.png\"><br>
    <img src=\"site/images/002.png\"><br>
    <img src=\"site/images/003.png\"><br>
    <img src=\"site/images/004.png\"><br>

    </div>

    <BODY bgcolor=\"#EBF1F1\" background=\"site/images/ecbg.png\">

    <div style=\"position:absolute; top: 526; left: 115; width: 148; \"><FONT
    face=tahoma color=#4E7A78 size=1><div class=\"sub\">STATS</div><div class=\"sub2\">STATS</div><b>Since:</b> 17 June 2005
    <br><b>Decks:</b> 113
    <br><b>Cards:</b> 2825
    <br><b>Members:</b> 101</center>

    <p><div class=\"sub\">ETHEREAL</div><div class=\"sub2\">ETHEREAL</div><img src=\"site/images/thingy.gif\"> <a href=\"about.php\">About</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"rules.php\">Rules</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"join.php\">Join</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"cards.php\">Cards</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"badges.php\">Badges</a>

    <br><img src=\"site/images/thingy.gif\"> <a href=\"masterbadges.php\">Master Badges</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"members.php\">Members</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"forms.php\">Forms</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"http://1ntoxication.net/boards\" target=\"new\">Forum</a>

    <p><img src=\"site/images/thingy.gif\"> <a href=\"credits.php\">Credits</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"layouts.php\">Layouts</a>

    <br><img src=\"site/images/thingy.gif\"> <a href=\"staff.php\">Staff</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"links.php\">Links</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"faq.php\">FAQ</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"wallofshame.php\">Wall of Shame</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"index.php\">Main</a>

    <p><img src=\"site/images/thingy.gif\"> <a href=\"http://winhill.org/ethereal/cutenews\">Staff Login</a>

    <p><div class=\"sub\">EARNINGS</div><div class=\"sub2\">ETHEREAL</div><img src=\"site/images/thingy.gif\"> <s>Donate</s>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"games.php\">Games</a>
    <br><img src=\"site/images/thingy.gif\"> + <a href=\"claimedcards.php\">Claimed Cards</a>
    <br><img src=\"site/images/thingy.gif\"> + <a href=\"membercards.php\">Member Cards</a>

    <br><img src=\"site/images/thingy.gif\"> + <a href=\"referralcards.php\">Referral Cards</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"shop.php\">Pixel Shop</a>

    <p><div class=\"sub\">TAKE ONE</div><div class=\"sub2\">ETHEREAL</div><center><img src=\"cards/layoutcards/layout05.gif\"> <img src=\"cards/tsubasa17.gif\"><br><img src=\"cards/egypt14.gif\"> <img src=\"cards/azel05.gif\"></center>
    <br>Updated on 05-10-05

    <p><div class=\"sub\">HOST</div><div class=\"sub2\">ETHEREAL</div><a href=\"http://winhill.org\" target=\"new\"><img src=\"site/links/winhill.gif\" border=\"0\"></a>

    <p><div class=\"sub\">DISCLAIMER</div><div class=\"sub2\">ETHEREAL</div>Ethereal Cards is © 2005 by <a href=\"http://1ntoxication.net\" target=_blank>Blok</a>. All layouts, cards etc are made by the staff of this site. The original idea for a tcg is © <a href=\"http://www.scmania.net\" target=_blank>Calico</a>. All rights reserved. All Anime/manga/games and Characters used for the cards are © their rightful owners. Ethereal Cards does not claim any rights and is only using them for fan purposes.
    </div>

    <div style=\"position:absolute; top: 500; left: 270; width: 432; \"><FONT
    face=tahoma color=#4E7A78 size=1><p>
    <div class=\"sub\">join</div><div class=\"sub2\">WELCOME</div>Please read the rules before you join Ethereal Cards. If the form isn't working, you can send an e-mail with the same information as at the form to <b>[email protected]</b>
    <p><center>
    Thank you for your form, you will get a reply asap!
    </center>
    //[THANK YOU PAGE - END]
    //Remember all ["] have to have
    //a [/] in front of them, so instead of ["] it should be [\"] The easiest way to do
    //this is to copy all of your html into notepad and use the "replace all" tool ^^
    ";

    else echo "
    //[ERROR PAGE - START]
    //Type all of the HTML for the "Error" page here. Remember all ["] have to have
    //a [/] in front of them, so instead of ["] it should be [\"] The easiest way to do
    //this is to copy all of your html into notepad and use the "replace all" tool ^^
    <html>
    <head><title>{{ ETHEREAL CARDS }} your eyes only</title>
    </title></head>
    </HEAD>
    <BODY>

    <STYLE TYPE=\"text/css\">

    <!--

    body {scrollbar-face-color: #C0D0CF;
    scrollbar-shadow-color: #73A09E;
    scrollbar-highlight-color: #C0D0CF;
    scrollbar-3dlight-color: #73A09E;
    scrollbar-darkshadow-color:#C0D0CF;
    scrollbar-track-color: #E9EFEF;
    scrollbar-arrow-color:#C0D0CF}

    cursor:default;
    font-size: 7.5pt;
    font-family: \"tahoma\";
    color:#4E7A78;
    line-height:12px;
    letter-spacing:0pt;
    }

    .sub {color: #4E7A78; width: 100%; border-bottom: solid #4E7A78; border-bottom-width: 1; font-size: 8pt; text-transform: lowercase; font-weight:bold; text-align: right;}
    b{color: #EBF1F1; font-weight: bold;}

    .sub2 {color: #4E7A78; width: 100%; border-bottom: dotted #4E7A78; border-bottom-width: 1; font-size: 1pt; text-transform: lowercase; font-weight:bold; text-align: right;}

    p {font-family: tahoma; font-size: 7pt; font-color:#4E7A78;
    line-height: 150%;}

    a:link {color: #74A09F; font-weight: bold}
    a:visited {color: #74A09F; font-weight: bold}
    a:active {color: #74A09F; font-weight: bold}
    a:hover {color: #74A09F; font-weight: bold}

    table { font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.5pt; font-family: tahoma; line-height: 12pt; color: #4E7A78}

    input, textarea
    { background: transparant;
    font-family: tahoma;
    size: 1px;
    color: #4E7A78;
    border-style: dotted;
    border-color: #4E7A78;
    border-width: 1px }

    -->
    </STYLE>
    </head>
    <body>

    <div style=\"position:absolute; top: 0; left: 0;\">
    <img src=\"site/images/001.png\"><br>
    <img src=\"site/images/002.png\"><br>
    <img src=\"site/images/003.png\"><br>
    <img src=\"site/images/004.png\"><br>

    </div>

    <BODY bgcolor=\"#EBF1F1\" background=\"site/images/ecbg.png\">

    <div style=\"position:absolute; top: 526; left: 115; width: 148; \"><FONT
    face=tahoma color=#4E7A78 size=1><div class=\"sub\">STATS</div><div class=\"sub2\">STATS</div><b>Since:</b> 17 June 2005
    <br><b>Decks:</b> 113
    <br><b>Cards:</b> 2825
    <br><b>Members:</b> 101</center>

    <p><div class=\"sub\">ETHEREAL</div><div class=\"sub2\">ETHEREAL</div><img src=\"site/images/thingy.gif\"> <a href=\"about.php\">About</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"rules.php\">Rules</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"join.php\">Join</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"cards.php\">Cards</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"badges.php\">Badges</a>

    <br><img src=\"site/images/thingy.gif\"> <a href=\"masterbadges.php\">Master Badges</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"members.php\">Members</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"forms.php\">Forms</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"http://1ntoxication.net/boards\" target=\"new\">Forum</a>

    <p><img src=\"site/images/thingy.gif\"> <a href=\"credits.php\">Credits</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"layouts.php\">Layouts</a>

    <br><img src=\"site/images/thingy.gif\"> <a href=\"staff.php\">Staff</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"links.php\">Links</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"faq.php\">FAQ</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"wallofshame.php\">Wall of Shame</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"index.php\">Main</a>

    <p><img src=\"site/images/thingy.gif\"> <a href=\"http://winhill.org/ethereal/cutenews\">Staff Login</a>

    <p><div class=\"sub\">EARNINGS</div><div class=\"sub2\">ETHEREAL</div><img src=\"site/images/thingy.gif\"> <s>Donate</s>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"games.php\">Games</a>
    <br><img src=\"site/images/thingy.gif\"> + <a href=\"claimedcards.php\">Claimed Cards</a>
    <br><img src=\"site/images/thingy.gif\"> + <a href=\"membercards.php\">Member Cards</a>

    <br><img src=\"site/images/thingy.gif\"> + <a href=\"referralcards.php\">Referral Cards</a>
    <br><img src=\"site/images/thingy.gif\"> <a href=\"shop.php\">Pixel Shop</a>

    <p><div class=\"sub\">TAKE ONE</div><div class=\"sub2\">ETHEREAL</div><center><img src=\"cards/layoutcards/layout05.gif\"> <img src=\"cards/tsubasa17.gif\"><br><img src=\"cards/egypt14.gif\"> <img src=\"cards/azel05.gif\"></center>
    <br>Updated on 05-10-05

    <p><div class=\"sub\">HOST</div><div class=\"sub2\">ETHEREAL</div><a href=\"http://winhill.org\" target=\"new\"><img src=\"site/links/winhill.gif\" border=\"0\"></a>

    <p><div class=\"sub\">DISCLAIMER</div><div class=\"sub2\">ETHEREAL</div>Ethereal Cards is © 2005 by <a href=\"http://1ntoxication.net\" target=_blank>Blok</a>. All layouts, cards etc are made by the staff of this site. The original idea for a tcg is © <a href=\"http://www.scmania.net\" target=_blank>Calico</a>. All rights reserved. All Anime/manga/games and Characters used for the cards are © their rightful owners. Ethereal Cards does not claim any rights and is only using them for fan purposes.
    </div>

    <div style=\"position:absolute; top: 500; left: 270; width: 432; \"><FONT
    face=tahoma color=#4E7A78 size=1><p>
    <div class=\"sub\">join</div><div class=\"sub2\">WELCOME</div>Please read the rules before you join Ethereal Cards. If the form isn't working, you can send an e-mail with the same information as at the form to <b>[email protected]</b>
    <p><center>
    Sorry, there seems to be a problem, please try again!
    </center>
    //[ERROR PAGE - END]
    //Remember all ["] have to have
    //a [/] in front of them, so instead of ["] it should be [\"] The easiest way to do
    //this is to copy all of your html into notepad and use the "replace all" tool ^^
    ";

    ?>
    :/ Any ideas? It's saying my comment line has an error, which obviously is not possible :X
    --X'estrix
    [Darkness Always Brings Light...]
  • SlayerApocalypse666
    Banned
    • Aug 2006
    • 324

    #2
    Re: Stupid PHP ;-;

    U should try a lot of other website.
    Sry i didnt know it have a coding section i'm noob.
    Last edited by SlayerApocalypse666; 03-8-2007, 01:18 AM.

    Comment

    • Squeek
      let it snow~
      • Jan 2004
      • 14444

      #3
      Re: Stupid PHP ;-;

      Hmm, not quite.

      This section is designed to help people with coding issues. While the likelihood of someone being able to help is significantly smaller, it doesn't mean that the chance is zero.

      From me, the chance is zero. But I do know that several FFR regulars know PHP.

      Comment

      • AirForceBlue
        FFR Player
        • Mar 2007
        • 64

        #4
        Re: Stupid PHP ;-;

        Code:
        if($response[0]) echo "
        You see where that " is? The code is basically saying if the response variable array 0 is true, then echo/say ".

        You must end the line with a ; making it look like this:

        Code:
        if($response[0]) echo ";
        Try that.

        Comment

        • JsPapp26
          FFR Veteran
          • Oct 2004
          • 96

          #5
          Re: Stupid PHP ;-;

          Heh, I think I actually know this!

          You started your echo command with a ", so you can't have any other "s inside of there. It appears you have one here:

          Code:
          //Type all of the HTML for the "Thankyou" page here. Remember all ["] have to have
          It should work if you replace the "s within the echo command with 's, but I'm not positive.



          EDIT: Oh! I read the error message wrong. Try what AirForceBlue said, and if you still get the same message, you might need to put a ; at the end of every line.
          Last edited by JsPapp26; 03-10-2007, 06:08 AM.
          Originally posted by Synthlight
          We need to take a better photo and make a t-shirt out of that. That is awesome.

          Comment

          • g4z33b0
            Banned
            • Mar 2006
            • 2618

            #6
            Re: Stupid PHP ;-;

            When you are typing in if statements followed by html, don't format the html in php. just ?> HTML <? and you wont have to worry about stupid parse errors.

            airforceblue you are also a php scrub along with Xestrix. How is this statement:
            Code:
            if($response[0]) echo "
            any different than this statement:
            Code:
            if($response[0]) echo ";
            Your statement does absolutley nothing at all.

            Try this:
            Code:
            if($response[0]){
            ?>
            ALL OF YOUR HTML HERE
            <?php
            }
            THE REST OF YOUR PHP
            ?>
            Learn how to program.

            Comment

            • JasonKey
              FFR Underseer
              • Jul 2003
              • 2643

              #7
              Re: Stupid PHP ;-;

              I could take a look .. but I want to hear from you now .. make any progress?

              I would certainly hope seeing that this thread is pretty old

              Originally posted by Synthlight
              I will be fix this. No worries. It happened during a version upgrade.
              Cheers,
              Synthlight

              Comment

              • Summerschool
                ~
                • Feb 2012
                • 320

                #8
                Re: Stupid PHP ;-;

                Originally posted by g4z33b0
                When you are typing in if statements followed by html, don't format the html in php. just ?> HTML <? and you wont have to worry about stupid parse errors.

                airforceblue you are also a php scrub along with Xestrix. How is this statement:
                Code:
                if($response[0]) echo "
                any different than this statement:
                Code:
                if($response[0]) echo ";
                Your statement does absolutley nothing at all.

                Try this:
                Code:
                if($response[0]){
                ?>
                ALL OF YOUR HTML HERE
                <?php
                }
                THE REST OF YOUR PHP
                ?>
                Learn how to program.
                Umm, while your way works, you don't exactly have everything right either.

                Code:
                if($response[0]) echo "
                this isn't a complete statement. However if you add line 37-160 it becomes a complete statement. Changing the code to:
                Code:
                if($response[0]) echo ";
                would add a ; to the output string, but do nothing to the code.

                The only real problem is quotes were included in the echo string without being escaped.

                The reason that happened is because he was trying to put comments in the string, but php just looks at it as string and not php code. If you noticed the rest of the html was escaped, so his intent was probably to output all the html using echo.

                While I'm sure you know this you didn't really explain it.

                Comment

                • phe0nixblade
                  Praise the sun mofo
                  • Sep 2005
                  • 4281

                  #9
                  Re: Stupid PHP ;-;

                  Wait, I saw this on the front page. How's the last bump april 25th. :/

                  Comment

                  Working...