<?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>Erik Pöhler &#187; PHP</title>
	<atom:link href="http://contactsheet.de/category/php/feed" rel="self" type="application/rss+xml" />
	<link>http://contactsheet.de</link>
	<description></description>
	<lastBuildDate>Thu, 27 May 2010 11:00:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>WordPress RSS-Combiner 1.1</title>
		<link>http://contactsheet.de/wordpress-rss-combiner-updated.xhtml</link>
		<comments>http://contactsheet.de/wordpress-rss-combiner-updated.xhtml#comments</comments>
		<pubDate>Mon, 19 Apr 2010 07:53:17 +0000</pubDate>
		<dc:creator>Erik Poehler</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://contactsheet.de/?p=1424</guid>
		<description><![CDATA[Merge several feeds into a single&#160;ressource

The WordPress RSS-Combiner is intended to merge several Atom, RSS, RDF, etc. Feeds into one single stream. This might be useful for you if you have several social network accounts like Twitter, SoundCloud, Last.fm, a flickr photostream, etc. that you want to include in your weblogs&#8217;&#160;RSS-Feed.
Changes since&#160;v1.0:
After a bit, well [...]]]></description>
			<content:encoded><![CDATA[<h3>Merge several feeds into a single&nbsp;ressource</h3>
<p><img alt="" src="http://contactsheet.de/wp-content/uploads/2010/04/rss-combiner.jpg" title="WordPress RSS-Combiner" class="alignleft" width="500" height="65" /><br />
The WordPress RSS-Combiner is intended to merge several Atom, RSS, RDF, etc. Feeds into one single stream. This might be useful for you if you have several social network accounts like Twitter, SoundCloud, Last.fm, a flickr photostream, etc. that you want to include in your weblogs&#8217;&nbsp;RSS-Feed.</p>
<h3>Changes since&nbsp;v1.0:</h3>
<p>After a bit, well actually it&#8217;s been around 2.5 years, I updated my RSS-Combiner Plugin for WordPress this weekend. There are mostly minor changes, and the final, combined feed output can still be improved a bit (which is on my todo list). But for now there are some enhancements&nbsp;made:</p>
<ul>
<li>the SimplePie caching is activated so the plugin uses less server-side&nbsp;ressources.</li>
<li>the admin page was updated so that it integrates better into the WordPress admin&nbsp;theme.</li>
<li>Limiting the number of items in the output feed was&nbsp;implemented.</li>
<li>Changing the length of the articles content and description was&nbsp;implemented.</li>
<li>Some warnings, that showed on the plugins first run were&nbsp;fixed.</li>
</ul>
<h3>Download &#038;&nbsp;Demo</h3>
<p><a href="http://wp-rss-combiner.googlecode.com/files/RSS-Combiner%20v1.1.tar.gz">WordPress RSS-Combiner v1.1</a> (tar.gz archive, 170KB)<br />
See the <a href="http://contactsheet.de/rss2.xml">demo&nbsp;feed</a>.</p>
<h3>Instructions</h3>
<ul>
<li>Download and unpack the&nbsp;archive.</li>
<li>Upload its contents to the <samp>/wp-content/plugins/</samp> folder of your WordPress&nbsp;installation.</li>
<li>Make sure the folder <samp>/wp-content/plugins/rss-combiner/simplepie/cache</samp> is writeable by the&nbsp;server.</li>
<li>Activate the plugin, and add some input&nbsp;feeds.</li>
<li>Check that it&#8217;s working by accessing <samp>www.mydomain.com/blog/?feed=combined-rss2</samp> in your&nbsp;browser.</li>
<li>Finally, you&#8217;ll want to link to the new combined feed. (eg: <samp>&lt;link rel="alternate" type="application/rss+xml" title="WordPress &raquo; Feed" href="http://mydomain.com/blog/rss2.php" /></samp>)</li>
<li>If you need a file-like URL (parameter-free) for the generated feed, you could optionally add something like this to your WordPress .htaccess file:
<p><code><br />
&lt;IfModule mod_rewrite.c><br />
RewriteEngine On<br />
RewriteRule rss2.xml ?feed=combined-rss2 [L]<br />
&lt;/IfModule></code></p>
<p>(this should be placed outside of the WordPress&nbsp;block)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://contactsheet.de/wordpress-rss-combiner-updated.xhtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DaDaBIK Revised</title>
		<link>http://contactsheet.de/dadabik-revised.xhtml</link>
		<comments>http://contactsheet.de/dadabik-revised.xhtml#comments</comments>
		<pubDate>Mon, 08 Mar 2010 09:43:55 +0000</pubDate>
		<dc:creator>Erik Poehler</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://contactsheet.de/?p=1407</guid>
		<description><![CDATA[DaDaBik is a &#8220;Database Interfaces Kreator&#8221;, which helps you building web-interfaces to a database easily. It has been developed by Eugenio Tacchini. Since this is a rather old, yet working, piece of software, no wonder there&#8217;s a lot of PHP4 involved&#160;:O
I did a redesign of the template in late 2009 and took some time this [...]]]></description>
			<content:encoded><![CDATA[<p>DaDaBik is a &#8220;Database Interfaces Kreator&#8221;, which helps you building web-interfaces to a database easily. It has been developed by Eugenio Tacchini. Since this is a rather old, yet working, piece of software, no wonder there&#8217;s a lot of PHP4 involved&nbsp;:O</p>
<p>I did a redesign of the template in late 2009 and took some time this weekend to get it polished up a bit. What I like about DaDaBIK is that you can provide data editing functionality and are able to adjust the look to a clients CI quickly (just replace one logo and change some colours - the PSD is&nbsp;included).</p>
<ul>
<li><a href="http://erikpoehler.com/wp-content/uploads/2010/03/screenshot-dadabik-insert.jpg"><img alt="Insert data" src="http://erikpoehler.com/wp-content/uploads/2010/03/screenshot-dadabik-insert-small.jpg" title="Insert data" width="150" height="139" /></a></li>
<li><a href="http://erikpoehler.com/wp-content/uploads/2010/03/screenshot-dadabik-login.jpg"><img alt="Login" src="http://erikpoehler.com/wp-content/uploads/2010/03/screenshot-dadabik-login-small.jpg" title="Login" width="150" height="48" /></a></li>
<li><a href="http://erikpoehler.com/wp-content/uploads/2010/03/screenshot-dadabik-main.jpg"><img alt="Listing" src="http://erikpoehler.com/wp-content/uploads/2010/03/screenshot-dadabik-main-small.jpg" title="Listing" width="150" height="76" /></a></li>
</ul>
<p>Although the code of DaDaBIK is from another pre-PHP5-decade, I didn&#8217;t see much of a need to change the inner workings of DaDaBIK. So what I did is <em>putting some fresh paint on it using CSS</em>. Since there is no template-engine imlemented into DaDaBik, I had to edit core files here and there for simple markup changes. So! The only thing that makes sense is to offer one complete package here: DaDaBik itself and the new design&nbsp;included.</p>
<p><strong>Installation:</strong><br />
If you&#8217;re about to use DaDaBIK for the first time, you might want to take a look at www.dadabik.org as well, since there&#8217;s a documentation online giving you more insight. Anyways, the setup is quite&nbsp;easy:</p>
<ol>
<li>Download <a href="#download">the&nbsp;archive</a></li>
<li>Extract the files, and upload the <samp>dadabik</samp> folder to your&nbsp;server.</li>
<li>Edit the file <samp>includes/config.php</samp> and enter your DB settings according to your&nbsp;setup.</li>
<li>Open up the URL&nbsp;<samp>yourdomain.com/pathtodadabik/install.php</samp>.</li>
<li>DaDaBIK will now set up some internal tables and you&#8217;re&nbsp;done.</li>
<li>DaDaBIKs default username is root and the password is&nbsp;letizia</li>
</ol>
<p><strong>Notes:</strong><br />
It&#8217;s important that you have created the database, you entered in the config.php file first. (for example using phpmyadmin).<br />
If you want to, you can use a pre-made MySQL table structure with some dummy entries that I have included in the zip: just copy and paste the contents of <samp>dadabik-example-db.sql</samp> into the SQL window of the new database in&nbsp;phpmyadmin.</p>
<p>Once you&#8217;re done with the basic installation, head over to the <samp>admin.php</samp> which gives you all the admin options you need to include/remove secific tables and set human readable aliases for the&nbsp;tables.</p>
<p>The last step to perfect interfaces is to click the Interface configurator link on that admin page.<br />
The configurator gives you all the options to customize the appearance, set default values, define which fields are mandatory, etc.&nbsp;etc.</p>
<p><strong>Demo:</strong><br />
Check out <a href="http://ddbdemo.erikpoehler.com/login.php">the demo</a> of DaDaBIK with the new design.<br />
You&#8217;ll have to enter username <samp>test</samp> and password: <samp>test@ddbdemo</samp> to enter.<br />
(please keep in mind that a lot of features are disabled in the demo, since the test-user doesn&#8217;t have&nbsp;admin-rights.)</p>
<p><strong id="download">Download:</strong><br />
<a href="http://websvn.erikpoehler.com/dl.php?repname=DaDaBik+Revised&#038;path=%2Ftrunk%2F&#038;peg=2&#038;isdir=1">DaDaBIK Revised 1.0</a> (1MB,&nbsp;tar.gz)</p>
<p><strong>Subversion Repository:</strong><br />
There is a <a href="http://websvn.erikpoehler.com/listing.php?repname=DaDaBik+Revised">Subversion repository</a> in case you want to make use of the open source idea or really want to see some old school PHP4&nbsp;:O</p>
<p><strong>Changelog:</strong><br />
2010-03-09 initial release of DaDaBIK&nbsp;Revised</p>
]]></content:encoded>
			<wfw:commentRss>http://contactsheet.de/dadabik-revised.xhtml/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP ZendCon 09</title>
		<link>http://contactsheet.de/php-zendcon-09.xhtml</link>
		<comments>http://contactsheet.de/php-zendcon-09.xhtml#comments</comments>
		<pubDate>Fri, 16 Oct 2009 08:40:04 +0000</pubDate>
		<dc:creator>Erik Poehler</dc:creator>
				<category><![CDATA[Los Angeles]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Termine]]></category>
		<category><![CDATA[Webwork]]></category>

		<guid isPermaLink="false">http://erikpoehler.com/?p=1372</guid>
		<description><![CDATA[ Excitement. Excitement. Letzter Tag im B&#252;ro. Konferenz und Urlaub klingen zwar zun&#228;chst super toll - ein etwas negativer Beigeschmack bleibt aber: ich muss hier das geilste Webseitenprojekt zur&#252;cklassen, an dem ich bisher hier werkeln durfte und auch gern fertigstellen w&#252;rde :(
Nun&#8230;
okay, am Wochenende gehts also zur ZendCon nach San Jose, California. Als Neuling auf [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://zendcon.com/"><img src="http://contactsheet.de/wp-content/uploads/2009/10/zendcon.jpg" alt="zendcon" title="zendcon" width="150" height="130" /></a> Excitement. Excitement. Letzter Tag im B&#252;ro. Konferenz und Urlaub klingen zwar zun&#228;chst super toll - ein etwas negativer Beigeschmack bleibt aber: ich muss hier das geilste Webseitenprojekt zur&#252;cklassen, an dem ich bisher hier werkeln durfte und auch gern fertigstellen w&#252;rde :(<br />
Nun&#8230;<br />
okay, am Wochenende gehts also zur ZendCon nach San Jose, California. Als Neuling auf der Konferenz bin ich mal sehr gespannt, ob diese h&#228;lt was sie verspricht: 4 Tage intensive Sessions rund um PHP und Sicherheit, Wartbarkeit von Code, Geschwindigkeit, etc. etc. (die <a href="http://zendcon.com/tracks">Liste der geplanten Sessions</a> liest sich auf jeden Fall sehr vielversprechend). Mal sehen ob ich dazu komme ein bi&#223;chen von dort zu berichten und ein paar Sessions zusammenzufassen oder obs nur f&#252;r 140 Zeichen gezwitscher reicht. Ein paar interessante Einf&#252;hrungen zur ZendCon ach dem Motto &#8220;so, you decided to attend ZendCon&#8230;&#8221; gibts im Netz, die werd ich mir mal noch zu Gem&#252;te&nbsp;f&#252;hren.</p>
]]></content:encoded>
			<wfw:commentRss>http://contactsheet.de/php-zendcon-09.xhtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vorbildlich flexibel: Weblication CMS</title>
		<link>http://contactsheet.de/unterschaetztes-cms-weblication.xhtml</link>
		<comments>http://contactsheet.de/unterschaetztes-cms-weblication.xhtml#comments</comments>
		<pubDate>Thu, 24 Sep 2009 09:03:10 +0000</pubDate>
		<dc:creator>Erik Poehler</dc:creator>
				<category><![CDATA[Entwicklung]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webwork]]></category>
		<category><![CDATA[xml xsl weblication php]]></category>

		<guid isPermaLink="false">http://erikpoehler.com/?p=1287</guid>
		<description><![CDATA[Nachdem ich in letzter Zeit etwas weniger mit Weblication CMS Enterprise 4.0 gemacht habe, ist es jetzt geradezu ein Ding der Freude mal wieder ein Design damit umzusetzen. Gerade im Vergleich zu anderen Redaktionssystemen braucht sich das Konzept nicht verstecken: Weblication CMS zerlegt die inhaltlichen Elemente einer typischen Webseite in einzelne Informationsbl&#246;cke, wobei alle Daten [...]]]></description>
			<content:encoded><![CDATA[<p>Nachdem ich in letzter Zeit etwas weniger mit <a href="http://weblication.de/">Weblication</a> CMS Enterprise 4.0 gemacht habe, ist es jetzt geradezu ein Ding der Freude mal wieder ein Design damit umzusetzen. Gerade im Vergleich zu anderen Redaktionssystemen braucht sich das Konzept nicht verstecken: Weblication CMS zerlegt die inhaltlichen Elemente einer typischen Webseite in einzelne Informationsbl&#246;cke, wobei alle Daten im XML-Format vorliegen. &#220;ber eine Master-XML Datei teilt man dem CMS mit aus welchen Bestandteilen so ein Informationsblock besteht und &#252;ber ein XSL-Stylesheet hinterlegt man nun die gew&#252;nschten Transformierungen die das finale HTML-Markup generieren. Eine simple und ziemlich geniale Idee. Von Standardtemplates, und einem nicht sonderlich h&#252;bschem Adminbereich darf man sich nicht abschrecken lassen, denn die St&#228;rken spielt Weblication CMS insbesondere in dieser enorm flexiblen XML-XSL Basis&nbsp;aus.</p>
<p>Wer speziellere Anpassungen ben&#246;tigt wird um das Weblication Kompendium meines Kollegen Ulf Mayer kaum herum kommen das er unter <a href="http://weblication-tipps.de/">Weblication Tipps</a>&nbsp;betreibt.</p>
]]></content:encoded>
			<wfw:commentRss>http://contactsheet.de/unterschaetztes-cms-weblication.xhtml/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Mehrere Domains &#8211; eine WordPress Installation</title>
		<link>http://contactsheet.de/mehrere-domains-eine-wordpress-installation.xhtml</link>
		<comments>http://contactsheet.de/mehrere-domains-eine-wordpress-installation.xhtml#comments</comments>
		<pubDate>Tue, 24 Mar 2009 21:42:36 +0000</pubDate>
		<dc:creator>Erik Poehler</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[domain]]></category>
		<category><![CDATA[localhost]]></category>
		<category><![CDATA[mehrsprachig]]></category>
		<category><![CDATA[multidomain]]></category>
		<category><![CDATA[multilingual]]></category>
		<category><![CDATA[XAMPP]]></category>

		<guid isPermaLink="false">http://erikpoehler.com/?p=1129</guid>
		<description><![CDATA[Wer mehrere Domains in ein und dasselbe Verzeichnis seines Webservers zeigen l&#228;&#223;t, der hat in der Regel nicht sonderlich viel davon. Klar, meist gibt es daf&#252;r irgendeinen Grund.&#160;Vielleicht:

gab es mehrere Domains zum&#160;Webpaket,
oder man wollte dem Trend zur Zweit- oder Drittdomain&#160;folgen
es lie&#223; sich mangels Zugriff auf die httpd- oder vhost.conf nicht anders&#160;bewerkstelligen
oder man wollte es genau [...]]]></description>
			<content:encoded><![CDATA[<p>Wer mehrere Domains in ein und dasselbe Verzeichnis seines Webservers zeigen l&#228;&#223;t, der hat in der Regel nicht sonderlich viel davon. Klar, meist gibt es daf&#252;r irgendeinen Grund.&nbsp;Vielleicht:</p>
<ol>
<li>gab es mehrere Domains zum&nbsp;Webpaket,</li>
<li>oder man wollte dem Trend zur Zweit- oder Drittdomain&nbsp;folgen</li>
<li>es lie&#223; sich mangels Zugriff auf die httpd- oder vhost.conf nicht anders&nbsp;bewerkstelligen</li>
<li>oder man wollte es genau so haben wie es ist&nbsp;;)</li>
</ol>
<h3>Zuerst die altbekannte&nbsp;Theorie.</h3>
<p>Nun, sofern man eine .htaccess-Datei anlegen kann und mod_rewrite verf&#252;gbar ist, kann man sich ganz gut behelfen und die einzelnen Domains ganz nach Belieben in Unterverzeichnisse weiterschicken. Die zwei, drei Zeilen die man in seine htaccess packt lesen sich in der Regel&nbsp;so:</p>
<ol class="code htc">
<li class="t0"><code>&lt;IfModule&nbsp;mod_rewrite.c&gt;</code></li>
<li class="t2 odd"><code>RewriteEngine&nbsp;On</code></li>
<li class="t2"><code>RewriteCond %{HTTP_HOST}&nbsp;^(www.)?example.com$</code></li>
<li class="t2 odd"><code>RewriteCond %{REQUEST_URI}&nbsp;!^/verzeichnis/</code></li>
<li class="t2"><code>RewriteCond %{REQUEST_FILENAME}&nbsp;!-f</code></li>
<li class="t2 odd"><code>RewriteCond %{REQUEST_FILENAME}&nbsp;!-d</code></li>
<li class="t2"><code>RewriteRule ^(.*)$&nbsp;/verzeichnis/$1</code></li>
<li class="t0 odd"><code>&lt;/IfModule&gt;</code></li>
</ol>
<p>Damit schickt man nun also alle Anfragen die ein Besucher an <samp>www.example.com</samp> schickt in ein Unterverzeichnis, in dem sich dann ein flei&#223;iges CMS oder 73 tippende Affen um alles weitere k&#252;mmern k&#246;nnen. Legt man sowas f&#252;r jede seiner Domains an, kann man diese f&#252;r eigenst&#228;ndige Projekte getrennt voneinander verwenden.&nbsp;Immerhin.</p>
<h3>Was aber tun,&nbsp;wenn&#8230;</h3>
<p>&#8230; man aus reiner Absicht zwei oder drei Domains auf eine einzige WordPress-Installation zeigen l&#228;&#223;t? Ein paar Gr&#252;nde warum man das vielleicht tun m&#246;chte k&#246;nnten&nbsp;sein:</p>
<ol>
<li>Man m&#246;chte eine mehrsprachige Seite anbieten. Ein Besucher soll allein anhand der Domain entweder einen deutschsprachigen oder aber englischen Artikel zu Gesicht bekommen. Unter <samp>www.meinedomain.de/kategorie/mein-artikel/</samp> auf deutsch und unter <samp>www.meinedomain.com/kategorie/mein-artikel/</samp>auf&nbsp;englisch.</li>
<li>Auch f&#252;r Entwicklungsumgebungen ist das meist sinnvoll, denn viele Entwickler arbeiten lokal auf einem <samp>localhost</samp>und nicht direkt auf einem live-Server. Normalerweise muss man sich also h&#228;ndisch einen Virtual Host anlegen oder die Optionen in einer WordPress Datenbank anpassen. Dort n&#228;mlich speichert WordPress die Domain unter welcher die Webseite laufen&nbsp;soll.</li>
<li>Ein drittes Szenario w&#228;ren noch Domain-bezogene Software Lizenzen. Seien es kostenpflichtige Statistik Tools, oder sonstwas. Bitte nicht falsch verstehen - Ich will hier nicht zum Mi&#223;brauch von Software-Lizenzen aufrufen. Aber es kann durchaus vorkommen dass man eine Software auf eine Domain lizensiert, die man zu einem sp&#228;teren Zeitpunkt nicht mehr nutzt, aber durchaus noch Verwendung f&#252;r die Software&nbsp;hat.</li>
</ol>
<p>All diese Szenarien haben eins gemein: man m&#246;chte mehrere Domains mit einer WordPress-Installation sinnvoll betreiben. Da WordPress aber wie schon erw&#228;hnt die Domain in seiner <samp>wp_options</samp>-Tabelle speichert geht das nicht ohne weiteres. Nat&#252;rlich funktionieren die weiter oben schon beschriebenen Bordmittel des Apache auch noch wenn man WordPress verwendet, sobald man aber auf einen Link seiner WordPress-Seite klickt wird man feststellen, dass diese wieder auf die intern gespeicherte Domain&nbsp;verweisen.</p>
<h3>Ein Plugin schafft&nbsp;Abhilfe</h3>
<p>Im WordPress-Forum hat jemand einen grandiosen Helfer (Plugin) gepostet welches genau f&#252;r diesen Zweck ideal ist:<a href="http://wordpress.org/support/topic/221850" title="Using different domains for different languages">Using different domains for different languages</a>. Dieses ist zwar eigentlich darauf ausgelegt dem <a href="http://wordpress.org/extend/plugins/gengo/" title="Gengo">Gengo Plugin</a> einen speziellen Sprachparameter zu liefern, man kann es aber sehr leicht anpassen. Ich verwende es zum Beispiel dazu mein WordPress-Backend mit einer zweiten Domain aufzurufen, ich leite damit auch alle Anfragen auf www. Domains auf eine ohne-www-Version weiter und erlaube zus&#228;tzlich eine dritte Domain, die meinem Virtual Host unter Windows entspricht. Somit entf&#228;llt nerviges Suchen und Ersetzen wenn ich lokal an der Seite arbeite. Ich kann eine 1 zu 1 Kopie sowohl auf XAMPP wie auch auf dem Live-Server&nbsp;einsetzen.</p>
<p>Vielleicht ist dieser Tip ja auch anderen n&#252;tzlich bzw. eine&nbsp;Arbeitserleichterung.</p>
<p>F&#252;r den Fall, dass sich am WordPress-Forum mal was &#228;ndert, oder die Seite offline sein sollte, gibt es hier sicherheitshalber nochmal eine Kopie des Plugins: <a href="http://snipplr.com/view/34121/using-different-domains-for-different-languages/">Using different domains for different languages bei&nbsp;snipplr.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://contactsheet.de/mehrere-domains-eine-wordpress-installation.xhtml/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using bit masks in PHP</title>
		<link>http://contactsheet.de/using-bit-masks-in-php.xhtml</link>
		<comments>http://contactsheet.de/using-bit-masks-in-php.xhtml#comments</comments>
		<pubDate>Mon, 02 Mar 2009 00:04:01 +0000</pubDate>
		<dc:creator>Erik Poehler</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://contactsheet.de/?p=617</guid>
		<description><![CDATA[Whenever you have a set of values that can either be true or false, or rather 1 and 0, you can use bit masks to save yourself some work.
For example, think of a HTML form with a set of checkboxes in it. Each checkbox in the form will have a specific value that is defined [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/bilder/form-example.jpg" alt="form example" class="right" />Whenever you have a set of values that can either be true or false, or rather 1 and 0, you can use bit masks to save yourself some work.<br />
For example, think of a HTML form with a set of checkboxes in it. Each checkbox in the form will have a specific value that is defined by its HTML-attribute <samp>value="yes"</samp>. Asides its actual value and the purpose of the checkbox, it still can only be true or false (checked or unchecked), by&nbsp;design.</p>
<h3>An&nbsp;example.</h3>
<p>Let&#8217;s say we wanted to find out what people prefer for breakfast. We would most likely create a web-based form to store someones individual preferences. You can see what this form might eventually look like in my first screenshot. Let&#8217;s write down all the possible options into a single array now - I&#8217;ll explain later why this is actually making sense. So the array looks like&nbsp;this:</p>
<ol class="code php">
<li class="t0 odd"><code>Array&nbsp;(</code></li>
<li class="t2"><code>[0] =>&nbsp;"apple"</code></li>
<li class="t2 odd"><code>[1] =>&nbsp;"coffee"</code></li>
<li class="t2"><code>[2] =>&nbsp;"newspaper"</code></li>
<li class="t2 odd"><code>[3] =>&nbsp;"strawberries"</code></li>
<li class="t2"><code>[4] =>&nbsp;"cereals"</code></li>
<li class="t2 odd"><code>[5] =>&nbsp;"bread"</code></li>
<li class="t2"><code>[6] =>&nbsp;"nutella"</code></li>
<li class="t2 odd"><code>...</code></li>
<li class="t0"><code>)</code></li>
</ol>
<p>Now that we have created a form and have an array of options, let&#8217;s take a look what this <em>Bit Masking</em> thing is good for.<br />
<strong>The basic idea behind bit masking is to associate each part of an array (where each value can either be true or false) with an exponential value of two.</strong><br />
Say what? Let&#8217;s look at this small function and the resulting masked&nbsp;array:</p>
<ol class="code php">
<li class="t0 odd"><code>function getMaskedArray($array)&nbsp;{</code></li>
<li class="t2"><code>$i =&nbsp;0;</code></li>
<li class="t2 odd"><code>foreach ($array as $key => $value)&nbsp;{</code></li>
<li class="t3"><code>$maskedArray[pow(2,$i)] =&nbsp;$value;</code></li>
<li class="t3 odd"><code>$i++;</code></li>
<li class="t2"><code>}</code></li>
<li class="t2 odd"><code>return&nbsp;$maskedArray;</code></li>
<li class="t0"><code>}</code></li>
</ol>
<p>Using this function (<samp class="php">$masked_breakfast_preferences  = getMaskedArray($breakfast_preferences);</samp>), gives us the&nbsp;following:</p>
<ol class="code php">
<li class="t0 odd"><code>Array&nbsp;(</code></li>
<li class="t2"><code>[1] 	=>&nbsp;"apple",</code></li>
<li class="t2 odd"><code>[2]	=>&nbsp;"coffee",</code></li>
<li class="t2"><code>[4] 	=>&nbsp;"newspaper",</code></li>
<li class="t2 odd"><code>[8]	=>&nbsp;"strawberries",</code></li>
<li class="t2"><code>[16]	=>&nbsp;"cereals",</code></li>
<li class="t2 odd"><code>[32]	=>&nbsp;"bread",</code></li>
<li class="t2"><code>[64] 	=>&nbsp;"nutella",</code></li>
<li class="t0 odd"><code>)</code></li>
</ol>
<p>Okay, now here&#8217;s the reason, we are doing all this: once we submit a form for a specific persons&#8217; preferences, we are able to describe these preferences with a unique number: the summary of the corresponding keys.<br />
For example: someone who would like <strong>an apple</strong>, <strong>strawberries</strong>, <strong>cereals</strong> and <strong>bread</strong> for breakfast would give a sum of <strong>57</strong> (that is 1 + 8 + 16 + 32).<br />
And now you&#8217;ll understand why we need to use exponential growth on the key values here: it ensures that the result of our summary is always unique. The advantage is obvious: instead of bloating your database or handling each value separately you can handle complex selections (maybe your culinary experience leads to a form with hundreds of options) in one single&nbsp;number.</p>
<p>The function used to calculate this bit mask could look like this: (in this case, a selected checkbox has a value of 1) <samp>&lt;input type="checkbox" name="brekfast_preferences[]" value="1"></samp></p>
<ol class="code php">
<li class="t0 odd"><code>function getBitmask($masked_array)&nbsp;{</code></li>
<li class="t2"><code>foreach ($masked_array as $key => $value)&nbsp;{</code></li>
<li class="t3"><code>if ($value === 1)&nbsp;{</code></li>
<li class="t4 odd"><code>$res = $res +&nbsp;$key;</code></li>
<li class="t3"><code>}</code></li>
<li class="t2 odd"><code>}</code></li>
<li class="t2"><code>return&nbsp;$res;</code></li>
<li class="t0 odd"><code>}</code></li>
</ol>
<p>Now you&#8217;re familiar with the basic concept of bit masking.<br />
But there&#8217;s one more thing we need in order to have a practical use for this technique: a function that can reverse the bit mask back into it&#8217;s initial Array.<br />
All we need to get rebuild the settings for a specific user now is its stored bitmask 57 and the array of usersettings so we can reassign our bools to&nbsp;it:</p>
<ol class="code php">
<li class="t0 odd"><code>function getBinmaskArray($bitmask,$array)&nbsp;{</code></li>
<li class="t2"><code>if (is_array($array))&nbsp;{</code></li>
<li class="t3 odd"><code>if (is_int($bitmask))&nbsp;{</code></li>
<li class="t4"><code>$bin_val =&nbsp;base_convert($bitmask,10,2);</code></li>
<li class="t4 odd"><code>$bin_val =&nbsp;strrev($bin_val);</code></li>
<li class="t4"><code>for ($i = 0; $i < count($origArray); $i++)&nbsp;{</code></li>
<li class="t5 odd"><code>$val = substr ($bin_val, $i,&nbsp;1);</code></li>
<li class="t5"><code>if (!strlen($val)) $val =&nbsp;0;</code></li>
<li class="t5 odd"><code>$tmpArray[$origArray[$i]] =&nbsp;$val;</code></li>
<li class="t4"><code>}</code></li>
<li class="t4 odd"><code>return&nbsp;$tmpArray;</code></li>
<li class="t3"><code>}</code></li>
<li class="t3 odd"><code>print "The first parameter is expected to be a valid bitmask.&nbsp;";</code></li>
<li class="t2"><code>}</code></li>
<li class="t2 odd"><code>print "The second parameter is expected to be an&nbsp;array.";</code></li>
<li class="t0"><code>}</code></li>
</ol>
<p>Please note that these examples are really simplified to illustrate the concept of bitmasking. In a production environment you would probably code your own bitmasking class or use a pre-made class (PHPClasses.org has a good&nbsp;one)</p>
<p>I do know that the breakfast example is rather trivial, but just think of a CMS where you want to control wether a specific content element should show up in the actual context or not&#8230; you have an &#8216;archive view&#8217; a listing of &#8216;search results&#8217;, an &#8216;index view&#8217;, &#8216;product detail view&#8217; and &#8216;product listing view&#8217; and so on&#8230;<br />
If you want to place a box in specific contexts of your page you could achieve that by assigning a number, a specific bitmask to&nbsp;it.</p>
<p>Multiple-selects <samp class="html">&lt;select multiple="multiple" size="7"></samp> are another great example for this. If you want to highlight a selction that has already been made on such an element you can do so by simply adding the <samp class="html">selected="selected"</samp> attribute to those <samp class="html">&lt;option></samp>s with this&nbsp;technique.</p>
<p>If you think this a few steps further, you could also use this technique to reduce the number of SQL requests necessary to display a certain webpage to a minimum. Not only that elements or boxes of the webpage can be turned on or off with this technique, even functions or methods that get data from the database can be enabled or disabled just by requesting a certain URL and thus context of your webpage. So no need to grab more data from the DB then really&nbsp;needed.</p>
<p>Think about this, you will come up with your own ideas&nbsp;quickly.</p>
]]></content:encoded>
			<wfw:commentRss>http://contactsheet.de/using-bit-masks-in-php.xhtml/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A very simple pagination with PHP</title>
		<link>http://contactsheet.de/a-very-simple-pagination-with-php.xhtml</link>
		<comments>http://contactsheet.de/a-very-simple-pagination-with-php.xhtml#comments</comments>
		<pubDate>Sat, 21 Feb 2009 03:02:14 +0000</pubDate>
		<dc:creator>Erik Poehler</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[paginierung]]></category>
		<category><![CDATA[seitennummern]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://contactsheet.de/?p=605</guid>
		<description><![CDATA[or: the dangerousness of simple&#160;mathematics
I guess many people had this problem before and I think everybody managed to solve this quite similar. Anyways, just in case this is useful for anybody: here’s how I added a pagination to a site&#160;recently.
Given you have an array of products for example. Or maybe search results, a list of [...]]]></description>
			<content:encoded><![CDATA[<h3>or: the dangerousness of simple&nbsp;mathematics</h3>
<p>I guess many people had this problem before and I think everybody managed to solve this quite similar. Anyways, just in case this is useful for anybody: here’s how I added a pagination to a site&nbsp;recently.</p>
<p>Given you have an array of products for example. Or maybe search results, a list of articles… something like that. Unfortunately they are too many to display them on a single page. Well, sure, you could but let’s be honest: that isn’t an option as the page would exceed its “scrollable-with-no-harm-to-scroll-fingers” length. And you don’t want to get sued by your visitors, right ;)<br />
Ok, so you’re going to add a nice pagination to your site, so that everybody is happy.<br />
What I found out to be a bit tricky was to calculate the actual number of pages. We need that number so that we know, how many page links we will show next to our current&nbsp;view.</p>
<p>Two simple examples to illustrate the probelm:<br />
Let’s say we have <strong>8</strong> items. <strong>8</strong> divided by <strong>4</strong> is <strong>2</strong>, so we’re going to need two pages. No big deal.<br />
Now we try this calculation with <strong>9</strong> items. <strong>9</strong> divided by <strong>4</strong> gives us <strong>2.25</strong>. So we will clearly need a 3rd page for product number 9, but how do we calculate this from our&nbsp;result?</p>
<ol class="code php">
<li class="t0 odd"><code>$itemcount =&nbsp;$res-&gt;length();</code></li>
<li class="t0"><code>$pagemin = $itemcount /&nbsp;4;</code></li>
<li class="t0 odd"><code>$pagemax = ceil($itemcount /&nbsp;4);</code></li>
<li class="t0"><code>if ( $pagemax - intval($pagemin) === 1) )&nbsp;{</code></li>
<li class="t2 odd"><code>$pages =&nbsp;$pagemax;</code></li>
<li class="t0"><code>} else&nbsp;{</code></li>
<li class="t2 odd"><code>$pages =&nbsp;intval($pagemin);</code></li>
<li class="t0"><code>}</code></li>
</ol>
<h3>The code&nbsp;explained</h3>
<p>That’s why I compare two values here: the actual division result and the next bigger integer (that&#8217;s what ceil returns). If they differ by 1 we have a scenario where we do want another page, so we pick the bigger result as our page number (lines 4-7). If not we are just happy and use the smaller&nbsp;number.</p>
<p>So now that we know our actual page count we can do something (slightly simplified) like&nbsp;this:</p>
<ol class="code php">
<li class="t0 odd"><code>while($i = 0;$i &lt; $pages; $i++)&nbsp;{</code></li>
<li class="t2"><code>if ($i === $_GET['page'])&nbsp;{</code></li>
<li class="t3 odd"><code>$class = '&nbsp;class="current"';</code></li>
<li class="t2"><code>} else&nbsp;{</code></li>
<li class="t3 odd"><code>$class =&nbsp;'';</code></li>
<li class="t2"><code>}</code></li>
<li class="t2 odd"><code>print "&lt;a href=\"?page=$i\" title=\"Page $i of&nbsp;$pages\"$class&gt;".($i+1)."&lt;/a&gt;";</code></li>
<li class="t0"><code>}</code></li>
</ol>
<p><img class="alignnone size-medium wp-image-606 left" title="pagination" src="http://contactsheet.de/wp-content/uploads/2009/02/pagination-300x82.jpg" alt="pagination" width="300" height="82" /><br />
With a little bit of styling this even looks nice. And of course, this is just a start. You also might want to add “previous” and “next buttons”, or those “first page”, “last page” buttons, limit the maximum number of page links shown, or you could center the currently viewed page in the middle, hide the previous button on the first page, etc… There are a lot of fine tuning options that will improve the user experience of your&nbsp;pagination.</p>
]]></content:encoded>
			<wfw:commentRss>http://contactsheet.de/a-very-simple-pagination-with-php.xhtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHProjekt &#252;ber MySQL anpassen</title>
		<link>http://contactsheet.de/phprojekt-uber-mysql-anpassen.xhtml</link>
		<comments>http://contactsheet.de/phprojekt-uber-mysql-anpassen.xhtml#comments</comments>
		<pubDate>Sat, 07 Feb 2009 19:32:50 +0000</pubDate>
		<dc:creator>Erik Poehler</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://contactsheet.de/?p=535</guid>
		<description><![CDATA[Die, im Standarddesign etwas grausig h&#228;&#223;liche, Groupware PHProjekt von der M&#252;nchner Mayflower GmbH l&#228;&#223;t sich &#252;ber einen MySQL-Editor, also z.B. PHPMyAdmin sehr simpel anpassen. So steuern die Eintr&#228;ge in der Tabelle &#8216;prefix_db_manager&#8217; beispielsweise welche Kenndaten eines Projekts in der Projekt&#252;bersicht angezeigt werden.
Standardm&#228;&#223;ig werden in der Tabelle unter dem Men&#252;punkt &#8220;Projekte&#8221; nur der Projektname, die Projektkategorie, [...]]]></description>
			<content:encoded><![CDATA[<p>Die, im Standarddesign etwas grausig h&#228;&#223;liche, Groupware <a href="http://www.phprojekt.com/" title="Groupware PHProjekt von Mayflower">PHProjekt</a> von der M&#252;nchner Mayflower GmbH l&#228;&#223;t sich &#252;ber einen MySQL-Editor, also z.B. PHPMyAdmin sehr simpel anpassen. So steuern die Eintr&#228;ge in der Tabelle &#8216;prefix_db_manager&#8217; beispielsweise welche Kenndaten eines Projekts in der Projekt&#252;bersicht angezeigt werden.<br />
Standardm&#228;&#223;ig werden in der Tabelle unter dem Men&#252;punkt &#8220;Projekte&#8221; nur der Projektname, die Projektkategorie, Beginn und Ende des Projekts angezeigt. Zun&#228;chst lassen wir uns die f&#252;r die Projekt&#252;bersicht relevanten Felder&nbsp;anzeigen:</p>
<ol class="code mysql">
<li class="t0 odd"><code>SELECT&nbsp;*</code></li>
<li class="t0"><code>FROM&nbsp;`phpr_db_manager`</code></li>
<li class="t0 odd"><code>WHERE  `db_table` =&nbsp;'projekte'</code></li>
<li class="t0"><code>LIMIT 0 ,&nbsp;30</code></li>
</ol>
<p>Nun f&#252;gt man z.B. die Priorit&#228;t&nbsp;hinzu:</p>
<ol class="code mysql">
<li class="t0 odd"><code>UPDATE&nbsp;`phprojekt`.`phpr_db_manager`</code></li>
<li class="t0"><code>SET `list_pos` =&nbsp;'6'</code></li>
<li class="t0 odd"><code>WHERE `phpr_db_manager`.`db_name` =&nbsp;'wichtung'</code></li>
<li class="t0"><code>LIMIT&nbsp;1</code></li>
</ol>
<p><strong>Erkl&#228;rung</strong>: &#8220;phpprojekt&#8221; ist der Name der Datenbank, &#8220;phpr&#8221; ist der Pr&#228;fix aller PHProjekt-Tabellen und kann ggf. abweichen (das legt man in der Regel bei der Installation fest). Das Feld &#8220;list_pos&#8221; in der Tabelle &#8220;phpr_db_manager&#8221; steuert die Projekt&#252;bersicht die wir hier anpassen wollen, wobei der Wert 0 bedeutet, dass eine Projekteigenschaft ausgeblendet ist. Ein ganzzahliger Wert hingegen blendet eine Eigenschaft ein und legt zugleich deren Position in der Tabelle&nbsp;fest.</p>
<p>Eigentlich schade dass dieses Feature nicht (vielleicht ist das ja doch &#252;ber ein addon m&#246;glich&#8230;) in einem Einstellungs- oder Optionspunkt bereitgestellt&nbsp;wird.</p>
<p>Nachtrag: Mit &#8220;grausig, h&#228;&#223;lich&#8221; ist die aktuelle Version 5.x gemeint - wie ich gesehen habe wird wohl eifrig an einer neuen Version 6 gearbeitet, die anscheinend auch optisch ordentlich aufpoliert&nbsp;wird.</p>
]]></content:encoded>
			<wfw:commentRss>http://contactsheet.de/phprojekt-uber-mysql-anpassen.xhtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>eine einfache CAPTCHA-Funktion</title>
		<link>http://contactsheet.de/eine-einfache-captcha-funktion.xhtml</link>
		<comments>http://contactsheet.de/eine-einfache-captcha-funktion.xhtml#comments</comments>
		<pubDate>Sun, 13 Aug 2006 15:18:30 +0000</pubDate>
		<dc:creator>Erik Poehler</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[CAPTCHA]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Markup]]></category>

		<guid isPermaLink="false">http://contactsheet.de/eine-einfache-captcha-funktion.xhtml</guid>
		<description><![CDATA[ Eine CAPTCHA-Funktion sch&#252;tzt Formulare vor Spam. Wer ein WordPress-Blog betreibt, braucht seinen Besuchern kein umst&#228;ndliches Captcha vorsetzen sondern kann getrost auf &#8220;goldwerte&#8221; Dienste wie Akismet oder Spam Karma 2 zur&#252;ckgreifen. W&#228;hrend Akismet IPs und Inhalte mit seiner Online-Datenbank abgleicht um die B&#246;sewichte zu finden, filtert Spam Karma den Inhalt nach&#160;Auff&#228;lligkeiten.
Au&#223;erhalb eines CMS, oder beim [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/bilder/captcha.gif" alt="eine CAPTCHA-Funktion sch&#252;tzt Formulare vor Spam" class="right" /> Eine CAPTCHA-Funktion sch&#252;tzt Formulare vor Spam. Wer ein WordPress-Blog betreibt, braucht seinen Besuchern kein umst&#228;ndliches Captcha vorsetzen sondern kann getrost auf &#8220;<em>goldwerte</em>&#8221; Dienste wie <strong><a href="http://akismet.com/">Akismet</a></strong> oder <strong><a href="http://wp-plugins.net/plugin/SK2/">Spam Karma 2</a></strong> zur&#252;ckgreifen. W&#228;hrend Akismet IPs und Inhalte mit seiner Online-Datenbank abgleicht um die B&#246;sewichte zu finden, filtert Spam Karma den Inhalt nach&nbsp;Auff&#228;lligkeiten.</p>
<p>Au&#223;erhalb eines CMS, oder beim Verwenden einer eigenen Redaktionssystem-Kreation die ohne solche Mechanismen, setzt man seine Formulare der grausamen Webrealit&#228;t aus. :D Fahrl&#228;ssig!<br />
Da bleibt einem oft nur die M&#246;glichkeit eine CAPTCHA-Funktion zu benutzen. <span id="more-63"></span><br />
Umsetzen kann man soetwas mit einer Reihe von vorgefertigten, umfangreichen Klassen oder Funktionen. (lesenswert dazu auch der Wikipedia-Eintrag&nbsp;<a href="http://de.wikipedia.org/wiki/CAPTCHA">Captcha</a>).</p>
<p>Die einfachste und simpelste Form eines CAPTCHAs auf die ich bisher gesto&#223;en bin, hat der Programmierer <a href="http://tetto.org" title="Webseite von Donald Tetto">Donald Tetto</a> geschrieben. In seinem Galerie-Skript <a href="http://folderblog.tetto.org" title="Galerieskript Folderblog">Folderblog</a> kommt eine sehr einfache und auch einfach zu integrierende Funktion zum&nbsp;Einsatz.</p>
<h3>1. Das Formular&nbsp;vorbereiten</h3>
<p>Zun&#228;chst baut man das Bild und das zugeh&#246;rige Textfeld in sein Formular (also innerhalb des <samp>&lt;form></samp>-Elements)</p>
<ol class="code html">
<li class="t0 odd"><code>&lt;img src="./landscape.php" alt="beautiful landscape" /></code></li>
<li class="t0"><code>&lt;input size="4" maxlength="4" name="C" /></code></li>
</ol>
<h3>2. Die eigentliche&nbsp;Datei</h3>
<p>Den folgenden Code speichern wir in die soeben als Bild verlinkte Datei im selben Verzeichnis, wo sich auch die Webseite mit dem Formular&nbsp;befindet.</p>
<ol class="code php">
<li class="t0 odd"><code>&lt;?php</code></li>
<li class="t0"><code>session_start();</code></li>
<li class="t0 odd"><code>$letters=substr(str_shuffle("ACDJKMNOPSTVWXYZ"),0,4);</code></li>
<li class="t0"><code>$image =&nbsp;imagecreate(40,16);</code></li>
<li class="t0 odd"><code>imagecolorallocate($image, 255, 255,&nbsp;255);</code></li>
<li class="t0"><code>imagecolorallocate($image, 0, 0,&nbsp;0);</code></li>
<li class="t0 odd"><code>imagecolorallocate($image, rand(50,175), rand(125,225),&nbsp;rand(125,225));</code></li>
<li class="t0"><code>imagecolorallocate($image, rand(125,225), rand(50,175),&nbsp;rand(125,225));</code></li>
<li class="t0 odd"><code>imageline($image, 0, rand(9,14), 40, rand(2,7),&nbsp;2);</code></li>
<li class="t0"><code>imagestring($image, 5, 3, 0, " " . $letters[0] . " " . $letters[1],&nbsp;1);</code></li>
<li class="t0 odd"><code>imageline($image, 0, rand(2,7), 40, rand(9,14),&nbsp;3);</code></li>
<li class="t0"><code>imagestring($image, 5, 3, 0, $letters[2] . " " . $letters[3],&nbsp;1);</code></li>
<li class="t0 odd"><code>$_SESSION["md5"] = md5($letters[2] . $letters[0] . $letters[3] .&nbsp;$letters[1]);</code></li>
<li class="t0"><code>header('Content-type:&nbsp;image/png');</code></li>
<li class="t0 odd"><code>imagepng($image);</code></li>
<li class="t0"><code>?></code></li>
</ol>
<p>Beim Aufruf der Seite (und damit des Bildes) generiert diese Datei eine Zufalls-Buchstabenkombination und zeigt das Bild an, es generiert die md5-Checksum des Buchstabensalats und schreibt sie in eine&nbsp;Session.</p>
<p>Das input-Feld gibt dem Besucher nun die M&#246;glichkeit den angezeigten Text zu&nbsp;best&#228;tigen.</p>
<h3>3. Formulardaten annehmen und&nbsp;verarbeiten</h3>
<p>In der Datei in der man den Formularinhalt weiterverarbeitet hat man nun die M&#246;glichkeit die Eingabe in dem Feld, mit Namen &#8220;captcha&#8221;, auf Korrektheit zu pr&#252;fen, bevor man mit dem Formularinhalt nun irgendetwas&nbsp;anstellt.</p>
<ol class="code php">
<li class="t0 odd"><code>$captcha =&nbsp;$_POST['C'];</code></li>
<li class="t0"><code>if ( isset($captcha)&nbsp;&#038;&</code></li>
<li class="t2 odd"><code>strlen($captcha)&nbsp;&#038;&</code></li>
<li class="t2"><code>isset($_SESSION["md5"])&nbsp;&#038;&</code></li>
<li class="t2 odd"><code>$_SESSION["md5"]==md5(strtoupper($captcha))&nbsp;)</code></li>
<li class="t0"><code>{</code></li>
<li class="t2 odd"><code>// das Captcha wurde erfolgreich&nbsp;validiert.</code></li>
<li class="t2"><code>print "Danke f&#252;r Ihre&nbsp;Mitteilung/Kommentar/etc.";</code></li>
<li class="t0 odd"><code>}</code></li>
</ol>
<h3>Fertig.</h3>
<p>So einfach kann man sich Ruhe von nervigen Spam-Mails verschaffen.<br />
Wenn man es noch etwas h&#252;bscher haben will, kann man statt der Standarschrift auf eine eigene Schriftdatei zur&#252;ckgreifen. Eine angepasste Version, zusammen mit einer Freefont kann man sich <a href="/bilder/pimped_captcha.zip">hier als ZIP-Datei herunterladen</a>. (Dazu braucht man eine halbwegs aktuelle PHP Version mit GD Bibliothek mind. aber&nbsp;v3.0.8)</p>
<p>Als Tip sei noch etwas eigentlich selbstverst&#228;ndliches angemerkt: bei der Auswahl der m&#246;glichen Lettern (und der Schrift) sollte man dem Besucher zu Liebe auf Unverwechselbarkeut achten. Das ist ja sonst nur frustrierend, wenn man nicht wei&#223; ob man jetzt ein O (oooh) oder eine 0 (null) (oder auch bei 8 und B oft problem.) eingeben&nbsp;soll.</p>
]]></content:encoded>
			<wfw:commentRss>http://contactsheet.de/eine-einfache-captcha-funktion.xhtml/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
