WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
Undefined index: HTTP_X_REQUESTED_WITH in contact-form-7\includes\controller.php (3 posts)

  1. amereservant
    Member
    Posted 2 years ago #

    On line 86 of controller.php, you have if ( $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ) which triggers a NOTICE level error because it isn't set even though it is making an AJAX request.
    A simple fix would be simply to test if( isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ), but that just does away with the NOTICE error message and doesn't fix the problem.

    I am curious why you aren't submitting the form to wp-admin/admin-ajax.php as described in http://www.garyc40.com/2010/03/5-tips-for-using-ajax-in-wordpress/#js-global and then adding the appropriate ajax functions to catch the request. When done correctly, it adds additional security measures.

    Since I have benefited from the use of CF7, I would gladly contribute and help implement this if you're interested and if there's not a particular reason you avoided this route.

    Thanks again for your hard work!

    http://wordpress.org/extend/plugins/contact-form-7/

  2. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks for reporting this. I have tried admin-ajax.php before, but I realized that file uploading part is difficult to be implemented on that. If you have good idea, please let me know.

  3. amereservant
    Member
    Posted 2 years ago #

    Thanks for the quick response! I haven't tried file submissions with forms in this way, but I'll definitely spend a little time testing to see if I can figure something out. It seems like it should be possible though...

    I'm working on a much lighter DB plugin for CF7 than the one currently available because CF7 is the best form plugin available, just lacking the database part, therefore if I can contribute anything to making it better, I'd be glad to do so.
    I'll keep you updated on what I discover....

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic