Jump to content

iwato

Members
  • Content Count

    1,496
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by iwato

  1. Hi Dsonesuk! Happy New Year! I purposefully wrote the paths as .../ in order to hide my file structure to the general public. I wish it were that easy. Roddy
  2. BACKGROUND: I have an AJAX request that cannot find the PHP processing file for which it is looking. It is returning a 500 error in my web console. I have checked the PHP error log for that file and can find no error. I have also checked the error logs for the PHP files related to the requested PHP file, as well as the error log of the requesting page. Nothing. Nothing. Nothing. And, Nothing. I have even asked the help of my server provider. Nothing. Needless to say, I am at a loss. The functionality related to this AJAX call was created many months ago, and was working fine at the time of creation. In fact, the same functionality used to work at three different locations. I discovered the failure while performing a somewhat casual check in search for damage from suspected hackers. Once hacked, you do not easily forget it. it is kind of like being raped. QUESTION: What would be a proper strategy for troubleshooting this failure? AJAX CALL: $.ajax({ type: "POST", url: '.../captcha_reset.php', data: {dataRequest: 'requestInstance'}, statusCode: { 404: function() { alert( "Page not found" ); }}, success: function(jsonData) { jsonObj = JSON.parse(jsonData); captcha_sa = jsonObj.captcha_ra; $('.CaptchaLabel').css('background-color', jsonObj.captcha_rc); $('.CaptchaAnswer').val(''); $('.CaptchaLabel').html(jsonObj.captcha_rq); $('.CaptchaError').css('display', 'none'); } }); CODE from REQUESTED PHP FILE: if ($_SERVER['REQUEST_METHOD'] == 'POST') { $captcha_reset = array(); if ($_POST['dataRequest']) { $dataRequest = filter_var($_POST['dataRequest'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH); if ($dataRequest == 'requestInstance') { require_once '.../vendor/autoload.php'; require_once '.../select_color_pair.incl.php'; $color_pair = select_color_pair(true); $ictext_color = $color_pair['text_color']; // $icbackground_color = $color_pair['bg_color']; require_once('.../class.imageless_captcha.php'); $captcha_r = new ImagelessCaptcha(3, false, false, $ictext_color); $captcha_reset['captcha_rq'] = $captcha_r->formPhrase(); $captcha_reset['captcha_ra'] = $captcha_r->getInt(); $captcha_reset['captcha_rc'] = $color_pair['bg_color']; } } echo json_encode($captcha_reset); } Please advise. Roddy
  3. iwato

    Undefined Variable

    GREETING: Happy New Year, W3Schools! I am looking forward to another year of online progress. Hopefully many of the problems that I have been experiencing for the last year and a half will disappear with the addition of a brand new iMac that can handle the latest PHP and MySql software. This said, I remain the advanced novice that I am and very much hope that you will continue to stand by my side. BACKGROUND: Please find below a set of code that permits one new set of functionality, but destroys another. The related error messages are provided beneath the code. if (isset($_GET['refer_type']) && filter_var($_GET['refer_type'], FILTER_VALIDATE_INT)) { $refer_type = $_GET['refer_type']; } else { $refer_type = 0; } if (isset($_GET['panel_type']) && filter_var($_GET['panel_type'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH)) { $panel_type = $_GET['panel_type']; if (isset($_GET['lang_type']) && filter_var($_GET['lang_type'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH)) { $lang_type = $_GET['lang_type']; } } else { $panel_type = 0; } ERROR MESSAGES: [05-Jan-2020 04:10:40 UTC] PHP Notice: Undefined variable: lang_type in /home/thege0/public_html/grammarcaptive.com/devcptv18rs/overview.html on line 99 QUESTION: Can you see anything in the code line if (isset($_GET['lang_type']) && filter_var($_GET['lang_type'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH)) { $lang_type = $_GET['lang_type']; } or elsewhere that could be triggering the error. The code line just given is new and is clearly the initial, but maybe not the final source of the problem. By the way, when the code was first introduced, it did not appear to create a problem. Only several days later did the problem appear. Roddy
  4. Please ignore the above request. I have resolved the problem. There was an incompatibility between what was being sent and what was supposed to be received. Thank goodness for prepared statements. They make everything so easier once you understand how to interpre the hieroglyphs of error encoding. Roddy
  5. BACKGROUND: This is follow-up to my newly created webpage at ali.publiustwo.com. For a long time I was able to successfully transmit and store the data of the first of two forms. Unable to understand why the data of the second form was not appearing in my data base I discovered that two of the variables were missing in the PHP processing file. After these were added, the transmission failed completely. The following error message was discovered Connection close Content-Typetext/html; charset=UTF-8 Date Tue,10 Dec 2019 18:58:01 GMT ServerApache Transfer-Encoding chunked Accept */* Accept-Encoding gzip, deflate, br Accept-Language en-US,en;q=0.5 Connection keep-alive Content-Length 2085 Content-Type multipart/form-data; boundary=---------------------------18838717971881884458692932590 Host ali.publiustwo.com Referer https://ali.publiustwo.com/ User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:48.0) Gecko/20100101 Firefox/48.0 X-Requested-With XMLHttpRequest ADDENDUM: The HTTP Request is reporting the following: HTTP/1.1 500 Internal Server Error 318ms] REQUEST: Could you explain what might be going and propose a solution. Roddy
  6. 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
  7. All of my input form controls have names, and there are four fieldsets in the topic_info form element. Only the name-value pairs of the last fieldset appear. There are six altogether. title1, topic1, title2, topic2, title3, and topic3. Roddy
  8. I don't get it either, but you are absolutely correct. Adding the two additional parameters to the $.ajax() function allowed the data to be transmitted. Still, however, only the last fieldset of the #topic_info form element was processed. You may see what is occurring your self. Do you have any idea why. Roddy
  9. Are you suggesting that the $.ajax() function should be included in the for-statement? Roddy
  10. There is another problem as well. The poData array only captures the name-value pairs in the last fieldset of the #topic_info form. While you are thinking, I will experiment with what dsonesuk has proposed. Roddy
  11. for (var i = 0; i < poData.length; i++) { formData.append(poData[i].name, poData[i].value); } No, I fixed this problem as above. Roddy
  12. Yes, Funce. The formData variable captures the first instance of the jQuery object used to create the object. I did not drop the [0] expression at the end of the object. I will wait until I can form a proper data object before implementing the additionally suggested $.ajax() parameters. Roddy
  13. Hi, Funce. I have decided to experiment with your suggestion first as it is closer to language that I can easily understand. This said, the FormData object is new to me and I do not know how to readily correct the error associated with the following code block: for (var i = 0; i < poData.length; i++) { formData.append(poData[i].name, poData[i].value); } The associated error is the following; Please advise further.. Roddy
  14. Wow! Thank you to you both. I might get this accomplished after all. Give me some time to see what works! Roddy
  15. Should I assume that the absence of a response is due to an absence of advice? Does everything really appear OK? You view the webpage here. Please respond. Roddy
  16. BACKGROUND: On one webpage I have two forms and one button for both forms. Each form has its own action pointing to a different PHP processing file. I can get each form to work properly by itself, but I cannot seem to get the perform together. $('.SignUpButton').on('click', function() { $('#student_info').submit(); $('#topic_info').submit(); }); <form id='student_info' method='post' enctype='application/x-www-form-urlencoded' action='./_utilities/php/student_info.php'> ... </form> <form id='topic_info' method='post' enctype='application/x-www-form-urlencoded' action='./_utilities/php/topic_info.php'> ... </form> <input id='passcode_entry' form='student_info' type='text' name='passcode' placeholder='4-Digit Code' /> <button class='SignUpButton'>Sign Up!</button> QUESTION: If you could help me to get the above code to work properly, I would be very grateful. Ideally, I would like to get both forms pointing to the same PHP processing file, but do not know how to combine the data, and I have not a lot of time for a major renovation of my code, as I would very much like to have this up and running by tomorrow morning. By the way, I tried using the form attribute with the <fieldset> element, but for some reason it failed to work properly. Please advise. Roddy
  17. Hi! Thank you for your quick response. As it is my goal to have this page ready and working by Monday, I have selected Ingolme's response as the easiest to implement fix. input, textarea, select { font-size: 16px; } In the end, I have not yet grown accustomed to the use of the vw unit, and still have to build a data base and create the PHP to handle the task of data transport and storage before my self-imposed deadline. Many thanks to both Ingolme and dsonesuk. I am happey to see that you are both still around at W3Schools. Roddy
  18. MOTIVATION: It is sometimes said that time heals all. With this in mind I am hoping that the W3Schools community has advanced since the last time that I communicated and has found a solution to the following problem. BACKGROUND: Recently I created a new webpage that can be found at www.publiustwo.com/ali. If you open this page in an iPhone with a vary narrow viewport such as my own, you will observe that filling in any of the form items that require text input, and in several cases even those that do not, causes the width of the document to increase beyond the size of the available viewport and does not return it to its former size after the input has been completed. QUESTION: It would appear that there are two solutions to this problem: one, prevent the size of the page from expanding in the first place; two, cause the size of the page to retract after the entry has been completed. Has anyone found a solution to this problem" Roddy
  19. Have you tried inserting the following var_dump($query); after the expression $query = $select ->fetch(); to see, if anything is contained therein? Roddy
  20. BACKGROUND: I have an HTML document whose <html> element is tagged with an event icon (EV) when viewed in Firefox's Inspector panel. The <html> has no properties of its own. When one clicks on the event tag one can read the following: The above code appears to refer to a Matomo script placed inside the documents <html> tag at the bottom of the page. The phrase itself is followed by two buttons called Bubbling and Dom2. When one clicks on either a drop-down panel appears with the following code function af() { var al; m = true; aa("unload"); if (r) { do { al = new Date() } while (al.getTimeAlias() < r) } } QUESTION: Can you explain this phenomenon? What is going on? Roddy
  21. Yes, I see. A visitor may wish to view the page in a language different from that of his own browser. Is this what you mean? Roddy
  22. Got it! Thanks. But, you did not answer my first question in the last entry. Is the result not the same? Roddy
  23. OK. But, would you not agree that both longhand interpretations produce the same result? Also, how did you get to $str_browser_language = ''; and $str_browser_language = $str_browser_language; Roddy
  24. CHALLENGE (WELL, KIND OF): Please find below two sets of code. The first is a short-hand snippet of code fits that within a larger block of code. The second is my own long-hand interpretation of what it means. SHORT-HAND: $str_browser_language = !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? strtok(strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE']), ',') : ''; $str_browser_language = !empty($_GET['language']) ? $_GET['language'] : $str_browser_language; LONG-HAND: if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $str_browser_language = strtok(strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE']), ','); } else { if (!empty($_GET['language'])) { $str_browser_language = $_GET['language']; } else { $str_browser_language = ''; } } QUESTION: Is my interpretation correct? If not, please explain, in what manner I have erred. Roddy
×
×
  • Create New...