Error in jQuery.ajax while submitting a form: Internal Server Error – UserPro

So I am using the plugin UserPro to make a register form. I have made a register field where users can choose their role. I did that the following way:

enter image description here

In my register setttings (the settings for the registration form) in UserPro I have the following:

enter image description here

As you can see, my standard roles for logging in are Dj and Radiostation. Yet for some reason I get the error: Error in jQuery.ajax while submitting a form: Internal Server Error when I try to register one of the two.

The problem does get solved when I make a default role for registering, but that will not work. Since the users will then only register as one role.

My question: How can I solve the Internal Server Error when I try to register one of the two. when registering?

What must be included in a good report writeup when submitting it to whoever (eg. paper skeleton)? [closed]

For some reasons this question is not about vulnerability reporting as many question I read, but rather about the writeup of a good, professional paper that states all details about hole.

I can think of some:

  • PoC
  • Date of writing
  • What else?

Thanks in advance.

400 Bad request while submitting form using AJAX

I am poor in AJAX and trying to submit the form and insert the record to the custom table since a couple of days but not getting it to work.

I am getting 400 Bad request error on console. Please have a look at the code.

In fact, I have tried multiple ways to submit data but none of them works.

HTML

<form class="addtocartform" id="gsAddToCart" method="POST">     <label class="gs-label" for="options">Options</label>     <select class="gs-select-box" id="product_option" name="product_option">         <option value="0">Somnath</option>         <option value="1">Dwarka</option>         <option value="2">Rameshwaram</option>     </select>     <label class="gs-label" for="qty">Qty.</label>     <input class="gs-number" id="qty" min="1" name="qty" step="1" type="number" value="1">          <button class="gs-button order-button add-to-cart-button">             <i class="fa fa-cart-plus"></i>             <span class="gs-button-label">Add to Cart</span>         </button>          <input id="product" name="product" type="hidden" value="160"/>         <input id="group_id" name="group_id" type="hidden" value="194"/>     </input> </form> 

WordPress Hooks – Enqueue scripts

function gs_enqueue_ajax_scripts() {      wp_register_script('gs-ajax', GROUP_SHOP_ROOT . 'public/js/add-to-cart-ajax.js', ['jquery'], 1.0, TRUE);     wp_localize_script('gs-ajax', 'ajax_vars', [         'ajax_url' => admin_url('admin-ajax.php'),         'nonce'    => wp_create_nonce('gs_nonce'),     ]);     wp_enqueue_script('gs-ajax');  }  add_action('wp_enqueue_scripts', 'gs_enqueue_ajax_scripts'); 

WordPress Hooks – Process and Insert Data

function gs_add_to_cart_ajax() {      check_ajax_referer('gs_nonce', $  _POST[ 'nonce' ], FALSE);      // validating stuffs ..      $  cart = new Group_Shop_Cart();     $  cart->add_to_cart($  _POST[ 'group_id' ], $  _POST[ 'product' ], $  _POST[ 'qty' ], $  _POST[ 'product_option' ]);      wp_die(); }  add_action('wp_ajax_gs_add_to_cart_ajax', 'gs_add_to_cart_ajax'); add_action('wp_ajax_nopriv_gs_add_to_cart_ajax', 'gs_add_to_cart_ajax'); 

Javascript

(function ($  ) {      $  (document).on("click", ".add-to-cart-button", function () {          let data = JSON.stringify({             action: 'gs_add_to_cart_ajax',             group_id: $  ('#group_id').val(),             product: $  ('#product').val(),             qty: $  ('#qty').val(),             product_option: $  ('#product_option').val(),         });          $  ('form.addtocartform').on('submit', function (e) {             e.preventDefault();              $  .ajax({                  method: 'POST',                 dataType: 'json',                 nonce: ajax_vars.nonce,                 url: ajax_vars.ajax_url,                 data: data,                 success: function (response) {                     alert("Success");                 }              });         });      });  })(jQuery); 

I have no idea what is wrong in this code that not submitting.

Modified Code

$  .ajax({      method: 'POST',     dataType: 'json',     nonce: ajax_vars.nonce,     url: ajax_vars.ajax_url,     data: {         action: 'gs_add_to_cart_ajax',         group_id: $  ('#group_id').val(),         product: $  ('#product').val(),         qty: $  ('#qty').val(),         product_option: $  ('#product_option').val(),     },     success: function (response) {         alert("Success");     }  });  

Conversion comparison between users who navigate from autocomplete vs. submitting from the search form

Recently I came across the way Instagram does their search. Basically they give you results in the autocomplete but disable the ability to actually submit the form and be navigated to your traditional search results page. I found this interesting for the fact with millions of possible users or posts, they are confident the user will find what they’re looking for in no more than a dozen results. Is there any evidence that supports that whether users choose more from autocomplete over navigating to a results page?

Approaches to prevent submitting a modern create/edit forms if a status = close while a date field is missing

I am working on a sharepoint online custom list, and the list contain these 2 main fields:-

  1. Status. drop-down with options; new,open,closed
  2. Publish Date.

now i want to prevent users from creating/editing an item and change its “Status” to “Closed” unless they specify a value for the “Publish Date”.

now i want to use the modern experience, as if in classic mode i can simply add a script editor web part and do the validation using javascript. but what are the options i have to do this validation in modern experience ? and can i benefit from list or field validation to do such a validation (as list/field validation will work on modern UI)..

Magento 2.3 : Error while submitting the contact form

When I try to submit the default contact us form, this is the error that I get.

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 39 in /home/hudsonpa/public_html/xxxxx/vendor/pelago/emogrifier/Classes/Emogrifier.php on line 1507

Anybody knows what this is?

This is the form

<form class="form contact"                   action="<?= $  block->escapeUrl($  block->getFormAction()) ?>"                   id="contact-form"                   method="post" 

On inspecting the final html, it points to

<form class="form contact" action="https://domain.com/xxxx/index.php/contact/index/post/" id="contact-form" method="post" style="float:unset; width:unset;" data-hasrequired="* Required Fields" novalidate="novalidate"> 

— edit — added screenshot enter image description here

— edit 2 —

Also found the Emogrifier.php line 1507 has this

        $  roughXpath = preg_replace(array_keys($  this->xPathRules), $  this->xPathRules, $  trimmedLowercaseSelector); 

and the $ xPathRules array looks like this

private $  xPathRules = [         // attribute presence         '/^\[(\w+|\w+\=[\'"]?\w+[\'"]?)\]/' => '*[@\1]',         // type and attribute exact value         '/(\w)\[(\w+)\=[\'"]?([\w\s]+)[\'"]?\]/' => '\1[@\2="\3"]',         // type and attribute value with ~ (one word within a whitespace-separated list of words)         '/([\w\*]+)\[(\w+)[\s]*\~\=[\s]*[\'"]?([\w-_\/]+)[\'"]?\]/'         => '\1[contains(concat(" ", @\2, " "), concat(" ", "\3", " "))]',         // type and attribute value with | (either exact value match or prefix followed by a hyphen)         '/([\w\*]+)\[(\w+)[\s]*\|\=[\s]*[\'"]?([\w-_\s\/]+)[\'"]?\]/'         => '\1[@\2="\3" or starts-with(@\2, concat("\3", "-"))]',         // type and attribute value with ^ (prefix match)         '/([\w\*]+)\[(\w+)[\s]*\^\=[\s]*[\'"]?([\w-_\/]+)[\'"]?\]/' => '\1[starts-with(@\2, "\3")]',         // type and attribute value with * (substring match)         '/([\w\*]+)\[(\w+)[\s]*\*\=[\s]*[\'"]?([\w-_\s\/:;]+)[\'"]?\]/' => '\1[contains(@\2, "\3")]',         // adjacent sibling         '/\s+\+\s+/' => '/following-sibling::*[1]/self::',         // child         '/\s*>\s*/' => '/',         // descendant         '/\s+(?=.*[^\]]{1}$  )/' => '//',         // type and :first-child         '/([^\/]+):first-child/i' => '*[1]/self::\1',         // type and :last-child         '/([^\/]+):last-child/i' => '*[last()]/self::\1',          // The following matcher will break things if it is placed before the adjacent matcher.         // So one of the matchers matches either too much or not enough.         // type and attribute value with $   (suffix match)         '/([\w\*]+)\[(\w+)[\s]*\$  \=[\s]*[\'"]?([\w-_\s\/]+)[\'"]?\]/'         => '\1[substring(@\2, string-length(@\2) - string-length("\3") + 1) = "\3"]',     ]; 

When i individually take the patterns and compile them, there seems to be a problem in the third pattern (and a few others) at this spot

[\w-_\/]+ 

If I change it to

[\w\-_\/]+ 

Then the pattern compiles.

Is this a good move?

“Page not found” or “Forbidden” when submitting form Is it a problem with Apache?

I have some reseller hosting and I am running Drupal 7 sites on several different accounts there.

I recently noticed a problem when updating one of them. It happens when I am editing content or changing admin settings.

  • I go to an admin page – e.g. my.site/admin/people/permissions.
  • I make a change and hit “Save”.
  • The page submits and reloads. The address bar still says my.site/admin/people/permissions, but the page content is:

    Page not found
    The requested page “/admin/people/permissions” could not be found.

I tried changing .htaccess files, disabling modules, etc, but nothing worked. In the end I did the following:

  • Created a new hosting account on my reseller hosting
  • Installed a fresh copy of drupal-7.58
  • Created a new database

When I repeated the actions above, I got the same results, except this time the error message was the following.

Forbidden
You don’t have permission to access /drupal-7.58/admin/people/permissions on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

I then checked another account on the same reseller hosting. It’s running Drupal 7.54 and showing Page not found.

I didn’t have the problem a few weeks ago, so I am wondering if my hosting company has changed something in Apache which is causing this problem (really clutching at straws here).

I am using:

  • Apache 2.2.32
  • PHP 5.6.30
  • MySQL 10.0.34-MariaDB

Can anyone help?