<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.3" -->
<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/"
	>

<channel>
	<title>Benjo's Reign = Brain :)</title>
	<link>http://breign.com</link>
	<description>About my brains, my lifes, ideas, works. About computers. Jokes and dreams, reigns and realms...</description>
	<pubDate>Sat, 22 Nov 2008 00:13:58 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
	<language>en</language>
			<item>
		<title>permanently delete data</title>
		<link>http://breign.com/2008/11/22/permanently-delete-data/</link>
		<comments>http://breign.com/2008/11/22/permanently-delete-data/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 23:50:50 +0000</pubDate>
		<dc:creator>Benjo</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<category><![CDATA[thoughts]]></category>

		<category><![CDATA[windows]]></category>

		<category><![CDATA[deleting files]]></category>

		<category><![CDATA[gnu]]></category>

		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://breign.com/2008/11/22/permanently-delete-data/</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>Some of you are wondering if files and directory structure as well as contents of them can be restored if deleted from the computer. Sure, but&#8230; not if you delete them knowing what you do <img  src= 'http://breign.com/wp-includes/images/smilies/icon_smile.gif'  alt= ':)'  class= 'wp-smiley' title="photo, permanently delete data - post on breign" /> </p>
<p>GNU and other free and powerful programs are the best choice for permanently deleting data ( for those which burning the disk is a bit extreme option ).</p>
<p align="left"><img  src= "http://breign.com/wp-content/uploads/2008/11/pakistan_disk_solution20087312205461.thumbnail.jpg"  alt= "Data on disk"  align= "left" title="photo, permanently delete data - post on breign" />On NTFS or FAT file systems recovering is quite easy and with that security can be compromised. On other file systems recovering with a bit of laboratory treatment can also be achieved.</p>
<p align="left">Use programs such as <a href="http://www.gnu.org/software/coreutils/manual/html_node/shred-invocation.html">shred </a>for example to destroy data. Shred not just unlinks inode from the file system table, it also overwrite file you want to delete with some other data firstly. So bits of data doesn&#8217;t get just lost, they firstly get overwritten and then lost. Consider printing some text on your highly classified A4 paper before &#8220;grizly&#8221; shreds it into pieces.</p>
<p>For more workload and more professional approach, I used <a href="http://www.dban.org/">Dban boot and nuke</a> to wipe whole drives.</p>
<p>Example in bash, first create 10MB file, then shred it <img  src= 'http://breign.com/wp-includes/images/smilies/icon_smile.gif'  alt= ':)'  class= 'wp-smiley' title="photo, permanently delete data - post on breign" /> </p>

