Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by iwato

  1. So, if I had written $result = array( 'rgb' => [], 'hex' => '' ); then I would not have had to rewrite the function. Is this correct? Roddy
  2. So, are you saying that $result['rgb'][$col] is being read as NULL[$col]? If so, what happened between PHP 5.3.8 and PHP 7.2 that changed $result['rgb'] from an element of an array to a string? Roddy
  3. BACKGROUND: The following newly created function works splendidly with PHP 5.3.8, but it fails nearly totally in PHP 7.2. Still there is no error message. The FUNCTION: function random_color($base = true, $type = true){ $result = array( 'rgb' => '', 'hex' => '' ); foreach( array('r', 'b', 'g') as $col){ $rand = mt_rand(0, 255); $result['rgb'][$col] = $rand; $dechex = dechex($rand); if(strlen($dechex) < 2){ $dechex = '0' . $dechex; } $result['hex'] .= $dechex; } if ($base == true) { if ($type == true) { return $result['rgb']; } else {
  4. It worked! As is often the case, I am heartily embarrassed. Sometimes I get so lost in the trees that I can no longer see the forest. The new resetForm() function: function resetForm() { $.ajax({ type: "POST", url: './php/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; $('#captcha_answer').val(''); $('#captcha_question').html(jsonObj.captcha_rq); $('#captcha_success').cs
  5. That was my idea too, but I could not get it to work after two-and-one-half hours of experimentation. I have decided to provide all of the code with the exception of the modified PHP class, and add the following comments. The submitForm() function works well with each new page load. The resetForm() function works well with each button click. The submitForm() function fails to work after the resetForm() function has been activated. In effect, the function cannot match the word-number phrase with the number that is entered by the visitor and the error message results. Ple
  6. BACKGROUND: I have a javascript document that is dynamically loaded when a certain condition is met. In this document there are two functions: the first function is called submitForm(), and the second is called resetForm(). Each of these functions is triggered separately by a different button on the same HTML webpage. Both functions rely on the same PHP class, but each relies on data created by a different instance containing different data. The first instance is created at run time and is ultimately read into the submitForm() function. The second instance is created at the visitor's d
  7. Have a great week end! Roddy
  8. QUESTION THREE: By way of confirmation, may I use the same require_once() function as many times and places as I like during the same browser session with good confidence that it will be included/required only once? Roddy
  9. A Ha! A "hitherto by me yet to be employed" technique is now on the table. Please do not run away for the weekend just yet. QUESTION ONE: Are you suggesting that the .js file extension is just a file accounting convenience and has no effect on whether Javascript is run? QUESTION TWO: Are there any additional security problems associated with setting the server to run javascript (.js) files with PHP? Roddy
  10. I do not have what you are suggesting, but you have answered my question with regard to multiple include statements. I do have one more question before you disappear for the week end. Will PHP used to create new instances of the same previously called PHP class and to assign values to Javascript variables be properly read when the Javascript file is loaded. Or, must the assignment be achieved via AJAX or some other, hitherto by me yet to be employed, technique? Roddy
  11. Not exactly! I have modified a class that someone else designed for a very different environment. Right now I am concerned about where to include the class, so that its inclusion does not become redundant on the one hand, and so that it is always and everywhere available on the other. There is a three step process involved. 1) Load the HTML mainpage. 2) Call a Javascript document that loads any of three search <div>s on the mainpage into the mainpage's main <div>. 3) Call a another Javascript document that captures the search data and sends it off to a PHP file
  12. BACKGROUND: I have three search forms included in three different <div>s on the Grammar Captive main page. Initially all three of the forms are hidden. When a visitor selects one of the three forms, the javascript file associated with the main page performs a test in order to ascertain whether previous search data associated with the form is recoverable. if so, two of two additional javascript files is loaded. If not, only one of them. This latter file is crucial to both scenarios. GOAL: As I strongly suspect that my database is being spammed with repeated entries of the sam
  13. $.each(jsonData, function(key, object) { var searchItem = {}; var nakedArabic = []; var agex = new RegExp(/[\u0600-\u06ff]|[\u0750-\u077f]|[\ufb50-\ufbc1]|[\ufbd3-\ufd3f]|[\ufd50-\ufd8f]|[\ufd92-\ufdc7]|[\ufe70-\ufefc]|[\uFDF0-\uFDFD]/g); $.each(object, function(name, value) { if (name === 'searchKeyword') { if (agex.test(value)) { nakedArabic = value.match(agex); searchItem.target = '\u2067' + nakedArabic.join('') + '\u2069'; } else { searchItem.target = value; } }
  14. OK. I get it.! The properties value and enumerable are property descriptors. They define the nature of the property getFoo. Thanks! Roddy
  15. jsonLikeObj.getFoo.value( ); BACKGROUND: Consider the following object var jsonLikeObj = Object.create( {}, {getFoo: { value: function() { return this.foo = 1; }, enumerable: false } } ); DISCUSSION: Now I could more easily understand the following that does not work, than what does work. What Does Not Work jsonLikeObj.getFoo.value(); What Does Work jsonLikeObj.getFoo(); QUESTION: What is going on? Roddy
  16. Dsonesuk, I have awarded you the cup for a helpful accident on your part. Please compare the following two pieces of code. The first fails; the second works: FAILED CODE $('body, html').animate({scrollTop: $('#your_tutor').offset().top},800); WORKING CODE $('body, html').animate({scrollTop: $('#your_tutor').offset().top},800,function(){ $('html,body').clearQueue(); }); There appears to be some sort of jQuery bubbling going on. Roddy
  17. So, all of the selectors currently identified by $('body, html') should read $('body'). Is this correct? Roddy
  18. Actually, no. The problem occurs with the page to which the link on the page for which the above CSS code appears. I believe that I have inadvertently misled you. Please focus on the following statement and ignore the code that I provided in my previous entry. It is from a different page and a different problem. Roddy
  19. Hi, Dsonesuk. I have checked all of the relevant HTML and CSS documents that go into producing the mainpage with the GC Tutor insert. In no case does the word overflow appear. No, I have not change my browser's setting. In any case, the issue is not browser sensitive. I would like to bring your attention to the CSS used to format the tutor.grammarcaptive.com subdomain index page. /* CSS Stylesheet for GC Tutor ** Date of Creation: Sunday, 21 October 2018 ** Author: Roddy A. Stegemann */ body, html { height: 100%; background-color: #666; color: #ccc; } .parallax {
  20. OK. I have now got the scrolling to work in all instances. The only thing that remains to be solved is the stuttering. There are six different conditions that must be met: Computer Browser 1) Load the insert directly from the mainpage by clicking on GC Tutor in the navigation bar. 2) Load the insert directly from the subdomain tutor.grammarcaptive.com 3) Load the insert from the subdomain, load other inserts, and then load the insert GC Tutor, as if the page were loaded directly from the mainpage. Smart Phone 1) Load the insert directly from the mainpage by
  21. Using the HTML tag alone corrects the problem on my iPhone, but does not correct the stuttering effect in my computer's browser window. Roddy
  22. $('body, html').animate({scrollTop: $('#your_tutor').offset().top},800); Oh, I see what you mean. This technique is used throughout my site, and I have not had trouble with it. What would you suggest that I target? The loaded gctutor_div, the main div in which the gctutor.div resides, the html div, or the body div. I am referring only to the affected offset at this point. Roddy
  23. If the second scroll mechanism is not included in the original .load( ) function, the second scroll fails completely. The entire .load( ) function is provided below. What you see is slightly different from what appears on the original page of this thread. Neither the original, nor the modified position alters either originally stated outcome. MODIFIED CODE $("#main").load("gctutor_filler.html #gctutor_div", function() { $(".hidden_tr").hide(); $("#hidden_handyman").hide(); $(".seeMore").css({"font-family": "'Bradley Hand', 'cursive'", "font-size": "1.2em", "color":
  24. Although it is true that two scrolls do take place within the same .load() function, they are very separate actions. The first scroll is automatically triggered when the div is loaded, the second takes place at the visitor's discretion and occurs only after the div is loaded, if it occurs at all. Roddy
  25. Have you tried your mobile device. There it simply fails. Yes, if one waits in a non-mobile environment the problem does correct itself, but internet users are generally impatient and demand perfection. Too many quirks will chase them away. Are you suggesting another way to expose a hidden div that does not use Javascript? Roddy p.s. If I ever build another site, or have someone overall the current site, things will be done very differently. Developing is a learning experience on the one hand, and a business enterprise on the other. One must balance between the two
  • Create New...