Announcement

Collapse
No announcement yet.

PHP Eval for contact Form submit error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [CMS] PHP Eval for contact Form submit error

    I'm trying to create a page with the CMS software using PHP Direct Eval option. The code I'm using is here:

    PHP Code:
    if (!isset($_POST['contact_form_submit']) && empty($_POST['contact_form_submit'])){
        
    $output = <<<HERE
            <form action='' method='post' id='contact_form'>
                <table>
                    <tr>
                        <td>Message Topic:</td>
                        <td><select name='topic'>
                            <option value=''>Pick a Topic</option>
                            <option value='general'>General Question</option>
                            <option value='membership'>Membership Question</option>
                            <option value='website'>Website Issue</option>
                            <option value='other'>Other</option>
                        </select</td>
                    </tr>
                    <tr>
                        <td>Email Address:</td>
                        <td><input type='text' name='email' /></td>
                    </tr>
                    <tr>
                        <td>Comments/Questions:</td>
                        <td><textarea name='message' cols='40' rows='10'></textarea></td>
                    </tr>
                </table>
                <input type='hidden' name='securitytoken' value='
    {$vbulletin->userinfo['securitytoken']}' />
                <center><input type='submit' name='contact_form_submit' value='Send Question' /></center>
    HERE;

    When I submit this code, I get the following error:
    Your submission could not be processed because a security token was missing.

    If this occurred unexpectedly, please inform the administrator and describe the action you performed before you received this error
    What am I missing?

    ALSO, there is a bug in the edit form within the CMS when editing PHP. The above code is rendered as shown in the attached image.

    Click image for larger version

Name:	Screen shot 2011-04-15 at 07.52.58.png
Views:	1
Size:	59.2 KB
ID:	3720359

  • #2
    If you look at the contactus template, you'll see an example of what you'll need:

    <input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />

    Re the Bug, what browser are you using as I don't get that in 4.1.3 using Firefox...
    Vote for:

    - *Admin Settable Paid Subscription Reminder Timeframe*
    -
    *PM - Add ability to reply to originator only*
    - Add Admin ability to auto-subscribe users to specific channel(s)
    - "Quick Route" Interface...

    Comment


    • #3
      What is this stuff doing in there - "<<<HERE" and "HERE;" ? Those are going to cause problems because your html (in the php) is invalid.

      Please don't PM or VM me for support - I only help out in the threads.
      vBulletin Manual & vBulletin 4.0 Code Documentation (API)
      Want help modifying your vbulletin forum? Head on over to vbulletin.org
      If I post CSS and you don't know where it goes, throw it into the additional.css template.

      W3Schools &lt;- awesome site for html/css help

      Comment


      • #4
        @LYNNE

        Please do some research on 'heredoc' in the PHP manual. It's actually not even unique to PHP, but is found in Perl, C, C++, Java, and many other languages. I see there are a few errors in my HTML above, namely the missing '>' for the select, and some closing tags near the bottom. I appreciate your attempt to help, but you've failed to give me any criticism that's actually constructive and helps me solve my problem.

        @Trevor

        What you have there is exactly what I needed, I just didn't know where to look. Thanks for the info! I'm using Safari on the Mac where I see that bug. I'll check out a couple other browsers (Mac, Windows, *nix) and get back to you on my bug. I will make sure to try my faulty HTML above, as it's possible the vB code is properly escaping my code to render the page, errors and all.

        Comment


        • #5
          The code required is a little different than what Trevor showed, as I just ran into this error today when helping someone else out. Here is a link to the proper code:

          http://www.vbulletin.com/forum/showt...=1#post2147157

          Comment


          • #6
            What I see there is what I already have. The syntax in the link is wrong.

            Comment


            • #7
              Well, it worked for me.

              Comment


              • #8
                I had the same? problem, cused by Keepalive being disabled in Apache. Enabling KeepAlive solved my problems. Apache KeepAlive is normally enabled by default.

                Comment

                widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                Working...
                X