0

So i was building a very simple login script in PHP. My form.php file contains HTML as well as PHP script. It has a "password" input field. Upon submitting it does a post-action to itself(form.php). In the very top of the file I have used the following code. If password is correct, the script uses javascript to forward the user to another page. If the password is incorrect the user sees the form.php again.

Unfortunately, now and then (10% of the times that users view form.php), users get an error message that the website has reached the memory limit (which is clearly not the case). I also double checked this with my hosting-provider.

In my logs it says it has something to do with memory, see message at the bottom. My provider says it has something to do with my PHP. What do you guys think?

thx, Joost

<!-- 
  form.php: single possibility sign in
-->
<?php
  if(isset($_POST['password']))
  {
    $password = $_POST['password'];
    if ($password == "thisismypassword")
    {
      echo "<script>alert(\"Password correct.\"); window.location.href=\"004_nextpage/index.html\";</script>";
    }
    else
    {
      echo "<script>alert(\"Wrong password. Try again!\");</script>";
    }
    
  }
?>

[Tue Oct 05 08:35:49.349308 2021] [lsapi:error] [pid 3623342:tid 140618344843008] [client xxx.xxx.xxx.xxx:53384] [host www.example.com] Connect to backend failed with CONNECTION_RESET on sending request(GET /form.php HTTP/2.0); uri(/form.php): ReceiveAckHdr: backend reset connection: errno 104 (possibly memlimit for LVE ID 2171 too small), check http://docs.cloudlinux.com/mod_lsapi_troubleshooting.html, referer: https://www.example.com/mypage/index.html

  • Please include the entire flow. We need to see you establish the connection, then we need to see the form and the AJAX code that posts the request with password etc. Also try to do some debugging to see if you have established a proper connection try to do a `ping` for instance. https://www.php.net/manual/en/mysqli.ping.php . If you are using PDO, maybe this could be of help in order to check for established connection: https://stackoverflow.com/questions/23244462/how-do-i-ping-the-mysql-db-and-reconnect-using-pdo . – Martin Oct 05 '21 at 17:43

0 Answers0