Jump to content


  • Content count

  • Joined

  • Last visited

Community Reputation

11 Good

1 Follower

About iwato

  • Rank
    Invested Member

Contact Methods

  • AIM
  • Website URL
  • Yahoo
  • Skype

Profile Information

  • Gender
  • Location
    Seattle, Washington USA 98104

Previous Fields

  • Languages
    HTML, CSS, Javascript, PHP, MySQL and Spoken Language

Recent Profile Visitors

13,428 profile views
  1. PHP Upgrade from 5.5.38 to 5.6.33

    I am a little confused by your answer: 1) Recall that all I did was upgrade from PHP version 5.5.38 to 5.6.33 on my local server. 2) Further, understand that my error reporting was turned off both before and after the upgrade, and that the error messages only began appearing after the upgrade. 3) In addition, please note that my 3rd-party host server, where the relevant PHP files are set identically with those on my local test server, also uses 5.6.33. There, no error messages are reported. Finally, I do not understand why the following code produces the undefined notice. if (filter_var($_GET['refer_type'], FILTER_VALIDATE_INT)) { $refer_type = $_GET['refer_type']; } else { $refer_type = 0; } My UNDERSTANDING: If there is a value registered for $_GET['refer_type'], the variable is obviously set, and the value is assigned to $refer_type. If there is no value, it matters not whether the variable is set or not, for the value 0 is assigned to $refer_type, no matter whether $_GET['refer_type'] is set or not. REQUEST: How would you write the same code to avert the error message, if indeed, it is the code that is creating the message and not something else. ? Roddy
  2. PHP Upgrade from 5.5.38 to 5.6.33

    BACKGROUND: I recently upgraded my version of PHP from 5.5.38 to 5.6.33. PHP code that functioned perfectly well now fails with imposed notifications complaining about undefined variables. Mind you, my error logs and notifications are turned off. This suggests that I must either learn how to turn off these imposed intrusions or learn to write PHP properly and modify all of my PHP processing files accordingly. In the belief that I will be better served by the latter, I am appealing to W3Schools to set me straight. REQUEST: Please examine the following two pieces of code and correct then so that I do not receive a notice from PHP telling me that the variable is undefined, when indeed no value was intended. This is just a sampling of the problem that I am now confronted with. Sampling One - The CODE My Action: I selected webinar, but not newsletter before the form was submitted. <?php // ini_set('display_errors', 1); // ini_set('display_startup_errors', 1); // error_reporting(E_ALL); require_once '../../_utilities/php/php_mailer/PHPMailerAutoload.php'; // var_dump(class_exists('PHPMailer')); $name = $email = $newsletter = $webinar = $language = $error_msg = '' ; /* function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } */ if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST['language'])) { $error_msg = "Please select your first language or add another, if yours is not listed."; } else if ($_POST['language'] == 'other_tongue') { if (empty($_POST['other'])) { $error_msg = "Please enter your first language."; } else { $language = filter_var($_POST["other"], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW); } } else { $language = filter_var($_POST["language"], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW); } if (!($_POST["newsletter"]) && !($_POST["webinar"])) { $error_msg = "Have you forgotten to select a gift?"; } else { $newsletter = filter_var($_POST["newsletter"], FILTER_SANITIZE_NUMBER_INT, FILTER_VALIDATE_INT); $newsletter = !empty($newsletter) ? "$newsletter" : 0; $webinar = filter_var($_POST["webinar"], FILTER_SANITIZE_NUMBER_INT, FILTER_VALIDATE_INT); $webinar = !empty($webinar) ? "$webinar" : 0; } ... The ERROR MESSAGE: Sampling Two - The CODE My Action: I opened the page directly. There was no referral. <?php /* ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); */ if (filter_var($_GET['refer_type'], FILTER_VALIDATE_INT)) { $refer_type = $_GET['refer_type']; } else { $refer_type = 0; } ... The ERROR MESSAGE: Please advise. Roddy
  3. SHOW COLUMNS with prepared in php

    Prepared statements are more difficult to implement. Match the method with the task. Prepared statements are only required when security is an issue. Roddy
  4. BACKGROUND: I am in the process of integrating Matomo website analytics into my web application and stumbled across an important functional element that is missing on my main page -- namely, an onsite search window that delivers information about the site to the page. Not only would such an element provide valuable information about what users are looking for on my site -- this, as opposed to what I am offering --, but it would also provide them with a reason to tarry just a little longer on my site. QUESTION: Can you provide me with some leads into setting up such functionality. As most of my content is delivered dynamically, this need not be anything as elaborate as that provided by the InvisionZone domain. Roddy
  5. SHOW COLUMNS with prepared in php

    Security is necessary when others have access to your database. PHP is only visible to you. A form, on the other hand, is visible to everyone, and the data passed to your database via the form can be entered by anyone. Roddy If what i write has been of help, please do not forget to say thanks. Hover over the heart and click on the trophy.
  6. appear => appears Sorry, the host of Grammar Captive errs on occasion. Roddy
  7. Script Structure and Use Analysis

    Sure, but I have no desire to be controlled by Google. Roddy
  8. How do I place an image outside the body content?

    You have two choices: one, you can use the CSS float property, or you can use Flexbox which is also a form of CSS. Although your page seems well-structured, it does not appear to be responsive in design. For this reason I suggest that you use the float property. Roddy If you find my response useful, please do not forget to say thanks by hovering over the heart and clicking on the trophy.
  9. Script Structure and Use Analysis

    Thank you for your insight. I believe that you have saved me much wasted effort. I have decided to go with Matomo. I am not expecting it to be the easiest implementation in the world, but it does appear to be comprehensive and well documented. Best of all, it is open source and appears to be used by reputable companies. Hopefully my bad experience with RSS feeds has taught me a lesson. Go where the documentation is best Roddy
  10. BACKGROUND: I found the appended script on the net and am inclined to believe that it could prove very useful. i would like to share it with you in the hope that those better versed in Javascript than I might provide insight into its proper use. The annotation enclosed as follows /* ... */ is mine and may be inaccurate. /* * Brief Description: A script for tracking in real time. * Date: 20 February 2018 (downloaded from internet) * Source: Neezer at Stackoverflow * Link: https://stackoverflow.com/users/32154/neezer */ /**************************************************************************************** Gets element by class name, assigns each to an element of an array, and returns the array. Apparently, the class name is trackit. ****************************************************************************************/ if (document.getElementsByClassName === undefined) { document.getElementsByClassName = function(className) { var hasClassName, allElements, results, element; hasClassName = new RegExp("(?:^|\\s)" + className + "(?:$|\\s)"); allElements = document.getElementsByTagName("*"); results = []; for (var i = 0; (element = allElements[i]) !== null; i++) { var elementClass = element.className; if (elementClass && elementClass.indexOf(className) != -1 && hasClassName.test(elementClass)) { results.push(element); } } return results; }; } /**************************************************************************************** * The function that is called when a tracked element is clicked and sets the tracking in motion. ****************************************************************************************/ function addTracker(obj, type, fn) { // adds a tracker to the page, like $('xxx').event if (obj.addEventListener) { obj.addEventListener(type, fn, false); } else if (obj.addEventListener) { obj['e' + type + fn] = fn; obj[type + fn] = function() { obj['e' + type + fn]( window.event ); }; obj.attachEvent('on' + type, obj[type + fn]); } } /**************************************************************************************** * Creates a query string with the tracked information and assigns it to a relative path leading to a PHP processing file. ****************************************************************************************/ function save_click(passed_object) { // this function records a click var now, then, path, encoded, to, from, name, img; now = new Date(); path = '/lib/click.php'; from = (window.decode) ? window.decodeURI(document.URL) : document.URL; to = (window.decodeURI) ? window.decodeURI(passed_object.href) : passed_object.href; name = (passed_object.name && passed_object.name != '') ? passed_object.name : '[No Name]'; // timestamp the path! path += '?timestamp=' + now.getTime(); path += '&to=' + escape(to) + '&from=' + escape(from) + '&name=' + name; // compile the path with the recorded information img = new Image(); img.src = path; // when we call the image, we poll the php page; genius! while (now.getTime() < then) { now = new Date(); // resets the timer for subsequent clicks } } /************************************************************************************************* * Fetches the targeted links by their class assignment and attaches the event handler save_click() *************************************************************************************************/ function get_targeted_links(target) { var links, link; if (document.getElementsByClassName) { links = document.getElementsByClassName(target); for (var i = 0; i < links.length; i++) { link = links[i]; if (link.href) { addTracker(links[i], 'mousedown', save_click(links[i])); } } } } /************************************************************************************************* * The Function Call - Calls the addTracker() function and loads the get_targeted_links() function. *************************************************************************************************/ addTracker(window, 'load', get_targeted_links('trackit')); The following is my understanding of the script and my confusion with same. I am requesting that you help to unravel my confusion, so that I might easily implement the script. SET UP 1) The class name 'trackit' is assigned to those elements on a page that the users wishes to track. 2) The entire script is loaded into the page at the outset by a <script> tag in the <head> element of the document. 3) In the document's jQuery ready( ) function is inserted the call to the addTracker( ) function. 4) When the page is loaded the activity of the elements to which the class name 'trackit' has been assigned is tracked. 5) Each time a click event takes place, the gathered information is assigned to a query string and appended to a relative path that points to a PHP processing file. WHAT I DO NOT UNDERSTAND 1) Although it appears that the tracked elements are stored in an array called results, the relationship between the activity that is tracked for each element of the array and the array itself is unclear. In effect, the user can easily know which elements are being tracked, but to what use is this information when all of the tracking information is stored in a query string? 2) There appears to be know mechanism for sending the query string to the designated relative path -- namely, .../lib/click.php. For example, when sending form data to a PHP processing file, the type-submit, input control initiates the HTTPRequest. 3) The author has added the comment "adds a tracker to the page, like $('xxx').event". I simply do not understand the meaning or use of the expression $('xxx').event in this context. is it not enough to simply assign the class name 'trackit' to each element that the user wishes to track. HAVE I UNDERSTOOD THE FOLLOWING CORRECTLY timestamp // When the click event takes place. from // the URL of the document on which the click event takes place. to // the address of the document called when the click event takes place. name // a property of the passed event object that identifies the object -- perhaps, the value of a name or id attribute. Finally, please comment on my annotations, if you feel that they do not properly explain the role of the function. Roddy Good documentation is a somewhat rare commodity on the internet.
  11. Live Search - Over 40,000 Records

    Under the assumption that the XML files are uniformly constructed. Why not construct a table in a database that could accommodate all of the XML items in your files, and then write a PHP routine that would extract the values of each item in each file and insert them into the data table? I know. I was also very hesitant to start using a database, but I am very glad that I did. For, it is everything at your fingertips -- anything, anywhere, anytime, in any order, and as much or as little as you want. Roddy
  12. SHOW COLUMNS with prepared in php

    Why are you using prepared statements to show table fields? It seems excessive. By the way, in your case $mysqli_obj = $conn;
  13. BACKGROUND: Please compare the Select Language <select> element option menu under the headings Free Webinar and Newsletter/Subscribe found in the navigation bar on the Grammar Captive main page. Therein lies the heart of the following question. QUESTION: How does one set the background and text colors of the <optgroup> element so that they appear properly in Firefox? Neither optgroup { background: black; color: white; } nor optgroup { background-color: black; color: white; } appear to work. Roddy
  14. SHOW COLUMNS with prepared in php

    $db_name = "..."; $tbl_name = "..."; $sql = "SHOW FULL COLUMNS IN " . $tbl_name . " IN " . $db_name; $result_obj = $mysqli_obj->query($sql); while ($row = $result_obj->fetch_assoc()) { foreach ($row as $key => $value) { echo "<span style='font-weight:bold;'>" . $key . "</span>: <span style='color:red;'>" . $value . '</span><br />'; } echo '<hr>'; } Roddy
  15. Failure to Transfer Focus

    Yes, Dsonesuk. You are so often, so accurate. You deserve the highest accolade. I am now targeting the <input> form control directly, rather than the <div> element in which it is contained. All it took was an additional line of code. My future users will have much for which to thank you. The new implementation has already begun. You can see it in the Weekly Podcasts panel of the Grammar Captive mainpage. Roddy p.s. The FIX $('#pc_other').hide(); $('#pc_tongue').change(function() { if ($('#pc_tongue').val() == 'other_tongue') { $('#pc_other').show(); $('#pc_other_input').focus(); } else { $('#pc_other').hide().focusout(function(){ $("label#pc_tongue_error").hide(); }); } });