<div class="wp_syntax"><div class="code"><pre class="bash">ludo:~$ <span style="color: #c20cb9; font-weight: bold;">dd</span> <span style="color: #007800;">if=</span><span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>zero <span style="color: #007800;">of=</span>10MB.txt <span style="color: #007800;">bs=</span>10M <span style="color: #007800;">count=</span><span style="color: #000000;">1</span>
<span style="color: #000000;">1</span><span style="color: #000000;">+0</span> records <span style="color: #000000; font-weight: bold;">in</span>
<span style="color: #000000;">1</span><span style="color: #000000;">+0</span> records out
<span style="color: #000000;">10485760</span> bytes <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">10</span> MB<span style="color: #7a0874; font-weight: bold;">&#41;</span> copied, <span style="color: #000000;">0.184</span> s, <span style="color: #000000;">57.0</span> MB<span style="color: #000000; font-weight: bold;">/</span>s
ludo:~$ <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">find</span> -name <span style="color: #ff0000;">&quot;10MB.txt&quot;</span> -exec <span style="color: #c20cb9; font-weight: bold;">shred</span> -fuvxz -n1 <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
<span style="color: #c20cb9; font-weight: bold;">shred</span>: .<span style="color: #000000; font-weight: bold;">/</span>10MB.txt: pass <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>random<span style="color: #7a0874; font-weight: bold;">&#41;</span>...
<span style="color: #c20cb9; font-weight: bold;">shred</span>: .<span style="color: #000000; font-weight: bold;">/</span>10MB.txt: pass <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">000000</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>...
<span style="color: #c20cb9; font-weight: bold;">shred</span>: .<span style="color: #000000; font-weight: bold;">/</span>10MB.txt: removing
<span style="color: #c20cb9; font-weight: bold;">shred</span>: .<span style="color: #000000; font-weight: bold;">/</span>10MB.txt: renamed to .<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">00000000</span>
<span style="color: #c20cb9; font-weight: bold;">shred</span>: .<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">00000000</span>: renamed to .<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0000000</span>
<span style="color: #c20cb9; font-weight: bold;">shred</span>: .<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0000000</span>: renamed to .<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">000000</span>
<span style="color: #c20cb9; font-weight: bold;">shred</span>: .<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">000000</span>: renamed to .<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">00000</span>
<span style="color: #c20cb9; font-weight: bold;">shred</span>: .<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">00000</span>: renamed to .<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0000</span>
<span style="color: #c20cb9; font-weight: bold;">shred</span>: .<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0000</span>: renamed to .<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">000</span>
<span style="color: #c20cb9; font-weight: bold;">shred</span>: .<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">000</span>: renamed to .<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">00</span>
<span style="color: #c20cb9; font-weight: bold;">shred</span>: .<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">00</span>: renamed to .<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span>
<span style="color: #c20cb9; font-weight: bold;">shred</span>: .<span style="color: #000000; font-weight: bold;">/</span>10MB.txt: removed</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://breign.com/2008/11/22/permanently-delete-data/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Aliens vs Civilization</title>
		<link>http://breign.com/2008/10/04/alien_contact/</link>
		<comments>http://breign.com/2008/10/04/alien_contact/#comments</comments>
		<pubDate>Sat, 04 Oct 2008 22:41:16 +0000</pubDate>
		<dc:creator>Benjo</dc:creator>
		
		<category><![CDATA[this blog]]></category>

		<category><![CDATA[thoughts]]></category>

		<category><![CDATA[weekends]]></category>

		<guid isPermaLink="false">http://breign.com/2008/10/04/alien_contact/</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>As told by Blossom Goodchild, 14. October stands for first global contact mission with EXTRATERRESTRIAL beings. The source on <a href="http://www.escapetheillusion.com/blog/2008/09/blossom-goodchild-clarifies-october-14th-first-contact/" title="Escape the Ilussion">Escape the Illusion</a> expressed by her surely makes history a joke. So we decided to make a LAN PARTY 1 month after the first contact (14. 11. 2008 that is). Survivors will execute each other in</p>
<p><a href="http://breign.com/2008/10/04/alien_contact/alien-arena-2/" rel="attachment wp-att-52" title="Alien arena"><img  src= "http://breign.com/wp-content/uploads/2008/10/images.thumbnail.jpg"  alt= "Alien arena" title="photo, Aliens vs Civilization - post on breign" /></a><a href="http://icculus.org/alienarena/rpa/aquire.html" title="Alien Arena"> ALIEN ARENA </a><a href="http://breign.com/wp-content/uploads/2008/10/alien_arena_2007_pics_1.jpg" title="Alien arena"><img  src= "http://breign.com/wp-content/uploads/2008/10/alien_arena_2007_pics_1.thumbnail.jpg"  alt= "Alien arena" title="photo, Aliens vs Civilization - post on breign" /></a></p>
<p>fixed in Kmetski dom, Beričevo, Slovenia, Earth&#8230;</p>
<p>Those who want to rule the planet are invited. Thanks to Nace who brought the idea.</p>
<p>Duke Nukem is also invited <img  src= 'http://breign.com/wp-includes/images/smilies/icon_smile.gif'  alt= ':)'  class= 'wp-smiley' title="photo, Aliens vs Civilization - post on breign" /> </p>
<p>P.S. <strong>C</strong><a href="http://video.google.com/videoplay?docid=7065205277695921912" title="Zeitgeist 2">heck Zeitgeist II</a></p>
]]></content:encoded>
			<wfw:commentRss>http://breign.com/2008/10/04/alien_contact/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The streets of Bangalore I</title>
		<link>http://breign.com/2008/07/16/the-streets-of-bangalore-i/</link>
		<comments>http://breign.com/2008/07/16/the-streets-of-bangalore-i/#comments</comments>
		<pubDate>Wed, 16 Jul 2008 19:53:56 +0000</pubDate>
		<dc:creator>Benjo</dc:creator>
		
		<category><![CDATA[traveling]]></category>

		<category><![CDATA[bangalore]]></category>

		<category><![CDATA[roads]]></category>

		<category><![CDATA[streets]]></category>

		<guid isPermaLink="false">http://breign.com/2008/07/16/the-streets-of-bangalore-i/</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>Ones that know me also know that despite I originate from village, I&#8217;m really a street mate. The streets in Bangalore are very different compared to European ones. First, there is order. No order! The one which horns the loudest gets advantage in driving. Roads are&#8230; well, check out the pictures and ask me something through the comments. I&#8217;m really tired so&#8230; I&#8217;ll get back later.</p>
