<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Open Script Solution&#187; content</title>
	<atom:link href="http://www.openscriptsolution.com/tag/content/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.openscriptsolution.com</link>
	<description>... where solutions for script programming are found ...</description>
	<lastBuildDate>Tue, 31 Jan 2012 03:22:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to Avoid Duplicate Ticket Content Saved in HESK v2.1</title>
		<link>http://www.openscriptsolution.com/2009/12/16/how-to-avoid-duplicate-ticket-content-saved-in-hesk-v2-1/</link>
		<comments>http://www.openscriptsolution.com/2009/12/16/how-to-avoid-duplicate-ticket-content-saved-in-hesk-v2-1/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 16:51:12 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[HESK]]></category>
		<category><![CDATA[avoid]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[duplicate]]></category>
		<category><![CDATA[page]]></category>
		<category><![CDATA[refresh]]></category>
		<category><![CDATA[reload]]></category>
		<category><![CDATA[ticket]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1035</guid>
		<description><![CDATA[Actually, this modification I created was being intended for a friend of mine who implemented HESK for his department. I was interested with its interface, so I tried to create a new ticket and tested after submitting the ticket, I reload the &#8220;thank-you&#8221; page. In fact, a new ticket then would be created, the same [...]]]></description>
			<content:encoded><![CDATA[<p>Actually, this modification I created was being intended for a friend of mine who implemented <a href="http://www.hesk.com" target="_blank">HESK</a> for his department. I was interested with its interface, so I tried to create a new ticket and tested after submitting the ticket, I reload the &#8220;thank-you&#8221; page. In fact, a new ticket then would be created, <a href="http://www.openscriptsolution.com/2009/09/03/how-to-avoid-duplicate-ticket-content-in-osticket-system/" target="_blank">the same condition that occured in osTicket</a>, which I have created the modification regarding it to fix the same problem. <span id="more-1035"></span></p>
<ol>
<li>
Open your <strong>submit_ticket.php</strong> file, and find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>192
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">hesk_dbConnect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>then after that line, please insert this following code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>193
194
195
196
197
198
199
200
201
202
203
204
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/* MOD: Avoid duplicate ticket (identified by its Subject &amp; Message) */</span>
<span style="color: #666666; font-style: italic;">/* modified by Masino Sinaga, November 30, 2009 */</span>
<span style="color: #000088;">$sqlcek</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT `subject`,`message` FROM `&quot;</span><span style="color: #339933;">.</span>hesk_dbEscape<span style="color: #009900;">&#40;</span><span style="color: #000088;">$hesk_settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'db_pfix'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;tickets` 
        WHERE `subject`='&quot;</span><span style="color: #339933;">.</span>hesk_dbEscape<span style="color: #009900;">&#40;</span><span style="color: #000088;">$subject</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' AND `message`='&quot;</span><span style="color: #339933;">.</span>hesk_dbEscape<span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$rescek</span> <span style="color: #339933;">=</span> hesk_dbQuery<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sqlcek</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>hesk_dbNumRows<span style="color: #009900;">&#40;</span><span style="color: #000088;">$rescek</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">//header('Location: index.php?a=add');</span>
    <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Location: sorry.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;This ticket content already exists in database!&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">/* MOD: Avoid duplicate ticket (identified by its Subject &amp; Message) */</span></pre></td></tr></table></div>

</li>
<li>
Create a new php file, and name it with <strong>sorry.php</strong>, copy and paste this code below, and put this file to your HESK&#8217;s root directory:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Created by Masino Sinaga, http://www.openscriptsolution.com, November 30, 2009 */</span>
&nbsp;
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'IN_SCRIPT'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'HESK_PATH'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Get all the required files and functions */</span>
<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span>HESK_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'hesk_settings.inc.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span>HESK_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'inc/common.inc.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Print header */</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span>HESK_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'inc/header.inc.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tr&gt;
&lt;td width=&quot;3&quot;&gt;&lt;img src=&quot;img/headerleftsm.jpg&quot; width=&quot;3&quot; height=&quot;25&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
&lt;td class=&quot;headersm&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> hesk_showTopBar<span style="color: #009900;">&#40;</span><span style="color: #000088;">$hesklang</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'invalid_action'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/td&gt;
&lt;td width=&quot;3&quot;&gt;&lt;img src=&quot;img/headerrightsm.jpg&quot; width=&quot;3&quot; height=&quot;25&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&nbsp;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot;&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;smaller&quot;&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$hesk_settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'site_url'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; class=&quot;smaller&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$hesk_settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'site_title'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt; &gt;
&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$hesk_settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'hesk_url'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; class=&quot;smaller&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$hesk_settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'hesk_title'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;
&gt; <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$hesklang</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'invalid_action'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&nbsp;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&nbsp;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tr&gt;
	&lt;td width=&quot;7&quot; height=&quot;7&quot;&gt;&lt;img src=&quot;img/roundcornerslt.jpg&quot; width=&quot;7&quot; height=&quot;7&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
	&lt;td class=&quot;roundcornerstop&quot;&gt;&lt;/td&gt;
	&lt;td&gt;&lt;img src=&quot;img/roundcornersrt.jpg&quot; width=&quot;7&quot; height=&quot;7&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td class=&quot;roundcornersleft&quot;&gt;&amp;nbsp;&lt;/td&gt;
	&lt;td&gt;
&nbsp;
	&lt;p&gt;&amp;nbsp;&lt;/p&gt;
	&lt;p align=&quot;center&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Sorry, the ticket you have just sent already exists in our database.&quot;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/p&gt;
	&lt;p&gt;&amp;nbsp;&lt;/p&gt;
	&lt;p align=&quot;center&quot;&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$hesk_settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'hesk_url'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$hesk_settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'hesk_title'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/p&gt;
	&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&nbsp;
	&lt;/td&gt;
	&lt;td class=&quot;roundcornersright&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;&lt;img src=&quot;img/roundcornerslb.jpg&quot; width=&quot;7&quot; height=&quot;7&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
	&lt;td class=&quot;roundcornersbottom&quot;&gt;&lt;/td&gt;
	&lt;td width=&quot;7&quot; height=&quot;7&quot;&gt;&lt;img src=&quot;img/roundcornersrb.jpg&quot; width=&quot;7&quot; height=&quot;7&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span>HESK_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'inc/footer.inc.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

</li>
</ol>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2009%2F12%2F16%2Fhow-to-avoid-duplicate-ticket-content-saved-in-hesk-v2-1%2F&amp;title=How%20to%20Avoid%20Duplicate%20Ticket%20Content%20Saved%20in%20HESK%20v2.1" id="wpa2a_2"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2009/12/16/how-to-avoid-duplicate-ticket-content-saved-in-hesk-v2-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Know The Duplicate Records Based on The Same Value in a Field in MySQL Database</title>
		<link>http://www.openscriptsolution.com/2009/11/28/how-to-know-the-duplicate-records-based-on-the-same-value-in-a-field-in-mysql-database/</link>
		<comments>http://www.openscriptsolution.com/2009/11/28/how-to-know-the-duplicate-records-based-on-the-same-value-in-a-field-in-mysql-database/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 08:10:38 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[duplicate]]></category>
		<category><![CDATA[field]]></category>
		<category><![CDATA[record]]></category>
		<category><![CDATA[table]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=921</guid>
		<description><![CDATA[Have you ever wanted to know which record has duplicate content based on the same content in a field in MySQL database? This information will be get after you select the records and display them which one have the same content by groupping them by that field. Well, here is the script how you can [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever wanted to know which record has duplicate content based on the same content in a field in MySQL database? This information will be get after you select the records and display them which one have the same content by groupping them by that field. Well, here is the script how you can do that. <span id="more-921"></span></p>
<p>Suppose we have a table named <strong>mytable</strong> which has these following records inside:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">+----+-------+
| id | name  |
+----+-------+
|  1 | One   |
|  2 | One   |
|  3 | Two   |
|  4 | Two   |
|  5 | Two   |
|  6 | Three |
|  7 | Three |
|  8 | Three |
|  9 | Three |
| 10 | Four  |
| 11 | Five  |
+----+-------+
11 rows in set (0.00 sec)</pre></div></div>

<p>and you want to display which one has the duplicate content in the <strong>name</strong> filed become like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">+-------+---------+
| name  | howmany |
+-------+---------+
| Three |       4 |
| Two   |       3 |
| One   |       2 |
+-------+---------+
3 rows in set (0.00 sec)</pre></div></div>

<p>In the other words, we will display the value in <strong>name</strong> field which have more than one records, whereas, the records which do not the duplicate content, will be avoided (in this case the record which have the value in field <strong>name</strong>-nya: <strong>Four</strong> and <strong>Five</strong>).</p>
<p>Well, here is the SQL script to do make it came true:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">SELECT name, COUNT(name) AS howmany 
FROM `my_table`
GROUP BY name 
HAVING howmany &gt; 1
ORDER BY howmany DESC;</pre></div></div>

<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2009%2F11%2F28%2Fhow-to-know-the-duplicate-records-based-on-the-same-value-in-a-field-in-mysql-database%2F&amp;title=How%20to%20Know%20The%20Duplicate%20Records%20Based%20on%20The%20Same%20Value%20in%20a%20Field%20in%20MySQL%20Database" id="wpa2a_4"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2009/11/28/how-to-know-the-duplicate-records-based-on-the-same-value-in-a-field-in-mysql-database/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Avoid Duplicate Ticket Content in osTicket System</title>
		<link>http://www.openscriptsolution.com/2009/09/03/how-to-avoid-duplicate-ticket-content-in-osticket-system/</link>
		<comments>http://www.openscriptsolution.com/2009/09/03/how-to-avoid-duplicate-ticket-content-in-osticket-system/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 14:23:58 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[duplicate]]></category>
		<category><![CDATA[saved]]></category>
		<category><![CDATA[ticket]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=186</guid>
		<description><![CDATA[In osTicket System, when a new ticket created, it executes INSERT INTO SQL, and then displaying the &#8220;Thank You&#8221; page afterwards. Unfortunately, when client reload or refresh that page, then it will re-execute that SQL again, since the primary key for the ticket table is an ID of the ticket which has the auto-number field. [...]]]></description>
			<content:encoded><![CDATA[<p>In osTicket System, when a new ticket created, it executes <strong>INSERT INTO</strong> SQL, and then displaying the &#8220;Thank You&#8221; page afterwards. Unfortunately, when client reload or refresh that page, then it will re-execute that SQL again, since the primary key for the ticket table is an ID of the ticket which has the auto-number field. That is why the duplicate ticket content could be saved many times to the database, and it will look like a spam ticket for you. So here is the solution to avoid duplicate ticket content saved in database in osTicket System. You can apply this code for 1.6 RC4, 1.6 RC5, or 1.6 ST version. <span id="more-186"></span></p>
<p>First of all, open the <strong>\include\class.ticket.php</strong> file, and find this following code if your osTicket version is 1.6 RC4:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #666666; font-style: italic;">//Any error above is fatal.</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span></pre></div></div>

<p>or find this code if your osTicket version is 1.6 RC5 or 1.6 ST:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$ipaddress</span><span style="color: #339933;">=</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ip'</span><span style="color: #009900;">&#93;</span>?<span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ip'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REMOTE_ADDR'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>

<p>after that code, then add the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #666666; font-style: italic;">// Added by Masino Sinaga, April 13, 2009</span>
  <span style="color: #666666; font-style: italic;">// This code to avoid duplicate ticket-content saved in database</span>
  <span style="color: #666666; font-style: italic;">//</span>
  <span style="color: #666666; font-style: italic;">// For example: In existing condition, If user refresh/reload </span>
  <span style="color: #666666; font-style: italic;">// the page that show thank you message after client              </span>
  <span style="color: #666666; font-style: italic;">// open a new ticket, the new ticket would be created</span>
  <span style="color: #666666; font-style: italic;">// and that new record will be saved in database, even </span>
  <span style="color: #666666; font-style: italic;">// the new ticket has same content with the previous ticket.</span>
  <span style="color: #666666; font-style: italic;">// With this MOD, system will avoid the same ticket-content</span>
  <span style="color: #666666; font-style: italic;">// saved in database.</span>
  <span style="color: #666666; font-style: italic;">// </span>
  <span style="color: #666666; font-style: italic;">// In other words:</span>
  <span style="color: #666666; font-style: italic;">// Before: Duplicate ticket-content will be saved in database</span>
  <span style="color: #666666; font-style: italic;">// After : Avoid duplicate ticket-content in database</span>
  <span style="color: #000088;">$sql1</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'SELECT email FROM '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' 
         WHERE email='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'
         AND name='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span>Format<span style="color: #339933;">::</span><span style="color: #004000;">striptags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'
         AND subject='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span>Format<span style="color: #339933;">::</span><span style="color: #004000;">striptags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'subject'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'
         AND phone=&quot;'</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span>Format<span style="color: #339933;">::</span><span style="color: #004000;">striptags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'phone'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;
         AND ip_address='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$ipaddress</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'        
         AND source='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$source</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$sql2</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'SELECT ticket_id FROM '</span><span style="color: #339933;">.</span>TICKET_MESSAGE_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' 
         WHERE message='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span>Format<span style="color: #339933;">::</span><span style="color: #004000;">striptags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$res1</span><span style="color: #339933;">=</span>db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$res2</span><span style="color: #339933;">=</span>db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$res1</span> <span style="color: #339933;">&amp;&amp;</span> db_num_rows<span style="color: #009900;">&#40;</span><span style="color: #000088;">$res1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$res2</span> <span style="color: #339933;">&amp;&amp;</span> db_num_rows<span style="color: #009900;">&#40;</span><span style="color: #000088;">$res2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'err'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Data already exists in database!&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #666666; font-style: italic;">// Added by Masino Sinaga, April 13, 2009</span></pre></div></div>

<p>From that code above, assuming that the duplicate content ticket are checked based on the same data in<br />
- email<br />
- name<br />
- subject<br />
- phone<br />
- ip_address<br />
- source</p>
<p>You may customize those parameters based on your needs. For example, if you want to avoid the &#8220;ip_address&#8221; of your client since this IP Address could be changed each time your client refresh or reload the thank you page (dynamic IP), then you may not use this &#8220;ip_address&#8221; and remove it from that SQL above.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2009%2F09%2F03%2Fhow-to-avoid-duplicate-ticket-content-in-osticket-system%2F&amp;title=How%20to%20Avoid%20Duplicate%20Ticket%20Content%20in%20osTicket%20System" id="wpa2a_6"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2009/09/03/how-to-avoid-duplicate-ticket-content-in-osticket-system/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>The .htaccess File Content When Permalink Activated</title>
		<link>http://www.openscriptsolution.com/2009/08/25/the-htaccess-file-content-when-permalink-activated/</link>
		<comments>http://www.openscriptsolution.com/2009/08/25/the-htaccess-file-content-when-permalink-activated/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 03:26:53 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[permalink]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[url]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=72</guid>
		<description><![CDATA[I just wondered what would be happened when Permalink feature in WordPress is being activated? Detail technical question is: &#8220;What is the truly identifer that makes me sure this feature is being activated?&#8221; For those who do not know what Permalink is, it is a feature in WordPress that allows you to change the URL [...]]]></description>
			<content:encoded><![CDATA[<p>I just wondered what would be happened when <strong>Permalink</strong> feature in WordPress is being activated? Detail technical question is: &#8220;What is the truly identifer that makes me sure this feature is being activated?&#8221; For those who do not know what Permalink is, it is a feature in WordPress that allows you to change the URL style become SEO friendly. For example, default URL is: http://www.yourdomainname.com/index.php?p=123 then when Permalink activated, that URL will become http://www.yourdomainname.com/2009/08/21/sample-post/.  Well, here is the answer for this. <span id="more-72"></span></p>
<p>When you activate Permalink feature from admin panel in Settings section for the very first time, then your WordPress will create an .htaccess file located on your web root directory (assuming this file does not already exist before). This .htaccess file contains of the code as you can see below:</p>
<pre># BEGIN WordPress
&lt;IfModule mod_rewrite.c&gt;
RewriteEngine On
RewriteBase /yourdomainnamehere/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /yourdomainnamehere/index.php [L]
&lt;/IfModule&gt;

# END WordPress</pre>
<p>Please note that <strong>yourdomainhere</strong> is the name of your domain.</p>
<p>When you deactivate this Permalink feature, then this .htaccess file would not be removed, but the main code above would be removed. It becomes like this:</p>
<pre># BEGIN WordPress

# END WordPress</pre>
<p>This has been tested in WordPress version 2.8.4.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2009%2F08%2F25%2Fthe-htaccess-file-content-when-permalink-activated%2F&amp;title=The%20.htaccess%20File%20Content%20When%20Permalink%20Activated" id="wpa2a_8"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2009/08/25/the-htaccess-file-content-when-permalink-activated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Make a Multi-Language Web Content Page</title>
		<link>http://www.openscriptsolution.com/2009/08/21/how-to-make-a-multi-language-web-content-page/</link>
		<comments>http://www.openscriptsolution.com/2009/08/21/how-to-make-a-multi-language-web-content-page/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 16:32:05 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[bahasa]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[halaman]]></category>
		<category><![CDATA[isi]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[multibahasa]]></category>
		<category><![CDATA[multilanguage]]></category>
		<category><![CDATA[page]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[qTranslate]]></category>
		<category><![CDATA[situs]]></category>
		<category><![CDATA[tab]]></category>
		<category><![CDATA[translasi]]></category>
		<category><![CDATA[translate]]></category>
		<category><![CDATA[translation]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=8</guid>
		<description><![CDATA[Today was the first time I used WordPress for building this website. I have been looking for a CMS that support for multi-language web content page. I need that each time my visitor read an article in full-mode and they choose one of the languages, then the content of that article will be translated to [...]]]></description>
			<content:encoded><![CDATA[<p>Today was the first time I used WordPress for building this website. I have been looking for a CMS that support for multi-language web content page. I need that each time my visitor read an article in full-mode and they choose one of the languages, then the content of that article will be translated to the new language. <span id="more-8"></span></p>
<p>Then after serveral hours surfing through the Internet, I found a WordPress plugins that has the ability to switch/translate the content of a page to the selected language. The plugins&#8217; name is <strong>qTranslate</strong> that you can find from here: <a title="qTranslate plugins" href="http://wordpress.org/extend/plugins/qtranslate/" target="_blank">http://wordpress.org/extend/plugins/qtranslate/</a> . I downloaded qTranslate version 2.4.3 that compatible with WordPress version 2.8.4 or later.</p>
<p>Incredible! This plugins is really useful as I have been looking for. The most important thing that I like from this plugins is: user will become easier while creating a new article, since there was new tabs as many as the language that being enabled or used. Therefore, we can switch from one to another tab to translate to the new language only from one form.</p>
<p>Another advantage that you get when you use this plugins is: every post for all active languages will be saved in one record. Thus, this will keep your database size smaller, than if every post for each language will be saved in separate record.</p>
<p>But, it has small weakness, especially if you deactivate this plugins after you have some posts that added or updated with this multi-language feature. The tag as I mentioned above will be displayed since it was located in one field. Therefore, if you want to use or currently using this qTranslate plugins, please reconsider not to deactivate it after you have posts that made with this plugins. Except if you want to spend your time to edit the field contains of that separator tag in database.</p>
<p>Now, I am starting to use WordPress, and had fallen in love with it since I knew and found this qTranslate plugins.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2009%2F08%2F21%2Fhow-to-make-a-multi-language-web-content-page%2F&amp;title=How%20to%20Make%20a%20Multi-Language%20Web%20Content%20Page" id="wpa2a_10"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2009/08/21/how-to-make-a-multi-language-web-content-page/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
