Jump to content

iwato

Members
  • Posts

    1,506
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by iwato

  1. Please ignore this question. The problem has been resolved. Roddy
  2. I have just received a copy of the stock php.ini file that Lunarpages (my web host server) is using. Hopefully, it will lend a clue into what is going on and how to adjust for it. Roddy
  3. iwato

    Php.ini file?

    You may or may not have access to it depending on the nature of your account. I suggest that you contact your host. If you do not have access to the file, there is a good chance that you can change the setting of interest dynamically. Further, if it is a setting that you wish to use repeatedly, then you should follow Dsonesuk's suggestion below. Another way to discover the location of the file and thus avoid having to contact your host is to run the phpinfo( ) function on your host server. This will tell you everything that you can know about the PHP processor running on your host's server. Roddy p.s. If you find my answer helpful, then hover over the heart, find the trophy, and click. Thanks after the fact, is better than than thanks before it.
  4. Dsonesuk: What version of PHP are you using? INGOLME: Please find attached your requested information for the HTTPRequest error code 500 Roddy firefox_network_results.tiff
  5. DILEMMA: My goal is to style the body of a newsletter template. Although I am able to get the formatting into the database and -table, I am unable to retrieve it for insertion in the newsletter's template. Please find below an example of the way in which the value string of only one of the several SQL INSERT statements is created. The string that results is later combined with a name string and other elements of a valid INSERT statement. EXAMPLE OF THE WAY THE INSERTED VALUE IS FORMATTED include_once('../_utilities/php/classes/class.lunarpages.php'); $lunarpages = new Lunarpages(); $mysqli_obj = $lunarpages->get_mysqli_obj(); var_dump($mysqli_obj); $sql_letter_val = "('"; $substr_start = 0; $substr_length = 8; foreach ($newsvar_names as $name => $value) { if (substr($name, $substr_start, $substr_length) == '$letter_') { $sql_letter_val .= $mysqli_obj->real_escape_string($value) . "', '"; } } WHAT APPEARS IN THE DATA TABLE AFTER INSERTION <h1>ようこそ!</h1> <p>「<span style='font-family:Bradley Hand, cursive;font-size:1.8em;'>Seven Gates</span>」と言うのは文法キャプチッブのオンラインニューズレターです。</p> <p>このニューズレターの初版は文法キャプチッブの紹介としてニューズレターの構成及び文法キャプチッブの本質をユーザー達にその母語で説明しています。第二版のニューズレター以降のニューズレターは英語で書いてあるものです。もしニューズレターの初版を英語でも読んだ方が好いとすれば、ウェブ型の変形が<a href='https://www.grammarcaptive.com/?newsletter=1' title='Seven Gates - Edition No. 1' target='_blank'>ここに</a>見付かります。</p> THE RETRIEVAL CODE public function get_letter_data() { $sql = "SELECT letter.*, qa.qa_question, qa.qa_answer FROM sevengates_letter AS letter JOIN sevengates_qa AS qa ON qa.letter_no = letter.letter_no WHERE letter.letter_no =?"; $mysqli_stmt = $this->mysqli_obj->stmt_init(); $mysqli_stmt->prepare($sql); $mysqli_stmt->bind_param('i', $this->letter_no); $mysqli_stmt->execute(); $meta = $mysqli_stmt->result_metadata(); while ($field = $meta->fetch_field()) { $params[] = &$row[$field->name]; } call_user_func_array(array($mysqli_stmt, 'bind_result'), $params); while ($mysqli_stmt->fetch()) { foreach($row as $key => $val) { $c[$key] = $val; } $prelim_result[] = $c; } foreach ($prelim_result as $arr) { foreach ($arr as $name => $value){ $letter_results[$name] = $value; } } return $letter_results; } WHAT IS RETRIEVED and APPEARS IN THE NEWSLETTER ようこそ! DISCUSSION: Everything after the <h1> element has been omitted. QUESTION: What must I do to get everything after ようそう!to appear? Roddy
  6. JSG: No, i have never messed with the error reporting of the php.ini file. At most I have changed dynamically the destination of the error reporting from display to error log. What is more, contrary to your belief, I do not regularly suppress the display of error settings until after I am sure that I have addressed all warnings, notices, and error messages to the best of my ability. in an effort to salvage my local server I have requested my web server host, Lunarpages, to provide me with a copy of their php.ini file so that I can discover what they have changed and better understand how to modify my own php.ini file. In any case, the design flaws that you have pointed out and that have rendered my local server dysfunctional in the new environment will have to be dealt with in the second phase of development -- not this one. I must begin podcast and newsletter production as quickly as possible. Roddy
  7. DSONESUK: Yes, I agree. It seem strange that an AJAX call of POST type would accept a query string of GET-type, but this is exactly what it does. The idea came from StackOverflow, and as I did not know how to write POST-type data, I tried it. This is surely not the source of the problem. In retrospect it is worth citing the jQuery manual in this regard -- namely, "An alias for method. You should use type if you're using versions of jQuery prior to 1.9.0. Apparently, jQuery negotiates the protocol with the PHP file to which the AJAX makes its request. In any case, thank your for teaching me how to write a POST request manually. JSG: My installation is not a prepackaged stack. Rather, it is an improvisation of the software that comes with Apple's operating system. Right now, i am considering about reverting to the old php.ini file, or at least mimicking it as best I can in the new file. My gosh, I do not have time to redo over 20 PHP files when I am so close to completing the first phase of my development. I can accommodate Matomo by modifying the online files that function perfectly well in their current environment. Besides, if everything goes well, I will purchase new equipment and will have to upgrade to PHP 7+ whatever, anyway. In fact, just responding to your recommendation has convinced me that this is the best approach under the current circumstances. For the moment, I simply do not have the time to go back and redo every single file to meet the new PHP demands. There are over 20 files that will likely require some sort of adjustment, and it is already clear that each file will have its own peculiar adjustment needs. INGOLME: Yes, I understand, but the browser tells me nothing other than a failed header that my application does not even require, if only I could solve the problem created by the PHP upgrade. ____________________ Alas, I have decided. I will complete all further modifications of my web-application online until I can afford new equipment and am better positioned to go back and redo everything to meet PHP's new demands. This is a strategic decision that includes that goes beyond code design. Roddy
  8. JSG: Under the assumption that all three of the Apache logs are usually placed in the same folder, I am looking in the right place. I say this because there are other sources of unrelated error reported in the same log files. Following your suggestion the PHP info file also reveals the same address. Alas, there are no error messages other than Error Code 500! INGOLME: I rewrote the console.log(message); statement in the AJAX success function as follows: console.log('This the message that does not display: ' + message); Even this did not appear. Roddy
  9. Unfortunately, the Apache access_log merely confirms the 500 error code, and nothing even appears in the php_errors.log and error_log. Firefox and Safari provide more information. On the bright side I was able to find and access all three logs and have noted where to find them again easily. Roddy
  10. I switched from Safari to Firefox, as I was unable to discover any useful information. Firefox complained the following; No headers for this request and pointed to the above file. Well, the value of $msg contains HTML that depends on the mainpage to provide. So I added the "TEXT" dataType to my AJAX call, but this did not help. The AJAX var dataString = 'name='+ name + '&email=' + email + '&location=' + location + '&language_level=' + language_level + '&language=' + language + '&personal=' + personal; $.ajax({ type: "POST", url: './_utilities/php/freewebinar_filler_form.php', data: dataString, dataType: 'TEXT', statusCode: { 404: function() { alert( "Page not found" ); }}, success: function(message) { console.log(message); $('#main').html("<div id='message'></div>").css('background-image',"url('./_images/gates/opacity/collage_bg3.png')"); $('body, html').animate({scrollTop: $('#main').offset().top},800); $('#message').html(message) .append("<div id='fw_signature'><span style='font-family:Bradley Hand,cursive;font-size:1.4em;color:#4E7F4E;'>Roddy</span>,<br />Your host at Grammar Captive</div>") .hide() .fadeIn(2000, function() { $('#message'); }); } }); Roddy
  11. BACKGROUND: The following code was copied from the Grammar Captive mainpage where it performs just as it was designed to perform. Sadly, however, it fails on my local test server. The error log to which the file points indicates nothing and the data is properly entered into the data base. Further, although the PHPMailerAutoload.php class loads properly, the mail does not get sent and message is produced. Finally, the Javascript Console claims the following: "Failed to load resource: the server responded with a status of 500 (Internal Server Error)". And, the resource that it names is the very same listed below. I checked the confirmation_mail.php file and discovered that two of the links were not using secure protocol and adjusted these. Now, it worked before I upgraded to PHP 5.6.3, but for some reason it does not work now. <?php ini_set('display_errors', 0); ini_set('error_log', '../../../error.log'); ini_set('log_errors', 1); error_reporting(E_ALL); require_once './php_mailer/PHPMailerAutoload.php'; $name = $email = $location = $language_level = $language = $personal = $msg = '' ; if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (!empty($_POST['name']) && !empty($_POST['email']) && !empty($_POST['location']) && !empty($_POST['language']) && !empty($_POST['language_level']) && isset($_POST['personal'])) { $name = filter_var($_POST['name'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW); $email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL, FILTER_SANITIZE_EMAIL); $location = filter_var($_POST['location'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW); $language_level = filter_var($_POST['language_level'], FILTER_SANITIZE_NUMBER_INT, FILTER_VALIDATE_INT); $language = filter_var($_POST['language'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW); $personal = filter_var($_POST['personal'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW); include_once('./classes/class.lunarpages.php'); $lunarpages = new Lunarpages(); $mysqli_obj = $lunarpages->get_mysqli_obj(); function random_password() { $alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!_!_!_!_!_!_!_'; $pass = array(); $alphaLength = strlen($alphabet) - 1; for ($i = 0; $i < 8; $i++) { $n = rand(0, $alphaLength); $pass[] = $alphabet[$n]; } return implode($pass); } $password = random_password(); $hash = password_hash($password, PASSWORD_DEFAULT); $active = 0; $newsletter = 1; $webinar = 1; $tbl_name = 'thege0_grammarcaptive.captive_roster'; $sql_1 = "INSERT INTO $tbl_name (user_name, language, email_address, location, language_level, personal, psw_hash, active, newsletter, webinar) VALUES ('" . $name . "','" . $language . "','" . $email . "','" . $location . "','" . $language_level . "','" . $personal . "','" . $hash . "','" . $active . "','" . $newsletter . "','" . $webinar . "')"; $mysqli_obj->query($sql_1); $mail = new PHPMailer; $mail->CharSet = 'UTF-8'; $mail->isSMTP(); $mail->SMTPDebug = 0; $mail->Debugoutput = 'html'; $mail->Host = "baha.lunarbreeze.com"; $mail->Port = 587; $mail->SMTPAuth = true; $mail->Username = "webinar@grammarcaptive.com"; $mail->Password = "..."; $mail->setFrom('webiniar@grammarcaptive.com', 'Grammar Captive'); $mail->addReplyTo('admin@grammarcaptive.com', 'Grammar Captive Administration'); $mail->addAddress($email, $name); $mail->Subject = 'Account Verification'; $html_message = file_get_contents('../../confirmation_mail.php'); $html_message = str_replace('%name%', $name, $html_message); $html_message = str_replace('%email%', $email, $html_message); $html_message = str_replace('%hash%', $hash, $html_message); $html_message = str_replace('%language%', $language, $html_message); $mail->msgHTML($html_message); $alt_message = "Congratulations, $name! You have successfully created a Grammar Captive account./n/r Please click on the link below to verify that you are the owner of the account and to receive your first edition of Seven Gates, the Grammar Captive weekly newsletter. You will be notified by email as soon as a date and time have been set for your first free webinar./n/r http://www.grammarcaptive.com/_utilities/php/email_verify.php?name=$name&email=$email&hash=$hash&language=$language&letter_no=1"; $mail->AltBody = $alt_message; if (!$mail->send()) { $msg = $mail->ErrorInfo; } else { $msg = "<h1 style = 'text-align: center;color: #4E7F4E;font-size: 3em;font-weight: bold;font-family: Bradley Hand, cursive;margin: -1em, auto;vertical-align: bottom;'>Free Webinar</h1><p style='text-align: center; margin-top: -1.2em; font-size: 0.9em;'>Including the first edition of the Seven Gates weekly newsletter!</p><h2>Congratulations, <span style='font-family: Bradley Hand, cursive;font-size:1.4em;color:#4E7F4E;'>$name</span>!</h2><p style='text-align:left;'>Your information has been securely sent using SMTP protocol and a TSL/SSL security layer.</p><p>Please look for a verification email in your email inbox and click on the link provided. This will insure that you are the person who submitted the data.</p><p>You will receive an email in your inbox as soon as a date and time for the free webinar has been scheduled.</p><p>Episode No. 1 of the Seven Gates newsletter will arrive in your email inbox after you have confirmed your identity.</p><p><span style='color:#4E7F4E;font-weight:bold;'>CAUTION: </span>Sometimes the verification mail will be redirected to a user's junk box. Do not treat it as junk, for without verification no newsletter can be received!</p><p>In addition, you may have to adjust your email software to insure that future email from Grammar Captive arrives in your inbox.</p><p style='text-align:left;'><span style='color:#4E7F4E;font-weight:bold;'>SECURE STORAGE:</span> Your information is stored on the Lunarpages webserver in Orange, California. If you have any questions about the safety of your data, please read under the headings <em>Other/Internet Security</em> and <em>Other/Legal Privacy</em> in the Grammar Captive navigation bar on your left. Alternatively, you may email the Grammar Captive webmaster at <a href='mailto:admin@grammarcaptive.com?subject=Grammar%20Captive%20Webmaster%20-%20Question%20About%20Internet%20Security' title='The Grammar Captive webmaster' target='_blank'>admin@grammarcaptive.com</a>.</p><p>Thank you for your cooperation!</p>"; } echo $msg; } } ?> Any ideas? Roddy
  12. JSG: I appreciate your suggestions, but they must be saved for a later phase of development. I have been working on the current phase for nearly 16 months -- far longer than I ever expected. I must begin creating content. Who knows? What I am expecting to be great content appreciated by many, might be met with important resistance in the global language industry; I have many natural enemies. Indeed, I am already weary of living in developmental poverty and catering to the subsidized blind at this point is a burden that I have no desire to bear. This said, I will be doing my own analytics with Matomo and am hoping to have far better control over what gets counted and what does not. My goal is to depend on Google as little as possible for my commercial success, as I have already come to know Google as a political monster that censors its users without due consideration. In the end, the internet is a jungle that I truly appreciate. One has only to avoid the carnivores and poisonous serpents that guard the state -- what Thomas Paine once described in his 1776 political tract Common Sense as a necessary evil. America's founding fathers were wise, but the American people did not heed their call. As a result they have been led astray by their leaders mesmerized by technological advancement and opiated by their preference for consumption over wisdom. In liberty, Roddy
  13. Please ignore my last request. I got my error message to appear by eliminating the required property in the <input type='text'> form control. All of my desires, but one, have now been satisfied in regard to my search engines -- my digital toilet paper. Further, this success has taught me that I must now go back and modify all of my other forms for which I have suppressed the default behavior, and there are many. Alas, when does one ever get to celebrate success? Thank you everyone for your effort -- especially, Ingolme, for holding her own. Roddy
  14. PROBLEM RESOLVED: Hooray! Hooray! Hooray! The Crucial HTML: Notice that the value of the type property has been changed from button to submit. <input id='qa_submit' type="submit" class='SearchButton' value="Search"> (function() { $('#qa_searchform').on('submit', function(event) { event.preventDefault(); var search_qa_input = $("input#qa_input").val(); findAndDisplay_qa(search_qa_input); }); function findAndDisplay_qa(search_qa_input) { var dataString = 'search_input=' + search_qa_input; $.ajax({...}); } })(); You might still be able to help, however. Can you explain why my the following code fails in regard to the appearance and disappearance of the error message. The console offers no hint of error and the ELSE clause functions just as it should. $('#qa_searchform').on('submit', function(event) { var search_qa_input = $("input#qa_input").val(); if (search_qa_input == "") { $("#qa_input_error").show().append('<br />'); $("#qa_input").focus().focusout(function() { $("#qa_input_error").hide(); }); return false; } else { event.preventDefault(); findAndDisplay_qa(search_qa_input); } }); Roddy
  15. I have shown everything there is and omitted the following: if (search_qa_input == "") { $("label#qa_input_error").show().append('<br />'); $("input#qa_input").focus().focusout(function() { $("label#qa_input_error").hide(); }); return false; } I would invite you to Seattle to have a closer look, but I fear that you would not come, as I haven't enough money to pay for your flight, food, and lodging, and it would be presumptuous for me to ask you to pay your own way. Roddy
  16. I am now of the firm opinion that you're all guessing. The following code (function() { $('#qa_searchform').on('submit', function(event) { event.preventDefault(); var searchValue_qa = $("#qa_input").val(); findAndDisplay_qa(searchValue_qa); }); $('#qa_input').on('click', function() { $('#qa_searchform').submit(); }); function findAndDisplay_qa(searchString) { var dataString = 'search_input=' + searchString; alert(dataString); } })(); yields the following alert that is triggered simply by placing the curser inside the input field. search_input= Roddy
  17. As before, your proposal works for the ENTER/RETURN key (hereafter called the KEY), but not for the form button (hereafter called the BUTTON). This, by the way, is true for all three browsers that are available to me (Safari, Firefox, and Chrome). They all behave identically. An alert appears for the KEY, but nothing occurs for the BUTTON. Roddy
  18. Oops! What works for Safari and Chrome, does not work for Firefox. Firefox permits the desired AJAX call using the ENTER/RETURN key, but rejects the same using the form button. Alas, what I though was a solution is not. On the happy side, Chrome's alert uses the word please: "Please fill out this field" Roddy
  19. I hear you, but the browser apparently does not. Is there some way to avoid having to declare the variable search_qa_input twice. Although no complaint is registered when simple alert() are performed, there is a reaction when the alert function is replaced with a function housing the AJAX call. Never mind, the problem was resolved as follows: (function() { $('#qa_searchform').on('submit', function(event) { event.preventDefault(); findAndDisplay(); }); $('.SearchButton').on('click', function() { event.preventDefault(); findAndDisplay(); }); function findAndDisplay() { var search_qa_input = $("input#qa_input").val(); var dataString = 'search_input=' + search_qa_input; $.ajax({...}); } })(); The only difficulty left is to restore my error message functionality -- namely, if (search_qa_input == "") { $("label#qa_input_error").show().append('<br />'); $("input#qa_input").focus().focusout(function() { $("label#qa_input_error").hide(); }); return false; } The following works for the form button, but not for the ENTER/RETURN key. function findAndDisplay() { var search_qa_input = $("input#qa_input").val(); if (search_qa_input == "") { $("label#qa_input_error").show().append('<br />'); $("input#qa_input").focus().focusout(function() { $("label#qa_input_error").hide(); }); return false; } var dataString = 'search_input=' + search_qa_input; $.ajax({...}); } This said, because I have indicated the input type='text' form element as required, Safari does provide a rude alert that says, "Fill out this field'. Now, unless you have a solution that is more in line with your own proposal I must move on, for I still have two major tasks to complete before I start podcasting and time is running out. Roddy
  20. Ingolme: The result is similar. Rather than a successful AJAX call, a successful alert( ) appears. Still, the form-button behavior is squelched. The following produces two successful alert( )s. (function() { // $('.error').hide(); $('#qa_searchform').on('submit', function(event) { event.preventDefault(); var search_qa_input = $("input#qa_input").val(); alert(search_qa_input); }); $('.SearchButton').on('click', function() { event.preventDefault(); var search_qa_input = $("input#qa_input").val(); alert(search_qa_input); }); })(); Roddy
  21. Hi, Ingolme. It is nice to see you back. I tried the above code, but it fails. When I change it to the following, the AJAX call works for keyboard submit, but the button-click behavior is squelched. $('#qa_searchform').on('submit', function(event) { event.preventDefault(); var search_qa_input = $("input#qa_input").val(); var dataString = 'search_input=' + search_qa_input; $.ajax({...}); }); Roddy
  22. As it did not work the first time, I simplified the procedure to the following: (function() { $('#qa_searchform').on('submit', function(event) { event.preventDefault(); var search_qa_input = $("#qa_input").val(); findAndDisplay_qa(search_qa_input); }); $('#qa_submit').on('click', function() { $('#qa_searchform').submit(); }); findAndDisplay_qa(searchString) { var dataString = 'search_input=' + searchString; $.ajax({***}); } })(); No effect. Whether I click the submit button or depress the ENTER/RETURN key, nothing happens. Roddy
  23. Dsonesuk: According to the proposed function the default behavior is first suppressed. This means that in order to achieve the additional tasks with the default behavior, the default behavior must somehow be reinstated. I do not understand your point. Please ignore the above statement. I was on my way out and too hasty to pass judgement. I have since returned and have had more time to study. I believe that I understand. You are allowing the <input type='submit'> form control behave as usual and focusing the change in default behavior on the <form> element itself, as Ingolme suggested. This will have been the first time that I have employed the .submit( ) method. i like, will give it a try, and return with the result. Roddy
  24. Having established a consensus on Ingolme's proposed solution my dilemma is how to get the same function to work for both the now understood button and the ENTER/RETURN key. It would appear to be a simple matter of reassigning the contents of Action X to the <input type='submit'> form control and the ENTER/RETURN key. In other words, something of the following order: $("REFERENCE TO FORM").on("submit", function(e){ e.preventDefault(); }); function performActionX() { Do action X; } $("REFERENCE TO FORM").on('click', performActionX); $("REFERENCE TO ENTER/RETURN KEY").on('...', performActionX); or alternatively, $("REFERENCE TO FORM").on("submit", function(e){ e.preventDefault(); $(this).on('click', function() { Do Action X; }); $("REFERENCE TO ENTER/RETURN KEY").on('...', function() { Do Action X; }); }); As I have never worked with a key before, I know neither how to assign a jQuery method to a key, nor how to identify a key-event. I would not be concerned about the seemingly haphazard manner in which action X was put together. Each piece of the code has been tested in several other places on two different Grammar Captive pages and in several contexts on each. It appears to be quite robust. Roddy
×
×
  • Create New...