<p><a href="http://breign.com/wp-content/uploads/2008/07/dsc00001.JPG" title="dsc00001.JPG"><img  src= "http://breign.com/wp-content/uploads/2008/07/dsc00001.thumbnail.JPG"  alt= "dsc00001.JPG" title="photo, The streets of Bangalore I - post on breign" /></a><a href="http://breign.com/wp-content/uploads/2008/07/dsc00003.JPG" title="dsc00003.JPG"><img  src= "http://breign.com/wp-content/uploads/2008/07/dsc00003.thumbnail.JPG"  alt= "dsc00003.JPG" title="photo, The streets of Bangalore I - post on breign" /></a><a href="http://breign.com/wp-content/uploads/2008/07/dsc00008.JPG" title="dsc00008.JPG"><img  src= "http://breign.com/wp-content/uploads/2008/07/dsc00008.thumbnail.JPG"  alt= "dsc00008.JPG" title="photo, The streets of Bangalore I - post on breign" /></a><a href="http://breign.com/wp-content/uploads/2008/07/dsc00018.JPG" title="dsc00018.JPG"><img  src= "http://breign.com/wp-content/uploads/2008/07/dsc00018.thumbnail.JPG"  alt= "dsc00018.JPG" title="photo, The streets of Bangalore I - post on breign" /></a><a href="http://breign.com/wp-content/uploads/2008/07/dsc00024.JPG" title="dsc00024.JPG"><img  src= "http://breign.com/wp-content/uploads/2008/07/dsc00024.thumbnail.JPG"  alt= "dsc00024.JPG" title="photo, The streets of Bangalore I - post on breign" /></a><a href="http://breign.com/wp-content/uploads/2008/07/dsc00010.JPG" title="dsc00010.JPG"><img  src= "http://breign.com/wp-content/uploads/2008/07/dsc00010.thumbnail.JPG"  alt= "dsc00010.JPG" title="photo, The streets of Bangalore I - post on breign" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://breign.com/2008/07/16/the-streets-of-bangalore-i/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ljubljana -&gt; paris -&gt; bangalore</title>
		<link>http://breign.com/2008/07/14/ljubljana-paris-bangalore/</link>
		<comments>http://breign.com/2008/07/14/ljubljana-paris-bangalore/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 22:20:28 +0000</pubDate>
		<dc:creator>Benjo</dc:creator>
		
		<category><![CDATA[this blog]]></category>

		<category><![CDATA[traveling]]></category>

		<guid isPermaLink="false">http://breign.com/2008/07/14/ljubljana-paris-bangalore/</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>The destination has been reached. Roman, Samo and me started the trip to India today at 7:20 from Brnik, Ljubljana. In the couple of hours, we were in Paris, switching plane to Bangalore, India.</p>
