Jump to content

Funce

Moderator
  • Posts

    602
  • Joined

  • Last visited

  • Days Won

    19

Posts posted by Funce

  1. You need to make sure you're using an absolute path when referring to the target directory. PHP has no concept of relative paths Nevermind this part

    You can generally access the web root by using

    <?php
    $_SERVER['DOCUMENT_ROOT']

    Alternatively, you can use 

    <?php
    __DIR__

    This will create an absolute path of the current directory of the running file. So this one may more easily fit into your current code.

    Give it a try.

  2. 15 minutes ago, iwato said:

    Before I try that I would like to bring your attention to a very important point:  your prior instruction was quite good.  It alerted me to the fact that I had failed to remove a var_dump of what was being received by the reset_captcha.php file. Your not gonna like what follows though.  The reset_captcha.php file is once again reporting a 500 error.  I am absolutely amazed, but somehow feel that we are coming closer.  Please do not leave.

    Roddy

     

    I can stick around for a while Roddy. Just grabbed lunch(Oh New Zealand time) so I'm quite clear for the next few hours.

    • Thanks 1
  3. Regardless of what PHP does, all the JavaScript receives is a string(in this case) so processing still happens. But...

    I just had a thought. the jQuery ajax success method takes an "intelligent guess" on what data is being received and parses accordingly. (I just looked it up because I wasn't sure)

    It could be that you're attempting to JSON.parse a JSON object....

    Try taking it out and seeing what happens.

    Or you can console.log it and see if its an object or a string to be parsed.

     

  4. Because you're parsing the JSON data from the server,  if JSON.parse is failing it means that the PHP file may be incorrectly outputting the JSON.

    This may come about as a PHP error(ending execution before output) or maybe its just malformed.

    Check your Network tab of your webconsole, and see if you can find the call to the Captcha file. You'll be able to see what the server responded with.

  5. I was referring to specifically these three lines. If the page errors with just these lines (and your error logging) then the error resides inside these pages.

    <?php
    require_once '.../vendor/autoload.php';
    require_once '.../select_color_pair.incl.php';
    require_once('.../class.imageless_captcha.php');

     

  6. So I tried a couple of requests to the page mentioned and you've definitely isolated the problem code here. (Only a POST request with that payload errors)

    I'd want to check if that logging system is working first.

    Try introducing a syntax error and see if that comes up in the logs.

    If it does, good! We know that works. We may be looking at something that is suppressing third-party code errors. (Maybe the '@' operator)

    If it does not, you'll need to check your logging settings, make sure they're going to the correct location on your webhost.

  7. I get zero delay with what you've provided (when I've corrected the errors)

    Is this test data somewhat accurate?

    <!DOCTYPE html>
    <html>
    
    <body>
      <form name="DateSetting" action="" method="post" onsubmit="return formcheck(DateSetting)">
        YY
        <input style="text-align:center;width:30" name="yy" id="yy" required maxlength="2" />
        &#160;MM
        <input style="text-align:center;width:30" name="mm" id="mm" required maxlength="2" />
        &#160;DD
        <input style="text-align:center;width:30" name="dd" id="dd" required maxlength="2" />
        <button type="submit" name="sub" id="sub">Submit</button>
      </form>
    </body>
    <script>
      function formcheck(myform) {
        with (myform)
        if (yy.value.length != 2) {
          alert("Year must be 2 digits.");
          yy.select();
          return false;
        }
        if (mm.value.length != 2) {
          alert("Month must be 2 digits.");
          mm.select();
          return false;
        }
        if (dd.value.length != 2) {
          alert("Day must be 2 digits.");
          dd.select();
          return false;
        }
        if (dd.value < "01" || dd.value > "31") {
          alert("Invalid Day.");
          dd.select();
          return false;
        }
        if (mm.value < "01" || mm.value > "12") {
          alert("Invalid Month.");
          mm.select();
          return false;
        }
        if (yy.value < "01" || yy.value > "99") {
          alert("Invalid Year.");
          yy.select();
          return false;
        }
        if (
          ((mm.value == "04" ||
            mm.value == "06" ||
            mm.value == "09" ||
            mm.value == "11") &&
            dd.value > "30") ||
          (mm.value == "02" && dd.value > "29")
        ) {
          alert("Invalid Day for Month or visa versa.");
          dd.select();
          return false;
        }
        alert("Finished");
        sub.focus;
        return true;
      }
    </script>
    
    </html>

     

  8. This would really depend on if you want your site up and going as fast as possible, or you're wanting to experiment with something new. 

    I recently joined on to a dev team that served their whole website with static files, it was a nightmare to maintain, so it's good you can see that hurdle.

    If you've got a good grasp on HTML, CSS and JS you may want to get the jump on a server-side language. PHP may be a good pick for at making your website a little more easy to maintain.

    I can imagine that the header and footer of your website is the same in each page? You'll be able to use the include command to bring it into your page at will. When you update the "header.php" file, it'll update in all the pages that link to it. That's the first thing I did, and its made updating the site a real breeze. 
    If you feel up to it, you may also try using a framework like Laravel, or Symfony. However, they're more complex and not covered on the w3schools PHP module.

  9. I concur with dsonesuk, it's probably some form of caching issue. Make sure you hard-refresh (CTRL + F5 on Windows) each time you update your CSS.

    However, your first picture perfectly (I think) matches your given CSS file. (Below)

    p.five {
      max-width: 80%;
      height: 80px;
      margin-top: 30px;
      margin-left: auto;
      margin-right: auto;
      margin-bottom: 0px;
      border-style: solid;
      border-width: 2px;
      border-color: blue;
      text-align: center;
      background-color: Lavender;
    }

    And other than what dsonesuk has pointed out about the use of tags, there really isn't anything too outlandish going on.

  10. You should be able to open your developer tools on your browser to find out what and where styles are being applied.

    In most browsers you can Right Click > Inspect Element or some other permutation of that to see it.

     

    Otherwise, you may have more luck pasting the PHP here in a code block for us to look at.

    XcQfW3F.png

  11. Just now, iwato said:

    Never mind.  I have resolved the problem.

    Input form controls of the checkbox type are very unusual creatures. I have learned during the last couple of days.  In any case, the checkbox fields do appear when they are checked.  You have made me one very happy trooper.

    Roddy

    Yes indeed, checkboxes only send data when checked. Glad I could help.

×
×
  • Create New...