<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — db connection scripts fixes]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=7043&amp;type=atom" />
	<updated>2017-10-27T09:10:49Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=7043</id>
		<entry>
			<title type="html"><![CDATA[Re: db connection scripts fixes]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29252#p29252" />
			<content type="html"><![CDATA[<p>Isn&#039;t it better to be a little permissive when a change from strstr to stristr isn&#039;t any great penalty?<br />And also a check to see if it is the first word in the sql?</p><p>Also if it is not going to be fixed in the core <a href="https://github.com/apmuthu/frontac24/commit/a43faa9e414750f6540b852d49be6437faedcc70">it will reside in my FA24Mods</a>.<br />Thanks for the policy info.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-10-27T09:10:49Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29252#p29252</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: db connection scripts fixes]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29246#p29246" />
			<content type="html"><![CDATA[<p>Following our non-written coding policy regarding sql statements (like using capital letters for sql keywords) there is no need for additional cleanups here :-).<br />Janusz</p>]]></content>
			<author>
				<name><![CDATA[itronics]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=89</uri>
			</author>
			<updated>2017-10-27T07:50:25Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29246#p29246</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: db connection scripts fixes]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29244#p29244" />
			<content type="html"><![CDATA[<p>The <strong>stristr</strong> is okay to fix instead of the regex except that it will not address checking if it is the first word in the sql.<br />The idea is that it should be the beginning of the string and not inbetween like <em>CREATE TABLE xxx SELECT * from ....</em></p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-10-27T07:40:22Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29244#p29244</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: db connection scripts fixes]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29240#p29240" />
			<content type="html"><![CDATA[<p>Not really, maybe a change to stristr instead of strstr.</p><p>/Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2017-10-26T23:02:21Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29240#p29240</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: db connection scripts fixes]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29093#p29093" />
			<content type="html"><![CDATA[<p>@joe: any thoughts?</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-10-19T06:07:40Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29093#p29093</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[db connection scripts fixes]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=29058#p29058" />
			<content type="html"><![CDATA[<p>The db connection scripts reside in the <strong>includes/db/</strong> folder.</p><p>The currently acceptable db drivers there are:<br /></p><div class="codebox"><pre><code>connect_db_mysqli.inc
connect_db_mysql.inc</code></pre></div><p>Line 15 in the MySQLi driver file above is:<br /></p><div class="codebox"><pre><code>$db_last_inserted_id = 0;</code></pre></div><p>This needs to be ported to the MySQL driver too.</p><p>The <strong>function db_query()</strong> in both driver files have a line (78/79):<br /></p><div class="codebox"><pre><code>        if ($SysPrefs-&gt;select_trail || (strstr($sql, &#039;SELECT&#039;) === false)) {</code></pre></div><p>It is better coded to make the <strong>SELECT</strong> be the beginning part of the search string and case insensitive as well (<strong>stristr</strong> ?) like:<br /></p><div class="codebox"><pre><code>        $sql = trim($sql);
        if ($SysPrefs-&gt;select_trail || (preg_match(&#039;/^SELECT/i&#039;, $sql) === 0)) {</code></pre></div><p>According to the PHP Manual:<br /></p><div class="quotebox"><blockquote><p>preg_match() returns the number of times pattern matches. That will be either 0 times (no match) or 1 time because preg_match() will stop searching after the first match.</p></blockquote></div>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-10-15T10:23:09Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=29058#p29058</id>
		</entry>
</feed>