<p><a href="http://breign.com/wp-content/uploads/2008/07/dsc00057.JPG" title="cloudy view from the airplane"><img  src= "http://breign.com/wp-content/uploads/2008/07/dsc00057.thumbnail.JPG"  alt= "cloudy view from the airplane" title="photo, ljubljana -> paris -> bangalore - post on breign" /></a></p>
<p>We were traveling for the whole day, making plans, discussing things and taking naps in the plane - brand new Airbus A330 with LCD equipped chairs, rich movies, games, GEO AIR route map and live camera view from the front of airplane. Now, I&#8217;m close to falling asleep in my room 216 in Royal Orchid Hotel in the center of Bangalore&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://breign.com/2008/07/14/ljubljana-paris-bangalore/feed/</wfw:commentRss>
		</item>
		<item>
		<title>how to describe the universe. What is Universe?</title>
		<link>http://breign.com/2008/07/03/how-to-describe-the-universe-what-is-universe/</link>
		<comments>http://breign.com/2008/07/03/how-to-describe-the-universe-what-is-universe/#comments</comments>
		<pubDate>Wed, 02 Jul 2008 23:12:45 +0000</pubDate>
		<dc:creator>Benjo</dc:creator>
		
		<category><![CDATA[database]]></category>

		<category><![CDATA[flash]]></category>

		<category><![CDATA[friends]]></category>

		<category><![CDATA[ideas]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[programing]]></category>

		<category><![CDATA[this blog]]></category>

		<category><![CDATA[thoughts]]></category>

		<category><![CDATA[web]]></category>

		<category><![CDATA[weekends]]></category>

		<category><![CDATA[windows]]></category>

		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://breign.com/2008/07/03/how-to-describe-the-universe-what-is-universe/</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>easy job, if you are from outer space <img  src= 'http://breign.com/wp-includes/images/smilies/icon_smile.gif'  alt= ':)'  class= 'wp-smiley' title="photo, how to describe the universe. What is Universe? - post on breign" /> </p>
<p>Universe is group of objects, data, waves,&#8230; mashed and revoked as the constantly changing elemental parts of its makeofs. But the point is, that the Universe is limited in between terms of +<strong>π and -</strong><strong>π</strong>. Math.PI. Extract all amount of data between 3.141592653589&#8230; and you surely win a Loto game.</p>
<p>The terms space, universe&#8230; are nothing more than true and false evaluated rules and knowledges learned trough lives of civilizations. And yes, lives not times as time is nothing more than local counting seconds or whatever you count. Times really do not change. Life therefore is the maker of the universe, as it is a part of it. Finally one loops their minds with all possible words, froms,.. thoughts. Or nothing <img  src= 'http://breign.com/wp-includes/images/smilies/icon_smile.gif'  alt= ':)'  class= 'wp-smiley' title="photo, how to describe the universe. What is Universe? - post on breign" /> </p>
<p><strong>Everything and Nothing Between +π and -π is the Universe.</strong><strong> </strong></p>
<p><a href="http://breign.com/wp-content/uploads/2008/07/silhueta.gif" title="breign"><img  src= "http://breign.com/wp-content/uploads/2008/07/silhueta.thumbnail.gif"  alt= "breign"  height= "66"  width= "67" title="photo, how to describe the universe. What is Universe? - post on breign" /></a> Breign</p>
]]></content:encoded>
			<wfw:commentRss>http://breign.com/2008/07/03/how-to-describe-the-universe-what-is-universe/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Sameks model agency</title>
		<link>http://breign.com/2008/06/18/sameks-model-agency/</link>
		<comments>http://breign.com/2008/06/18/sameks-model-agency/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 22:23:08 +0000</pubDate>
		<dc:creator>Benjo</dc:creator>
		
		<category><![CDATA[flash]]></category>

		<category><![CDATA[friends]]></category>

		<category><![CDATA[ideas]]></category>

		<category><![CDATA[programing]]></category>

		<category><![CDATA[web]]></category>

		<category><![CDATA[work]]></category>

		<category><![CDATA[girls]]></category>

		<category><![CDATA[models]]></category>

		<category><![CDATA[sites]]></category>

		<guid isPermaLink="false">http://breign.com/2008/06/18/sameks-model-agency/</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>My bestm8 Sameks company also provides model girls for variety of events - from simple ones to avantgarde shows.</p>
