<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title></title>
        <link>https://interactivetools.com/forum/forum-search.php?k=user%3Atbcshifter</link>
        <description></description>
        <pubDate>Mon, 18 May 2026 16:08:43 -0700</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-search.php?k=user%3Atbcshifter&amp;rss=1" rel="self" type="application/rss+xml" />

                <item>
          <title>A Few Potential Enhancements</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247533#post2247533</link>
          <description><![CDATA[<blockquote>
<p><span>For selectExpr, how are you using it?  getRecords() runs a lot of extra code, I'm wondering if calling mysql_select_query() directly would provide even more performance?</span></p>
</blockquote>
<p>Not frequently, but mostly when there's a table with large text or blob fields that we want to exclude when fetching a bunch of records for memory sake, but we still want to take advantage of some of the extra getRecords() options.</p>]]></description>
          <pubDate>Wed, 25 Sep 2024 13:00:01 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247533#post2247533</guid>
        </item>
                <item>
          <title>DB Connection Check Issue</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247528#post2247528</link>
          <description><![CDATA[<p>Dave, that looks great, thanks.</p>
<p>While I was in there, I thought I'd mention a few other enhancements that I added over the years in case you want to incorporate any of them.</p>
<p><a href="https://www.interactivetools.com/forum/forum-posts.php?A-Few-Potential-Enhancements-82871" rel="nofollow">https://www.interactivetools.com/forum/forum-posts.php?A-Few-Potential-Enhancements-82871</a></p>]]></description>
          <pubDate>Mon, 23 Sep 2024 13:06:31 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247528#post2247528</guid>
        </item>
                <item>
          <title>A Few Potential Enhancements</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247527#post2247527</link>
          <description><![CDATA[<p>Here's a few things I've added over the years that have been useful to me in case they make sense to add to the codebase.</p>
<p>mysql_where(): support searching for NULL values</p>
<pre class="language-php"><code>elseif (is_null($value)) {
    $where .= "`$fieldName` IS NULL AND ";
}</code></pre>
<pre><span>_getRecords_getQuery(): support selecting only part of the table for performance with large tables, support forcing an index<br /></span></pre>
<pre class="language-php"><code>if (@$options['selectExpr']) {
    $selectFields = "`{$options['tableName']}`." . $options['selectExpr'];
}

// create query
$query = "SELECT $selectFields\n";
$query .= "FROM `" .DB::$tablePrefix. "{$options['tableName']}` as `{$options['tableName']}`\n";
$query .= (@$options['useIndex']) ? "USE INDEX ({$options['useIndex']})\n" : '';
$query .= $LEFT_JOIN;

...</code></pre>
<pre><span>_getRecords_getCountQuery(): useIndex same as getQuery()<br /><br />isValidEmail(): prevent leading/trailing spaces from throwing an error since they don't break any mail functions I've found<br /></span></pre>
<pre class="language-php"><code>$input = trim(is_string($input) ? $input : (string) $input);</code></pre>
]]></description>
          <pubDate>Mon, 23 Sep 2024 13:06:08 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247527#post2247527</guid>
        </item>
                <item>
          <title>DB Connection Check Issue</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247525#post2247525</link>
          <description><![CDATA[<p>Dave, found an issue with this new code. The ping() takes about 0.2 seconds. This function is called all over the place in functions like mysql_escape() where you might run that dozens of times on the page. Insert scripts that used to take a couple of seconds to run are now taking 30 or 45 seconds. So I have to remove the ping(). It might make sense to have a parameter that runs the ping() when you want a "real" check, but not run it every time by default.</p>]]></description>
          <pubDate>Sat, 21 Sep 2024 13:28:00 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247525#post2247525</guid>
        </item>
                <item>
          <title>DB Connection Check Issue</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247522#post2247522</link>
          <description><![CDATA[<p>Dave, I think that should work nicely. Thanks for the quick response!</p>]]></description>
          <pubDate>Tue, 17 Sep 2024 13:22:13 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247522#post2247522</guid>
        </item>
                <item>
          <title>DB Connection Check Issue</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247519#post2247519</link>
          <description><![CDATA[<p>I have some nightly scripts that are very important to be executed, but sometimes the DB connection fails for a random reason causing the entire script to die. So I created a wrapper that runs the connectToMySQL() function in a loop that sleeps if the connection fails and continues to attempt to connect. This used to work very well before the update to using the DB class.</p>
<p>I couldn't figure out why it wasn't retrying on fail recently until I just noticed that the DB::isConnected() function only checks that the $mysqli variable has been instantiated. When DB::connect() throws an exception, it doesn't reset the $mysqli variable. So when I check DB::isConnected() it always returns true after the first attempt. I created a workaround to call DB::disconnect() after a failed attempt, but it would seem that DB::isConnected() should be refactored to actually check that we have a connection, not that it was just attempted.</p>]]></description>
          <pubDate>Tue, 17 Sep 2024 08:49:08 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247519#post2247519</guid>
        </item>
                <item>
          <title>Session Issue with Load Balancer Across Multiple Servers (3.71)</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2247367#post2247367</link>
          <description><![CDATA[<p>We have 4 web servers with a load balancer. We recently upgraded to <span>3.71 and t</span>he new <strong>SessionHandler::start()</strong> function uses <span><strong>fileinode()</strong> for the session name suffix, which means that each server that you hit will generate a different value. This causes unexpected logouts as well as CSRF errors and all kinds of weirdness depending on which server you happen to hit on any given request.</span></p>
<p>I changed it to use <strong>md5()</strong> as that will still allow multiple installs on the same server, but the same install dir across multiple servers will generate the same value.</p>
<pre class="language-php"><code>$suffix    = strtolower(substr(md5(CMS_ROOT_DIR), -6));</code></pre>
<p>There may be a better way to handle it.</p>]]></description>
          <pubDate>Thu, 18 Jul 2024 13:32:51 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2247367#post2247367</guid>
        </item>
                <item>
          <title>CMSB v3.56 Released (now free with PHP 8.1 support)</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2246079#post2246079</link>
          <description><![CDATA[<p>Thanks!</p>
<p>I did notice one small bug hasn't been fixed in mail_functions.php on line 230. The variable set at the top is called $oldEncoding, not $mbEncoding.</p>]]></description>
          <pubDate>Fri, 05 Aug 2022 14:16:48 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2246079#post2246079</guid>
        </item>
                <item>
          <title>Issue with pseudo fields when column is null</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2244608#post2244608</link>
          <description><![CDATA[<p>So it turns out there's a bug in that code sample that causes the :label pseudofield not to be populated on "options listed below" list type. This is my new code, but it may be more elegant to handle preventing this query directly in getListOptionsFromSchema().</p>
<pre class="language-php"><code>elseif (@$fieldSchema['optionsType'] == 'table' &amp;&amp; empty($selectedValues)) {
  $valuesToLabels = [];
}
else {
  $listOptions    = getListOptionsFromSchema($fieldSchema, null, false, $selectedValues);
  $values         = array_pluck($listOptions, '0');
  $labels         = array_pluck($listOptions, '1');
  $valuesToLabels = $listOptions ? array_combine($values, $labels) : [];
}</code></pre>]]></description>
          <pubDate>Tue, 07 Apr 2020 14:24:03 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2244608#post2244608</guid>
        </item>
                <item>
          <title>An unexpected error occurred</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2244602#post2244602</link>
          <description><![CDATA[<p>I just upgraded to 3.53. There seems to be a new "feature" that prints "An unexpected error occurred" on the page every time there's an error logged.</p>
<p>I have display_errors turned off. I'm confused why I would want text printed all over the page every time an error is logged? Isn't that the entire reason to log the errors and not display them in environments like prod?</p>
<p>Or maybe I'm missing something?</p>]]></description>
          <pubDate>Sun, 05 Apr 2020 12:50:07 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2244602#post2244602</guid>
        </item>
                <item>
          <title>isHTTPS() recommended enhancement for load balancers</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2244601#post2244601</link>
          <description><![CDATA[<p>isHTTPS() doesn't work properly if your server is behind a load balancer. If the SSL cert is on the LB side, SERVER_PORT can be anything even if the original port was 443. This causes force_ssl to create an endless loop.</p>
<p>What I've done is add a line to check for headers which most load balancers populate. There may also be additional enhancements that could also be added here for different configurations, but this worked for me on Heroku and AWS.</p>
<pre class="language-php"><code>function isHTTPS() {
  if (isset($_SERVER['HTTPS'])       &amp;&amp; $_SERVER['HTTPS']       == 'on') { return true; }
  if (isset($_SERVER['SERVER_PORT']) &amp;&amp; $_SERVER['SERVER_PORT'] == 443)  { return true; }
  if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &amp;&amp; @$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')  { return true; }
  if (isset($_SERVER['HTTP_X_FORWARDED_PORT']) &amp;&amp; @$_SERVER['HTTP_X_FORWARDED_PORT'] == 443)  { return true; }
  return false;
}</code></pre>]]></description>
          <pubDate>Sun, 05 Apr 2020 12:15:40 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2244601#post2244601</guid>
        </item>
                <item>
          <title>Issue with pseudo fields when column is null</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2244600#post2244600</link>
          <description><![CDATA[<p>I wouldn't call this a bug, per se, but it's definitely an unnecessary performance issue that should be fixed.</p>
<ul><li>You have a table (A) with a field (F) that is a List that is set to Get Options from Database (advanced) from table (B)</li>
<li>Field F is set to null in all records in the table.</li>
<li>You run getRecords() on table A with loadPseudoFields set to true.</li>
</ul><p>In _getRecords_addPseudoFields() it will call getListOptionsFromSchema() with $selectedValues as an empty array.</p>
<p>This runs a query on table B with no WHERE clause, so it pulls the first 1000 rows from the table which can take a few seconds to run on a large table.</p>
<p>But there's no need to populate the label on a null value, so the whole thing doesn't even need to be run.</p>
<p>So what I've done is edit line 602+ as such:</p>
<pre class="language-php"><code>elseif (!empty($selectedValues)) {
  $listOptions    = getListOptionsFromSchema($fieldSchema, null, false, $selectedValues);
  $values         = array_pluck($listOptions, '0');
  $labels         = array_pluck($listOptions, '1');
  $valuesToLabels = $listOptions ? array_combine($values, $labels) : [];
}
else {
  continue;
}</code></pre>]]></description>
          <pubDate>Sun, 05 Apr 2020 12:02:41 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2244600#post2244600</guid>
        </item>
              </channel>
    </rss>
  