<p>The technology I used for creation of website was the flash book I developed about 3 years ago. And with a little Kostas help with design and Sameks aesthetic eye <a href="http://root.si" title="root.si girl models" target="_blank">this is what was born</a>.</p>
<p>I believe you won&#8217;t be disappointed with checking out the site which will be timely updated by new models.</p>
]]></content:encoded>
			<wfw:commentRss>http://breign.com/2008/06/18/sameks-model-agency/feed/</wfw:commentRss>
		</item>
		<item>
		<title>php system script for maintaining mysql databases and tables</title>
		<link>http://breign.com/2008/06/12/php-system-script-for-maintaining-mysql-databases-and-tables/</link>
		<comments>http://breign.com/2008/06/12/php-system-script-for-maintaining-mysql-databases-and-tables/#comments</comments>
		<pubDate>Thu, 12 Jun 2008 19:22:26 +0000</pubDate>
		<dc:creator>Benjo</dc:creator>
		
		<category><![CDATA[database]]></category>

		<category><![CDATA[ideas]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[programing]]></category>

		<category><![CDATA[windows]]></category>

		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://breign.com/2008/06/12/php-system-script-for-maintaining-mysql-databases-and-tables/</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>This is one of the php system scripts I wrote and would like to share. It can be extended but it already does its basic stuff - mysql maintenance with email notification.</p>
<p>Use it in cron and have a peace with tables, indexes and keys <img  src= 'http://breign.com/wp-includes/images/smilies/icon_smile.gif'  alt= ':)'  class= 'wp-smiley' title="photo, php system script for maintaining mysql databases and tables - post on breign" /> </p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// which databases to maintain</span>
<span style="color: #000033;">$databases</span>  <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;provider wp subversion mysql&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000033;">$returnval</span> <span style="color: #339933;">=</span> maintain_mysql<span style="color: #009900;">&#40;</span><span style="color: #000033;">$databases</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">@</span><span style="color: #990000;">mail</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;root&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;mysql database maintainer&quot;</span><span style="color: #339933;">,</span> <span style="color: #000033;">$returnval</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/**
* mysql table maintainer - optimizes and rebuilds indexes on mysql tables
*
* @author benjamin.povirk@***** 3.1.07
* @return string
* @param databases to maintain
*/</span>
<span style="color: #000000; font-weight: bold;">function</span> maintain_mysql <span style="color: #009900;">&#40;</span><span style="color: #000033;">$databases</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #000033;">$database</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">,</span> <span style="color: #000033;">$databases</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000033;">$database</span> <span style="color: #b1b100;">as</span> <span style="color: #000033;">$db</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000033;">$returnval</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;maintenance on all tables in &quot;</span><span style="color: #339933;">.</span><span style="color: #000033;">$db</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; started<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Connecting, selecting database</span>
<span style="color: #000033;">$link</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'YOUR_USER_HERE'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'YOUR_PASSWORD_HERE'</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Could not connect: '</span> <span style="color: #339933;">.</span> <span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$db</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Could not select database '</span><span style="color: #339933;">.</span><span style="color: #000033;">$db</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//repair and optimize all tables in current database</span>
<span style="color: #000033;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SHOW TABLES&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000033;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$query</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Query failed: '</span> <span style="color: #339933;">.</span> <span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000033;">$line</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_array</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$result</span><span style="color: #339933;">,</span> MYSQL_ASSOC<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000033;">$line</span> <span style="color: #b1b100;">as</span> <span style="color: #000033;">$col_value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000033;">$lock</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;LOCK TABLE &quot;</span><span style="color: #339933;">.</span><span style="color: #000033;">$col_value</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; WRITE&quot;</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Query failed: '</span> <span style="color: #339933;">.</span> <span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000033;">$optimize</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;OPTIMIZE TABLE &quot;</span><span style="color: #339933;">.</span><span style="color: #000033;">$col_value</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Query failed: '</span> <span style="color: #339933;">.</span> <span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000033;">$repair</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;REPAIR TABLE &quot;</span><span style="color: #339933;">.</span><span style="color: #000033;">$col_value</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; QUICK&quot;</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Query failed: '</span> <span style="color: #339933;">.</span> <span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000033;">$unlock</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;UNLOCK TABLES&quot;</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Query failed: '</span> <span style="color: #339933;">.</span> <span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #990000;">mysql_free_result</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">mysql_free_result</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$repair</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">mysql_free_result</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$optimize</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Closing connection</span>
<span style="color: #990000;">mysql_close</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$link</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000033;">$returnval</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;maintenance on all tables in &quot;</span><span style="color: #339933;">.</span><span style="color: #000033;">$db</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; finished successfuly<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">return</span> <span style="color: #000033;">$returnval</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://breign.com/2008/06/12/php-system-script-for-maintaining-mysql-databases-and-tables/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
