<?xml version="1.0" encoding="UTF-8"?>
<rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>SteviesWebsite Webmaster Blog</title>
	
	<link>http://blog.stevieswebsite.de</link>
	<description>Artikel übers WebEntwickeln und über das SteviesWebsite Netzwerk</description>
	<lastBuildDate>Wed, 10 Mar 2010 18:50:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/stevieswebsite" /><feedburner:info uri="stevieswebsite" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Höhere Affiliate Einnahmen durch Referreranalyse</title>
		<link>http://feedproxy.google.com/~r/stevieswebsite/~3/PthLbb1DbUk/</link>
		<comments>http://blog.stevieswebsite.de/2010/03/hohere-affiliate-einnahmen-durch-referreranalyse/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 18:46:02 +0000</pubDate>
		<dc:creator>Stefan Wienströer</dc:creator>
				<category><![CDATA[Konzepzion]]></category>
		<category><![CDATA[affiliate]]></category>
		<category><![CDATA[einnahmen]]></category>
		<category><![CDATA[referrer]]></category>

		<guid isPermaLink="false">http://blog.stevieswebsite.de/?p=4325</guid>
		<description><![CDATA[
Meine Affiliate Einnahmen sind um einiges geringer als die AdSense Einnahmen. Das liegt meiner Meinung nach daran, dass ich natürlich zum einen dort nicht per Klick sondern pro Lead oder Sale bezahlt werde und zum anderen daran, dass die Anzeigen einfach nicht immer passen.
Google hat mit AdSense die Möglichkeit Anzeigen direkt am Content und wahrscheinlich [...]]]></description>
			<content:encoded><![CDATA[
<p>Meine Affiliate Einnahmen sind um einiges geringer als die AdSense Einnahmen. Das liegt meiner Meinung nach daran, dass ich natürlich zum einen dort nicht per Klick sondern pro Lead oder Sale bezahlt werde und zum anderen daran, dass die Anzeigen einfach nicht immer passen.<span id="more-4325"></span></p>
<p>Google hat mit AdSense die Möglichkeit Anzeigen direkt am Content und wahrscheinlich auch benutzerdefiniert zu setzen. Affiliate-Anzeigen werden dagegen oft auf der ganzen Seite oder in / unter einzelnen Artikeln gezeigt.</p>
<p>Ich habe mir allerdings eine Methode ausgedacht, mit welcher sich die Affiliate Einnahmen erhöhen lassen: Man wählt die anzuzeigende Anzeige durch den Referrer aus.</p>
<p>Ist keine passende Anzeige vorhanden wird AdSense angezeigt.</p>
<h3>Welche Arten von Referrers werden ausgewertet?</h3>
<p>Hoch interessant sind an der Stelle natürlich Besucher, die über Suchmaschinen kommen. Bei denen kann man sofort wissen, wonach sie gesucht haben und was sie auf der Seite erwarten.</p>
<p>Bei Refferers (ohne Suchmaschinen) die viele Besucher bringen kann man auch gezielt Affiliate Anzeigen schalten. Dabei sollte die Auswahl jedoch nach Möglichkeit nicht über die komplette Domain, sondern über einzelne Seiten gewählt werden. Denn eine Domain kann schließlich auf verschiedene nicht zusammenhängende Inhalte verlinken.</p>
<p>Findet man bei den beideren oberen Auswahlverfahren keinen passenden Affiliate kann man den Referrer nach bestimmten Texten durchsuchen. So kann man zum Beispiel zu allen Referrers, wo &#8220;SEO&#8221; drin steht irgendwelche SEO-Tools promoten.</p>
<h3>Affilates finden</h3>
<p>Um Affiliate-Anzeigen anzuzeigen muss man natürlich auch passende Partner finden. Dabei gibt es einen einfachen Trick. Wenn Leute über Suchmaschinen zu euch gelangen, könnt ihr einfach deren Suchanfrage selbst bei Google eintippen und die AdWords anzeigen Analysieren. Nun schaut ihr euch die Seiten an und sucht dort nach Affiliate Möglichkeiten.</p>
<p>Eine weitere Variante ist, dass ihr Affiliate-Netzwerke nach diesen Keywords durchsucht. Dort werdet ihr bestimmt einen passenden Partner finden.</p>
<p>Sollte das auch kein Ergebnis liefern, kann man sich Allround-Anbieter wie zum Beispiel Amazon oder Ebay heraussuchen und dort nach passenden Produkten suchen.</p>
<h3>Quellcode</h3>
<p>Das klingt ja in der Theorie alles ganz toll, aber die Umsetzung ist etwas komplizierter. Aus diesem Grund habe ich mal ein bisschen PHP-Code für euch vorbereitet. Dieser ist noch ziemlich einfach gehalten. Auf großen Seiten sollte man das ganze über eine Datenbank abhandeln.</p>
<p>Die einzelnen Quellcode Abschnitte können später aneinander gehängt werden und ergeben ein kleines Anzeige-Management Tool.</p>
<p>Fangen wir an mit der Initialisierung. In der Variable $anzeige wird der Code für die anzuzeigende Anzeige erstellt. Diese beinhaltet standardmäßig AdSense Code (Könnt ruhig meinen drinbehalten <img src='http://blog.stevieswebsite.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> ):</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #a65700; background: #ffffe8;">&lt;?</span><span style="color: #000000; background: #ffffe8;">PHP</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #000000; background: #ffffe8;">$referrer</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #0000e6; background: #ffffe8;">'http://www.google.de/search?q=vserver+kostenlos&amp;rlz=1I7GZAZ_de'</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #696969; background: #ffffe8;">//$referrer = $_SERVER["HTTP_REFERER"];</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #000000; background: #ffffe8;">$anzeige</span><span style="color: #000000; background: #ffffe8;">  </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #0000e6; background: #ffffe8;">'&lt;script type="text/javascript"&gt;&lt;!--</span>
<span style="color: #0000e6; background: #ffffe8;">google_ad_client = "pub-9422021339860562";</span>
<span style="color: #0000e6; background: #ffffe8;">                 /* 468x60, Erstellt 03.12.09 */</span>
<span style="color: #0000e6; background: #ffffe8;">google_ad_slot = "6995978195";</span>
<span style="color: #0000e6; background: #ffffe8;">google_ad_width = 468;</span>
<span style="color: #0000e6; background: #ffffe8;">google_ad_height = 60;</span>
<span style="color: #0000e6; background: #ffffe8;">                 //--&gt;</span>
<span style="color: #0000e6; background: #ffffe8;">&lt;/script&gt;</span>
<span style="color: #0000e6; background: #ffffe8;">&lt;script type="text/javascript"</span>
<span style="color: #0000e6; background: #ffffe8;">src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt; </span>
<span style="color: #0000e6; background: #ffffe8;">&lt;/script&gt;'</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #a65700; background: #ffffe8;">?&gt;</span></pre>
<p>In dem Referrer habe ich nun fest eine Google-Url hereingeschrieben. Im produktiven Einsatz müsstet ihr diese Zeile entfernen und die auskommentiere Zeile wieder einkommentieren.</p>
<p>Nun fragen wir als erstes eine komplette Seiten-Url ab. Die Reihenfolge der If-Abfragen könnt ihr gerne beliebig verändern. Für meinen Test nehme ich nun eine Seite von T3n, die mir in letzter Zeit einige Besucher gebracht hat. T3n hat an der Stelle einen Link zu meinem kleinsten Blog System der Welt gesetzt. Über diese Url könnten zum einen Blogger und zum anderen Programmierer zur Seite kommen. Da ich vermute, dass die meisten davon Männer sind, hab ich mir gedacht, dass ein Banner mit nem schönen Mädel bestimmt ein paar Leads bringen kann. Dann blende ich mal eine FlirtCafe Werbung ein:</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">if</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$referrer</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #0000e6; background: #ffffe8;">'http://t3n.de/news/t3n-linktipps-amazon-blippy-nokia-n900-test-wordpress-266635/'</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$anzeige</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #0000e6; background: #ffffe8;">'&lt;!-- BEGIN PARTNER PROGRAM - DO NOT CHANGE THE PARAMETERS OF THE HYPERLINK --&gt;</span>
<span style="color: #0000e6; background: #ffffe8;">&lt;a href="http://partners.webmasterplan.com/click.asp?ref=292575&amp;site=5682&amp;type=b18&amp;bnb=18" target="_blank"&gt;</span>
<span style="color: #0000e6; background: #ffffe8;">&lt;img src="http://banners.webmasterplan.com/view.asp?ref=292575&amp;site=5682&amp;b=18" border="0" alt="Flirtcafe" width="468" height="60" /&gt;&lt;/a&gt;&lt;br /&gt;</span>
<span style="color: #0000e6; background: #ffffe8;">                &lt;!-- END PARTNER PROGRAM --&gt;'</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800080; background: #ffffe8;">}</span></pre>
<p>Nun ja, in unserem Beispiel wurde aber nach kostenlosen V-Servern gesucht. Kostenlose VServer wird man bei Affiliates wahrscheinlich nicht finden. Dann zeigen wir eben kostengünstige an. So zum Beispiel von HostEurope:</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">else</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">if</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #400000; background: #ffffe8;">strpos</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$referrer</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #0000e6; background: #ffffe8;">'q=vserver+kostenlos'</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #008c00; background: #ffffe8;">0</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$anzeige</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #0000e6; background: #ffffe8;">'&lt;!-- BEGIN PARTNER PROGRAM - DO NOT CHANGE THE PARAMETERS OF THE HYPERLINK --&gt;</span>
<span style="color: #0000e6; background: #ffffe8;">&lt;a href="http://partners.webmasterplan.com/click.asp?ref=292575&amp;site=1719&amp;type=b4&amp;bnb=4" target="_blank"&gt;</span>
<span style="color: #0000e6; background: #ffffe8;">&lt;img src="http://banners.webmasterplan.com/view.asp?ref=292575&amp;site=1719&amp;b=4" border="0" alt="Virtual Server 3.0" width="468" height="60" /&gt;&lt;/a&gt;&lt;br /&gt;</span>
<span style="color: #0000e6; background: #ffffe8;">                &lt;!-- END PARTNER PROGRAM --&gt;';</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800080; background: #ffffe8;">}</span></pre>
<p>Mit dem Parameter q werden in den meisten Suchmaschinen die Keywords angegeben. Hier müssen wir nun einfach unser vserver kostenlos eingeben und testen, ob die Position &gt;= 0 ist. Das vserver kostenlos ist im Referrer natürlich codiert. Die einfachste Variante ist, das Keyword in einer Suchmaschine einzugeben und sich den Parameter aus der Url zu ziehen.</p>
<p>Auf die gleiche Weise können wir auch den Referrer ohne das q= durchsuchen. Das sieht dann zum Beispiel so aus:</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #a65700; background: #ffffe8;">&lt;?php</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">else</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">if</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #400000; background: #ffffe8;">strpos</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$referrer</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #0000e6; background: #ffffe8;">'vserver+kostenlos'</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #008c00; background: #ffffe8;">0</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$anzeige</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #0000e6; background: #ffffe8;">'&lt;!-- BEGIN PARTNER PROGRAM - DO NOT CHANGE THE PARAMETERS OF THE HYPERLINK --&gt;</span>
<span style="color: #0000e6; background: #ffffe8;">&lt;a href="http://partners.webmasterplan.com/click.asp?ref=292575&amp;site=1719&amp;type=b4&amp;bnb=4" target="_blank"&gt;</span>
<span style="color: #0000e6; background: #ffffe8;">&lt;img src="http://banners.webmasterplan.com/view.asp?ref=292575&amp;site=1719&amp;b=4" border="0" alt="Virtual Server 3.0" width="468" height="60" /&gt;&lt;/a&gt;&lt;br /&gt;</span>
<span style="color: #0000e6; background: #ffffe8;">                &lt;!-- END PARTNER PROGRAM --&gt;';</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800080; background: #ffffe8;">}</span></pre>
<p>In diesem Fall könnten wir uns die Abfrage für die Suchmaschine sparen, aber das ist ja auch nur ein Beispiel.<br />
Zum Schluss muss natürlich die Anzeige ausgegeben werden. Das geht dann so:</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">echo</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$anzeige</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #a65700; background: #ffffe8;">?&gt;</span></pre>
<h3>Erweiterungen</h3>
<p>Natürlich kann man zu dem Verfahren auch noch seitenbasierende Anzeigen einbringen. Außerdem ist es eine Überlegung, für bestimmte Seiten auch nur bestimmte Affiliate-Anzeigen zu testen. Bei vielen Anzeigen wird die Seite dadurch schneller.</p>
<p>Desweiteren könnte man den Referrer in der Session speichern, weil wenn der Besucher eine weitere Seite aufruft, wird der neue Referrer von der eigenen Seite sein.</p>
<h3>Fazit</h3>
<p>Durch dieses Verfahren kann man seine Affiliate Einnahmen stark erhöhen. Wie stark genau hängt natürlich immer vom Partner und vom Thema ab.</p>

<img src="http://feeds.feedburner.com/~r/stevieswebsite/~4/PthLbb1DbUk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.stevieswebsite.de/2010/03/hohere-affiliate-einnahmen-durch-referreranalyse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.stevieswebsite.de/2010/03/hohere-affiliate-einnahmen-durch-referreranalyse/</feedburner:origLink></item>
		<item>
		<title>Datenbankklasse Teil 4 (CMS)</title>
		<link>http://feedproxy.google.com/~r/stevieswebsite/~3/cbMVLxDxJi8/</link>
		<comments>http://blog.stevieswebsite.de/2010/03/datenbankklasse-teil-4-cms/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 17:34:15 +0000</pubDate>
		<dc:creator>Stefan Wienströer</dc:creator>
				<category><![CDATA[Code & Blog]]></category>
		<category><![CDATA[dashboard]]></category>
		<category><![CDATA[menü]]></category>
		<category><![CDATA[user]]></category>

		<guid isPermaLink="false">http://blog.stevieswebsite.de/?p=4316</guid>
		<description><![CDATA[
Heute  geht es mal wieder um die Datenbank in unserem selbst erstellten CMS. Wie ihr alle wisst haben wir im letzten Beitrag die alte Datenbankverbindung komplett rausgenommen. Der Besucherbereich steht zur Zeit nicht zur Verfügung &#8211; Und das soll auch erst so bleiben. Wir werden in diesem und auch in den nächsten Artikeln erstmal nur [...]]]></description>
			<content:encoded><![CDATA[
<p>Heute  geht es mal wieder um die Datenbank in unserem <a title="selbst erstellten CMS" href="http://blog.stevieswebsite.de/eigenes-cms-erstellen/" target="_self">selbst erstellten CMS</a>. Wie ihr alle wisst haben wir im letzten Beitrag die alte Datenbankverbindung komplett rausgenommen. Der Besucherbereich steht zur Zeit nicht zur Verfügung &#8211; Und das soll auch erst so bleiben. Wir werden in diesem und auch in den nächsten Artikeln erstmal nur den Admin-bereich bearbeiten. Und das ganze nicht auf Klassen sondern auf Methoden. Denn wir sollten auf jeden Fall alles gründlich testen. Aus dem Grund nehmen wir erst die Funktionen, die auch (im Adminbereich) getestet werden können.<span id="more-4316"></span></p>
<p>Nun loggt euch mal alle in euren Admin-Bereich ein und schaut euch die MySQL-Fehler dort an. Was fällt euch auf?</p>
<p>Also mir ist dabei zuerst aufgefallen, dass ich mein Passwort immer wieder falsch eingegeben habe. Das war natürlich nicht so. In der Klasse <strong>/system/classes/user.php</strong> wurde noch mit der alten <strong>$dbprefix</strong>gearbeitet, die nicht mehr gültig ist.  Hier ist der neue Code für die Methode checkPassword:</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #a65700; background: #ffffe8;">&lt;?php</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> checkPassword</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$password</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$password</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;">$GLOBALS</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'db'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">EscapeString</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #400000; background: #ffffe8;">trim</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$password</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$name</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$GLOBALS</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'db'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">EscapeString</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #400000; background: #ffffe8;">trim</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">name</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$count</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$GLOBALS</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'db'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">ReadField</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"SELECT COUNT(*) FROM {'dbprefix'}user WHERE </span>
<span style="color: #0000e6; background: #ffffe8;">                        name='"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$name</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"' AND password = '"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #400000; background: #ffffe8;">md5</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$password</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"'"</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$count</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #008c00; background: #ffffe8;">1</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #a65700; background: #ffffe8;">?&gt;</span></pre>
<p>Nun könnt ihr euch anmelden. Nun bekommt ihr mit Sicherheit wieder eine Reihe an mysql-Fehlern. Diese werden in diesem Artikel behoben.</p>
<p>Los geht&#8217;s mit der Klasse <strong>/system/classes/menu.php</strong>. Hier wurden die auf der Startseite des Admin-Bereichs benötigten Methoden passend zur Datenbankklasse umgebaut:</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #a65700; background: #ffffe8;">&lt;?</span><span style="color: #000000; background: #ffffe8;">PHP</span>
<span style="color: #800000; background: #ffffe8; font-weight: bold;">class</span><span style="color: #000000; background: #ffffe8;"> Menu</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> display</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$globalstart</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$globalend</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$elementstart</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$elementend</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$class</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$rows</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$GLOBALS</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'db'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">ReadRows</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"SELECT title,href FROM {'dbprefix'}menu WHERE menuID = '"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"' ORDER BY id"</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">echo</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$globalstart</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$i</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #008c00; background: #ffffe8;">1</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">foreach</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$rows</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">as</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">echo</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$elementstart</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"&lt;a href=</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;">"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">href</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;">title=</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;">"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">title</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;"> </span>
<span style="color: #0000e6; background: #ffffe8;">           class=</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;">"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$class</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">" menue-"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"-"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$i</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;">&gt;"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">title</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"&lt;/a&gt;"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$elementend</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$i</span><span style="color: #808030; background: #ffffe8;">+</span><span style="color: #808030; background: #ffffe8;">+</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">echo</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$globalend</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">  </span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> getIdByName</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$name</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$name</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$GLOBALS</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'db'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">EscapeString</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #400000; background: #ffffe8;">strtolower</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #400000; background: #ffffe8;">trim</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$name</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$GLOBALS</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'db'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">ReadField</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"SELECT id FROM {'dbprefix'}menu_names WHERE lower(trim(name)) = '"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$name</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"' LIMIT 0,1"</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800080; background: #ffffe8;">}</span>

<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> displayEditable</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">mysql_query</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"SELECT id, title,href FROM "</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$dbpraefix</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"menu WHERE menuID = '"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"' ORDER BY id"</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">while</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">mysql_fetch_row</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">echo</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$elementstart</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"&lt;input name=</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;">"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #008c00; background: #ffffe8;">0</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"_title</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;">value=</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;">"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #008c00; background: #ffffe8;">1</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;"> /&gt;</span>
<span style="color: #0000e6; background: #ffffe8;">                          &lt;input name=</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;">"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #008c00; background: #ffffe8;">0</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"_href</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;">value=</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;">"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #008c00; background: #ffffe8;">2</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;"> /&gt;</span>
<span style="color: #0000e6; background: #ffffe8;">                          &lt;input type=</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;">submit</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;">name=</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;">"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #008c00; background: #ffffe8;">0</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"_delete</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;">value=</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;">X</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;">/&gt;&lt;br /&gt;"</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800080; background: #ffffe8;">}</span>

<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">addEntry</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$menu</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$title</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$href</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">global</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$dbpraefix</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">mysql_query</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"SELECT MAX(id) FROM "</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$dbpraefix</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"menu </span>
<span style="color: #0000e6; background: #ffffe8;">                        WHERE menuID = '"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$menu</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"'"</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">mysql_fetch_row</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #008c00; background: #ffffe8;">0</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">+</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #008c00; background: #ffffe8;">1</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">mysql_query</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"INSERT INTO "</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$dbpraefix</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"menu (id,menuID,title,href)</span>
<span style="color: #0000e6; background: #ffffe8;">                        VALUES('"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"','"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$menu</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"',</span>
<span style="color: #0000e6; background: #ffffe8;">                               '"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$title</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"','"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$href</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"')"</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">if</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$args</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'menu'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;">  </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$menu</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$args</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'title'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$title</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$args</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'href'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;">  </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$href</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      EventManager</span><span style="color: #808030; background: #ffffe8;">::</span><span style="color: #000000; background: #ffffe8;">raiseEvent</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"menu_entry_added"</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #0000e6; background: #ffffe8;">"../"</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$args</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800080; background: #ffffe8;">}</span>

<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> editEntry</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$menu</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$title</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$href</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">global</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$dbpraefix</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;">  </span><span style="color: #400000; background: #ffffe8;">mysql_query</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"UPDATE "</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$dbpraefix</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"menu SET </span>
<span style="color: #0000e6; background: #ffffe8;">                          href = '"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$href</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"', </span>
<span style="color: #0000e6; background: #ffffe8;">                          title = '"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$title</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"' </span>
<span style="color: #0000e6; background: #ffffe8;">                        WHERE id = '"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"' </span>
<span style="color: #0000e6; background: #ffffe8;">                          AND menuID = '"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$menu</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"'"</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">if</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$args</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'menu'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;">  </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$menu</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$args</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'title'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$title</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$args</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'href'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;">  </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$href</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$args</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'id'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;">    </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$href</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      EventManager</span><span style="color: #808030; background: #ffffe8;">::</span><span style="color: #000000; background: #ffffe8;">raiseEvent</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"menu_entry_edit"</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #0000e6; background: #ffffe8;">"../"</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$args</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800080; background: #ffffe8;">}</span>

<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> deleteEntry</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$menu</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">global</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$dbpraefix</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">mysql_query</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"DELETE FROM "</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$dbpraefix</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"menu WHERE menuID = '"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$menu</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"' AND id = '"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"'"</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">if</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">mysql_query</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"UPDATE "</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$dbpraefix</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"menu SET id = id - 1 WHERE id &gt; '"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"'"</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">if</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #000000; background: #ffffe8;">$args</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'menu'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;">  </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$menu</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #000000; background: #ffffe8;">$args</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'id'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">        EventManager</span><span style="color: #808030; background: #ffffe8;">::</span><span style="color: #000000; background: #ffffe8;">raiseEvent</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"menu_entry_deleted"</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #0000e6; background: #ffffe8;">"../"</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$args</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800080; background: #ffffe8;">}</span>

<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> create</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$name</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">global</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$dbpraefix</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">mysql_query</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"INSERT INTO "</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$dbpraefix</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"menu_names (name) VALUES ('"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$name</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"')"</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">if</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$args</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'name'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;">  </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$name</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      EventManager</span><span style="color: #808030; background: #ffffe8;">::</span><span style="color: #000000; background: #ffffe8;">raiseEvent</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"menu_created"</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #0000e6; background: #ffffe8;">"../"</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$args</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">mysql_insert_id</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800080; background: #ffffe8;">}</span>

<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">delete</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">global</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$dbpraefix</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">mysql_query</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"DELETE FROM "</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$dbpraefix</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"menu_names WHERE id = '"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"'"</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">if</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">mysql_query</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"DELETE FROM "</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$dbpraefix</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"menu WHERE menuID = '"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"'"</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">if</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #000000; background: #ffffe8;">$args</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'id'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;">  </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">        EventManager</span><span style="color: #808030; background: #ffffe8;">::</span><span style="color: #000000; background: #ffffe8;">raiseEvent</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"menu_deleted"</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #0000e6; background: #ffffe8;">"../"</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$args</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #a65700; background: #ffffe8;">?&gt;</span></pre>
<p>Gleiches bei <strong>/system/classes/dashboard.php</strong>:</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #a65700; background: #ffffe8;">&lt;?</span><span style="color: #000000; background: #ffffe8;">PHP</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">class</span><span style="color: #000000; background: #ffffe8;"> Dashboard</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$cols</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> loadWidgets</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">cols</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">loadWidgetsByColumn</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #008c00; background: #ffffe8;">1</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">cols</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">loadWidgetsByColumn</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #008c00; background: #ffffe8;">2</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">cols</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">loadWidgetsByColumn</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #008c00; background: #ffffe8;">3</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span><span style="color: #000000; background: #ffffe8;">  </span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">    </span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> loadWidgetsByColumn</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$columnId</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$columnId</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$GLOBALS</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'db'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">EscapeString</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$columnId</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$rows</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$GLOBALS</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'db'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">ReadRows</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"SELECT path FROM {'dbprefix'}dashboards </span>
<span style="color: #0000e6; background: #ffffe8;">                                        WHERE col = '"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$columnId</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"' AND id = '"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">id</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"'</span>
<span style="color: #0000e6; background: #ffffe8;">                                           ORDER BY row"</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">if</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$rows</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">foreach</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$rows</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">as</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">          </span><span style="color: #000000; background: #ffffe8;">$widgetData</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;">WidgetController</span><span style="color: #808030; background: #ffffe8;">::</span><span style="color: #000000; background: #ffffe8;">getWidgetData</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">path</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">          </span><span style="color: #000000; background: #ffffe8;">$widget</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;">WidgetController</span><span style="color: #808030; background: #ffffe8;">::</span><span style="color: #000000; background: #ffffe8;">getWidget</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$widgetData</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">          </span><span style="color: #000000; background: #ffffe8;">$widget</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #400000; background: #ffffe8;">load</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">          </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$widget</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">      </span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">    </span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> display</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">echo</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #0000e6; background: #ffffe8;">"&lt;div id=</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;">columns</span><span style="color: #0f69ff; background: #ffffe8;">\"</span><span style="color: #0000e6; background: #ffffe8;">&gt;"</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">displayColumn</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #008c00; background: #ffffe8;">0</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">displayColumn</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #008c00; background: #ffffe8;">1</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">displayColumn</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #008c00; background: #ffffe8;">2</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #a65700; background: #ffffe8;">?&gt;</span>
<span style="color: #000000; background: #ffffff;">        </span><span style="color: #a65700; background: #ffffff;">&lt;</span><span style="color: #800000; background: #ffffff; font-weight: bold;">script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js"</span><span style="color: #a65700; background: #ffffff;">&gt;</span><span style="color: #a65700; background: #ffffff;">&lt;/</span><span style="color: #800000; background: #ffffff; font-weight: bold;">script</span><span style="color: #a65700; background: #ffffff;">&gt;</span>
<span style="color: #000000; background: #ffffff;">        </span><span style="color: #a65700; background: #ffffff;">&lt;</span><span style="color: #800000; background: #ffffff; font-weight: bold;">script type="text/javascript" src="jquery-ui-personalized-1.6rc2.min.js"</span><span style="color: #a65700; background: #ffffff;">&gt;</span><span style="color: #a65700; background: #ffffff;">&lt;/</span><span style="color: #800000; background: #ffffff; font-weight: bold;">script</span><span style="color: #a65700; background: #ffffff;">&gt;</span>
<span style="color: #000000; background: #ffffff;">        </span><span style="color: #a65700; background: #ffffff;">&lt;</span><span style="color: #800000; background: #ffffff; font-weight: bold;">script type="text/javascript" src="inettuts.js"</span><span style="color: #a65700; background: #ffffff;">&gt;</span><span style="color: #a65700; background: #ffffff;">&lt;/</span><span style="color: #800000; background: #ffffff; font-weight: bold;">script</span><span style="color: #a65700; background: #ffffff;">&gt;</span>
<span style="color: #000000; background: #ffffff;">      </span><span style="color: #a65700; background: #ffffe8;">&lt;?</span><span style="color: #000000; background: #ffffe8;">PHP</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">    </span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> displayColumn</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #a65700; background: #ffffe8;">?&gt;</span>
<span style="color: #000000; background: #ffffff;">        </span><span style="color: #a65700; background: #ffffff;">&lt;</span><span style="color: #800000; background: #ffffff; font-weight: bold;">ul</span><span style="color: #274796; background: #ffffff;"> </span><span style="color: #074726; background: #ffffff;">id</span><span style="color: #808030; background: #ffffff;">=</span><span style="color: #0000e6; background: #ffffff;">"column</span><span style="color: #a65700; background: #ffffe8;">&lt;?</span><span style="color: #000000; background: #ffffe8;">PHP </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">echo</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #800080; background: #ffffe8;">;</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #a65700; background: #ffffe8;">?&gt;</span><span style="color: #0000e6; background: #ffffff;">"</span><span style="color: #274796; background: #ffffff;"> </span><span style="color: #074726; background: #ffffff;">class</span><span style="color: #808030; background: #ffffff;">=</span><span style="color: #0000e6; background: #ffffff;">"column"</span><span style="color: #a65700; background: #ffffff;">&gt;</span>
<span style="color: #000000; background: #ffffff;">          </span><span style="color: #a65700; background: #ffffe8;">&lt;?</span><span style="color: #000000; background: #ffffe8;">PHP</span>
<span style="color: #000000; background: #ffffe8;">            </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">if</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">cols</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">              </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">foreach</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">cols</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">as</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$widget</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">                </span><span style="color: #000000; background: #ffffe8;">$widget</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">display</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">              </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">            </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">          </span><span style="color: #a65700; background: #ffffe8;">?&gt;</span>
<span style="color: #000000; background: #ffffff;">        </span><span style="color: #a65700; background: #ffffff;">&lt;/</span><span style="color: #800000; background: #ffffff; font-weight: bold;">ul</span><span style="color: #a65700; background: #ffffff;">&gt;</span>
<span style="color: #000000; background: #ffffff;">      </span><span style="color: #a65700; background: #ffffe8;">&lt;?</span><span style="color: #000000; background: #ffffe8;">PHP</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #a65700; background: #ffffe8;">?&gt;</span></pre>

<img src="http://feeds.feedburner.com/~r/stevieswebsite/~4/cbMVLxDxJi8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.stevieswebsite.de/2010/03/datenbankklasse-teil-4-cms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.stevieswebsite.de/2010/03/datenbankklasse-teil-4-cms/</feedburner:origLink></item>
		<item>
		<title>Datenbankklasse Teil 3 (CMS)</title>
		<link>http://feedproxy.google.com/~r/stevieswebsite/~3/Mp85qBY4tgs/</link>
		<comments>http://blog.stevieswebsite.de/2010/03/datenbankklasse-teil-3-cms/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 18:43:03 +0000</pubDate>
		<dc:creator>Stefan Wienströer</dc:creator>
				<category><![CDATA[Code & Blog]]></category>
		<category><![CDATA[datenbankklasse]]></category>

		<guid isPermaLink="false">http://blog.stevieswebsite.de/?p=4310</guid>
		<description><![CDATA[
Nach dem Durcharbeiten dieses Artikels wird das selbst erstellte CMS erstmal unbenutzbar sein. Wir werden nämlich heute den alten Datenbankzugriff z.T. entfernen. Außerdem wird die Datenbankklasse auf mysqli umgestellt und bei 2 Klassen bauen wir bereits den neuen Datenbankzugriff ein.
Fangen wir an mit mysqli. Leider hatte ich mich zuvor noch nicht damit beschäftigt, so dass [...]]]></description>
			<content:encoded><![CDATA[
<p>Nach dem Durcharbeiten dieses Artikels wird das <a title="selbst erstellte CMS" href="http://blog.stevieswebsite.de/eigenes-cms-erstellen/" target="_self">selbst erstellte CMS</a> erstmal unbenutzbar sein. Wir werden nämlich heute den alten Datenbankzugriff z.T. entfernen. Außerdem wird die Datenbankklasse auf <strong>mysqli</strong> umgestellt und bei 2 Klassen bauen wir bereits den neuen Datenbankzugriff ein.<span id="more-4310"></span></p>
<p>Fangen wir an mit mysqli. Leider hatte ich mich zuvor noch nicht damit beschäftigt, so dass ich die Klasse <strong>/system/classes/mysql.php</strong> erst einmal auf dem veralteten MySQL-Zugriff ansteuerte. Heute gibts das Update auf mysqli. Evtl. werde ich in Kürze einen oder auch mehrere Beiträge  (außerhalb der CMS Aktion) über MySQLi veröffentlichen.</p>
<p>Nun gehts aber zur Klasse. MySQLi ist objektorientiert. Die Änderungen die ich gemacht habe werde ich an dieser Stelle nicht weiter erläutern. Wenn das MySQLi Tutorial fertig ist, setz ich an dieser Stelle einen Link dazu.</p>
<p>Hier ist der Code:</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #a65700; background: #ffffe8;">&lt;?</span><span style="color: #000000; background: #ffffe8;">PHP</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">class</span><span style="color: #000000; background: #ffffe8;"> MySQL </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">extends</span><span style="color: #000000; background: #ffffe8;"> DataBase</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">private</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$connection</span><span style="color: #800080; background: #ffffe8;">;</span>

<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> Execute</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">connection</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">query</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #400000; background: #ffffe8;">str_replace</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"{'dbprefix'}"</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">Prefix</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span><span style="color: #000000; background: #ffffe8;"> </span>
<span style="color: #000000; background: #ffffe8;">    </span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> GetTables</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;">  </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">connection</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">query</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"SHOW TABLES"</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">while</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">fetch_row</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #000000; background: #ffffe8;">$tables</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #008c00; background: #ffffe8;">0</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #400000; background: #ffffe8;">sort</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$tables</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$tables</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">      </span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> GetColumns</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$table</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$mysqlres</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">Execute</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"SHOW COLUMNS FROM "</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$table</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">while</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$mysqlres</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">fetch_object</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">      </span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> ReadField</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">Execute</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">fetch_row</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #008c00; background: #ffffe8;">0</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">      </span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> ReadRow</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">Execute</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">fetch_object</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">      </span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> ReadRows</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$mysqlRes</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">Execute</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">while</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$mysqlRes</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">fetch_object</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">    </span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> EscapeString</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$text</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">connection</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">real_escape_string</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$text</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">      </span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> Connect</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">connection</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">new</span><span style="color: #000000; background: #ffffe8;"> mysqli</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">Host</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">User</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">Password</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">Name</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">      </span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> Disconnect</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">connection</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #400000; background: #ffffe8;">close</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #a65700; background: #ffffe8;">?&gt;</span></pre>
<p>Nun kommen wir zum &#8220;schlimmen&#8221; Teil für heute: Bitte löscht die Datei <strong>/system/dbconnect.php</strong>!</p>
<p>Wenn ihr nun eure Startseite besucht, bekommt ihr wahrscheinlich ein paar schöne Fehlermeldungen. Da mein Testsystem online ist habe ich dort den PHP-Code auskommentiert und eine Fehlermeldung erstellt:</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #a65700;">&lt;</span><span style="color: #800000; font-weight: bold;">html</span><span style="color: #a65700;">&gt;</span>
  <span style="color: #a65700;">&lt;</span><span style="color: #800000; font-weight: bold;">head</span><span style="color: #a65700;">&gt;</span>
    <span style="color: #a65700;">&lt;</span><span style="color: #800000; font-weight: bold;">title</span><span style="color: #a65700;">&gt;</span>Vorschau nicht verfügbar<span style="color: #a65700;">&lt;/</span><span style="color: #800000; font-weight: bold;">title</span><span style="color: #a65700;">&gt;</span>
  <span style="color: #a65700;">&lt;/</span><span style="color: #800000; font-weight: bold;">head</span><span style="color: #a65700;">&gt;</span>
  <span style="color: #a65700;">&lt;</span><span style="color: #800000; font-weight: bold;">body</span><span style="color: #a65700;">&gt;</span>
    <span style="color: #a65700;">&lt;</span><span style="color: #800000; font-weight: bold;">h1</span><span style="color: #a65700;">&gt;</span>Vorschau zur Zeit nicht verfügbar<span style="color: #a65700;">&lt;/</span><span style="color: #800000; font-weight: bold;">h1</span><span style="color: #a65700;">&gt;</span>
    <span style="color: #a65700;">&lt;</span><span style="color: #800000; font-weight: bold;">p</span><span style="color: #a65700;">&gt;</span>Durch die Derzeitigen Arbeiten an der Datenbank des CMS<span style="color: #a65700;">&lt;</span><span style="color: #800000; font-weight: bold;">br</span><span style="color: #274796;"> </span><span style="color: #a65700;">/&gt;</span>
       ist die Vorschau zur Zeit nicht verfügbar<span style="color: #008c00;">.</span><span style="color: #a65700;">&lt;/</span><span style="color: #800000; font-weight: bold;">p</span><span style="color: #a65700;">&gt;</span>
    <span style="color: #a65700;">&lt;</span><span style="color: #800000; font-weight: bold;">p</span><span style="color: #a65700;">&gt;</span>Keine Angst, dass schafst Du auch ohne!<span style="color: #a65700;">&lt;</span><span style="color: #800000; font-weight: bold;">br</span><span style="color: #274796;"> </span><span style="color: #a65700;">/&gt;</span>
       Wenn nicht wird dir im <span style="color: #a65700;">&lt;</span><span style="color: #800000; font-weight: bold;">a</span><span style="color: #274796;"> </span><span style="color: #074726;">href</span><span style="color: #808030;">=</span><span style="color: #0000e6;">'http://forum.stevieswebsite.de/'</span><span style="color: #a65700;">&gt;</span>Forum<span style="color: #a65700;">&lt;/</span><span style="color: #800000; font-weight: bold;">a</span><span style="color: #a65700;">&gt;</span> geholfen<span style="color: #008c00;">.</span><span style="color: #a65700;">&lt;/</span><span style="color: #800000; font-weight: bold;">p</span><span style="color: #a65700;">&gt;</span>
  <span style="color: #a65700;">&lt;/</span><span style="color: #800000; font-weight: bold;">body</span><span style="color: #a65700;">&gt;</span>
<span style="color: #a65700;">&lt;/</span><span style="color: #800000; font-weight: bold;">html</span><span style="color: #a65700;">&gt;</span>
<span style="color: #a65700; background: #ffffe8;">&lt;?</span><span style="color: #000000; background: #ffffe8;">PHP</span>
<span style="color: #696969; background: #ffffe8;">/*</span>
<span style="color: #696969; background: #ffffe8;">  function __autoload($class_name){</span>
<span style="color: #696969; background: #ffffe8;">      require_once "system/classes/".strtolower($class_name).".php";</span>
<span style="color: #696969; background: #ffffe8;">  }</span>
<span style="color: #696969; background: #ffffe8;">  include("system/settings.php");</span>
<span style="color: #696969; background: #ffffe8;">  include("system/filterfilename.php");</span>
<span style="color: #696969; background: #ffffe8;">  include("system/sys.php");</span>
<span style="color: #696969; background: #ffffe8;">  $currentpage = new Page();</span>
<span style="color: #696969; background: #ffffe8;">  $currentpage-&gt;loadProperties(mysql_real_escape_string($_GET['include']));</span>
<span style="color: #696969; background: #ffffe8;">  if(!$_GET['skin']){</span>
<span style="color: #696969; background: #ffffe8;">    include(SkinController::getCurrentSkinPath()."/index.php");</span>
<span style="color: #696969; background: #ffffe8;">  }</span>
<span style="color: #696969; background: #ffffe8;">  else{</span>
<span style="color: #696969; background: #ffffe8;">    include('system/skins/'.$_GET['skin']."/index.php");</span>
<span style="color: #696969; background: #ffffe8;">  }</span>
<span style="color: #696969; background: #ffffe8;">  */</span>
<span style="color: #a65700; background: #ffffe8;">?&gt;</span></pre>
<p>Mit der Umstellung fangen wir nämllich im Admin-Bereich an. Dort können wir ruhig Fehlermeldungen haben, die Besucher so nicht sehen werden. Mit den ersten Änderungen fangen wir jetzt an, damit auch beim Login nichts zu sehen ist.</p>
<p>Zunächst muss der include für die dbconnect.php entfernt werden. Zum anderen muss die Verbindung zur Datenank aufgebaut werden. Das geht so (<strong>/admin/index.php</strong>):</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #a65700; background: #ffffe8;">&lt;?</span><span style="color: #000000; background: #ffffe8;">PHP</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #400000; background: #ffffe8;">session_start</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> __autoload</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$class_name</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">require_once</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #0000e6; background: #ffffe8;">"../system/classes/"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #400000; background: #ffffe8;">strtolower</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$class_name</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">".php"</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">include</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"../system/settings.php"</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">include</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"../system/filterfilename.php"</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">include</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"../system/sys.php"</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #000000; background: #ffffe8;">$db</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">new</span><span style="color: #000000; background: #ffffe8;"> MySQL</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">'../system/dbsettings.php'</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #000000; background: #ffffe8;">$db</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">Connect</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #a65700; background: #ffffe8;">?&gt;</span></pre>
<p>Weiter gehts mit der Klasse <strong>/system/classes/customcss.php</strong>. Hier wird die Methode getStylePath umgestellt:</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> getStylePath</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$GLOBALS</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'db'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">EscapeString</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$GLOBALS</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'db'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">ReadField</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"SELECT stylePath FROM {'dbprefix'}custom_css</span>
<span style="color: #0000e6; background: #ffffe8;">                                        WHERE id = '"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$id</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"'"</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span></pre>
<p>Hier seht ihr auch schon die Vorteile der Klasse: Für das Select brauchen wir nur noch eine einzige Zeile!</p>
<p>Da man auch als Nicht-Admin versuchen kann sich einzuloggen müssen wir auch die Klasse <strong>/system/classes/user.php</strong> bearbeiten:</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #a65700; background: #ffffe8;">&lt;?</span><span style="color: #000000; background: #ffffe8;">PHP</span>
<span style="color: #800000; background: #ffffe8; font-weight: bold;">class</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">User</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">var</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$name</span><span style="color: #800080; background: #ffffe8;">;</span>

<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> login</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$name</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$password</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">global</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$dbpraefix</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$password</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$GLOBALS</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'db'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">EscapeString</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #400000; background: #ffffe8;">trim</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$password</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">name</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$GLOBALS</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'db'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">EscapeString</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #400000; background: #ffffe8;">trim</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$name</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">if</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">checkPassword</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$password</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">true</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">else</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">false</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800080; background: #ffffe8;">}</span>

<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> checkPassword</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$password</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">global</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$dbpraefix</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$password</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;">$GLOBALS</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'db'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">EscapeString</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #400000; background: #ffffe8;">trim</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$password</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$name</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$GLOBALS</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'db'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">EscapeString</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #400000; background: #ffffe8;">trim</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">name</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #000000; background: #ffffe8;">$count</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$GLOBALS</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #0000e6; background: #ffffe8;">'db'</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">ReadField</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"SELECT COUNT(*) FROM "</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$dbpraefix</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"user WHERE </span>
<span style="color: #0000e6; background: #ffffe8;">                        name='"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$name</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"' AND password = '"</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #400000; background: #ffffe8;">md5</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$password</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #0000e6; background: #ffffe8;">"'"</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$count</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #008c00; background: #ffffe8;">1</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">  </span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> logout</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">     </span><span style="color: #400000; background: #ffffe8;">session_destroy</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #a65700; background: #ffffe8;">?&gt;</span></pre>
<p>Das wars auch schon für heute. Wie oben beschrieben werden wir uns als nächstes den Admin-Bereich vorknüpfen. Dieser wird dann auf das neue DB-System umgestellt. Wenn der fertig ist gehen wir systematisch alle Dateien durch und suchen veraltete mysql-Zugriffe. Danach kann dann der Besucher-Bereich wieder online gehen.</p>

<img src="http://feeds.feedburner.com/~r/stevieswebsite/~4/Mp85qBY4tgs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.stevieswebsite.de/2010/03/datenbankklasse-teil-3-cms/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://blog.stevieswebsite.de/2010/03/datenbankklasse-teil-3-cms/</feedburner:origLink></item>
		<item>
		<title>1.000 Kommentare auf SteviesWebsite.de</title>
		<link>http://feedproxy.google.com/~r/stevieswebsite/~3/9a-D2aMTXGA/</link>
		<comments>http://blog.stevieswebsite.de/2010/03/1-000-kommentare-auf-stevieswebsite-de/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 13:34:26 +0000</pubDate>
		<dc:creator>Stefan Wienströer</dc:creator>
				<category><![CDATA[SteviesWebsite.de]]></category>
		<category><![CDATA[jubiläum]]></category>
		<category><![CDATA[kommentare]]></category>

		<guid isPermaLink="false">http://blog.stevieswebsite.de/?p=4306</guid>
		<description><![CDATA[
SteviesWebsite hat seit heute die 1.000 Kommentar Marke erreicht. Der Autor vom 1.000ten Kommentar ist Martin.
An dieser Stelle muss ich mich natürlich bei allen bedanken, die immer fleißig Kommentare geschrieben haben. Ihr seit die besten!

]]></description>
			<content:encoded><![CDATA[
<p>SteviesWebsite hat seit heute die 1.000 Kommentar Marke erreicht. Der Autor vom 1.000ten Kommentar ist <a href="http://www.schnaeppchenfuchs.com" target="_self">Martin</a>.</p>
<p>An dieser Stelle muss ich mich natürlich bei allen bedanken, die immer fleißig Kommentare geschrieben haben. Ihr seit die besten!</p>

<img src="http://feeds.feedburner.com/~r/stevieswebsite/~4/9a-D2aMTXGA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.stevieswebsite.de/2010/03/1-000-kommentare-auf-stevieswebsite-de/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://blog.stevieswebsite.de/2010/03/1-000-kommentare-auf-stevieswebsite-de/</feedburner:origLink></item>
		<item>
		<title>Statistik: Eine Woche Internationaler Blog</title>
		<link>http://feedproxy.google.com/~r/stevieswebsite/~3/-A59_9Fij98/</link>
		<comments>http://blog.stevieswebsite.de/2010/03/statistik-eine-woche-internationaler-blog/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 19:03:57 +0000</pubDate>
		<dc:creator>Stefan Wienströer</dc:creator>
				<category><![CDATA[SteviesWebsite.de]]></category>
		<category><![CDATA[bloggen]]></category>
		<category><![CDATA[international]]></category>

		<guid isPermaLink="false">http://blog.stevieswebsite.de/?p=4280</guid>
		<description><![CDATA[
Gestern vor einer Woche habe ich meinen englischen Blog SteviesWebsite.com gestartet. Leider bin ich noch nicht dazu gekommen viel zu schreiben, aber immerhin sind es schon 4 Beiträge im Internationel Blog.
Viel interessanter ist es aber bei den Backlinks. Insgesamt wurde über SteviesWebsite.com in 8 anderen Blogs berichtet. Außerdem gibt es noch einen Link vom spanischen Softonic. [...]]]></description>
			<content:encoded><![CDATA[
<p>Gestern vor einer Woche habe ich meinen englischen Blog SteviesWebsite.com gestartet. Leider bin ich noch nicht dazu gekommen viel zu schreiben, aber immerhin sind es schon 4 Beiträge im Internationel Blog.<img title="Weiterlesen..." src="http://blog.stevieswebsite.de/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif" alt="" /></p>
<p><span id="more-4280"></span>Viel interessanter ist es aber bei den Backlinks. Insgesamt wurde über SteviesWebsite.com in 8 anderen Blogs berichtet. Außerdem gibt es noch einen Link vom spanischen Softonic. Die Berichte über die Seite bzw. deren Artikel sind in bisher 5 verschiedenen Sprachen (Deutsch, English, Spanisch, Rumänisch &amp; Russisch).</p>
<p>Von den Besuchern her sieht es noch nicht ganz so gut aus. Insgesamt konnte ich 232 Besucher verzeichnen, da bekommt das deutsche SteviesWebsite noch mehr an einem Tag XD</p>
<p>Aber interessant ist das Karten Overlay:</p>
<div id="attachment_4282" class="wp-caption alignnone" style="width: 410px"><a href="http://blog.stevieswebsite.de/wp-content/uploads/2010/03/stevieswebsite-kartenoverlay.jpg"><img class="size-full wp-image-4282" title="Kartenoverlay SteviesWebsite.com" src="http://blog.stevieswebsite.de/wp-content/uploads/2010/03/stevieswebsite-kartenoverlay.jpg" alt="Kartenoverlay SteviesWebsite.com" width="400" height="192" /></a><p class="wp-caption-text">Kartenoverlay SteviesWebsite.com</p></div>
<p>Im großen und ganzen finde ich den Einstieg in die internationale Blogsphere trotz noch rel. weniger Besucher gelungen. Ich werde dort in Kürze auch öfters bloggen.</p>

<img src="http://feeds.feedburner.com/~r/stevieswebsite/~4/-A59_9Fij98" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.stevieswebsite.de/2010/03/statistik-eine-woche-internationaler-blog/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://blog.stevieswebsite.de/2010/03/statistik-eine-woche-internationaler-blog/</feedburner:origLink></item>
		<item>
		<title>Keyword Optimierung mit Google Analytics</title>
		<link>http://feedproxy.google.com/~r/stevieswebsite/~3/rOUXkvjmGes/</link>
		<comments>http://blog.stevieswebsite.de/2010/03/keyword-optimierung-mit-google-analytics/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 12:55:43 +0000</pubDate>
		<dc:creator>Stefan Wienströer</dc:creator>
				<category><![CDATA[SEO / SMO]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[keyword optimierung]]></category>

		<guid isPermaLink="false">http://blog.stevieswebsite.de/?p=4253</guid>
		<description><![CDATA[
Für die Keyword Optimierung muss man als erstes wissen, für welche Keywords es sich überhaupt lohnt, zu optimieren. Ich habe mir ein Verfahren ausgedacht, mit welchem man ein Ranking der zu optimierenden Keywords bekommt.
Im Dezember habe ich ein ähnliches Verfahren über Google Webmaster Tools vorgestellt. Für die Methode mit Google Analytics müsst ihr allerdings etwas [...]]]></description>
			<content:encoded><![CDATA[
<p>Für die <strong>Keyword Optimierung</strong> muss man als erstes wissen, für welche Keywords es sich überhaupt lohnt, zu optimieren. Ich habe mir ein Verfahren ausgedacht, mit welchem man ein Ranking der zu optimierenden Keywords bekommt.</p>
<p>Im Dezember habe ich ein ähnliches Verfahren über <a title="Google Webmaster Tools" href="http://blog.stevieswebsite.de/2009/12/keyword-optimierung-mit-google-webmaster-tools/" target="_self">Google Webmaster Tools</a> vorgestellt. Für die Methode mit Google Analytics müsst ihr allerdings etwas mehr Zeit investieren.<span id="more-4253"></span></p>
<p>Um die Methode durchzuführen benötigst Du ein Datenbanksystem. Dadurch ist es möglich mit den Keywords &#8220;rumzuspielen&#8221;.</p>
<p>Ich habe mit 2 Tabellen angefangen:</p>
<ul>
<li><strong>pages</strong>: Beinhaltet die Url der Seiten</li>
<li><strong>keywords</strong>: Beinhaltet Position und Anzahl der Besucher der Keywords</li>
</ul>
<p>Die Create-Statements sehen folgendermaßen aus:</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #800000; font-weight: bold;">CREATE</span> <span style="color: #800000; font-weight: bold;">TABLE</span> <span style="color: #800000; font-weight: bold;">pages</span><span style="color: #808030;">(</span>
    <span style="color: #808030;">[</span><span style="color: #800000; font-weight: bold;">id</span><span style="color: #808030;">]</span> <span style="color: #808030;">[</span><span style="color: #800000; font-weight: bold;">int</span><span style="color: #808030;">]</span> <span style="color: #800000; font-weight: bold;">IDENTITY</span><span style="color: #808030;">(</span><span style="color: #008c00;">1</span><span style="color: #808030;">,</span><span style="color: #008c00;">1</span><span style="color: #808030;">)</span> <span style="color: #800000; font-weight: bold;">NOT</span> <span style="color: #800000; font-weight: bold;">NULL</span><span style="color: #808030;">,</span>
    <span style="color: #808030;">[</span>url<span style="color: #808030;">]</span> <span style="color: #808030;">[</span>nvarchar<span style="color: #808030;">]</span><span style="color: #808030;">(</span><span style="color: #008c00;">255</span><span style="color: #808030;">)</span> <span style="color: #800000; font-weight: bold;">COLLATE</span> Latin1_General_CI_AS <span style="color: #800000; font-weight: bold;">NULL</span><span style="color: #808030;">,</span>
 <span style="color: #800000; font-weight: bold;">CONSTRAINT</span> <span style="color: #808030;">[</span>PK_pages<span style="color: #808030;">]</span> <span style="color: #800000; font-weight: bold;">PRIMARY</span> <span style="color: #800000; font-weight: bold;">KEY</span> <span style="color: #800000; font-weight: bold;">CLUSTERED</span>
<span style="color: #808030;">(</span>
    <span style="color: #808030;">[</span><span style="color: #800000; font-weight: bold;">id</span><span style="color: #808030;">]</span> <span style="color: #800000; font-weight: bold;">ASC</span>
<span style="color: #808030;">)</span><span style="color: #800000; font-weight: bold;">WITH</span> <span style="color: #808030;">(</span>PAD_INDEX  <span style="color: #808030;">=</span> <span style="color: #800000; font-weight: bold;">OFF</span><span style="color: #808030;">,</span> IGNORE_DUP_KEY <span style="color: #808030;">=</span> <span style="color: #800000; font-weight: bold;">OFF</span><span style="color: #808030;">)</span> <span style="color: #800000; font-weight: bold;">ON</span> <span style="color: #808030;">[</span><span style="color: #800000; font-weight: bold;">PRIMARY</span><span style="color: #808030;">]</span>
<span style="color: #808030;">)</span> <span style="color: #800000; font-weight: bold;">ON</span> <span style="color: #808030;">[</span><span style="color: #800000; font-weight: bold;">PRIMARY</span><span style="color: #808030;">]</span></pre>
<pre style="color: #000000; background: #ffffff;"><span style="color: #800000; font-weight: bold;">CREATE</span> <span style="color: #800000; font-weight: bold;">TABLE</span> <span style="color: #808030;">[</span>dbo<span style="color: #808030;">]</span><span style="color: #808030;">.</span><span style="color: #808030;">[</span>keywords<span style="color: #808030;">]</span><span style="color: #808030;">(</span>
    <span style="color: #808030;">[</span><span style="color: #800000; font-weight: bold;">page</span><span style="color: #808030;">]</span> <span style="color: #808030;">[</span><span style="color: #800000; font-weight: bold;">int</span><span style="color: #808030;">]</span> <span style="color: #800000; font-weight: bold;">NULL</span><span style="color: #808030;">,</span>
    <span style="color: #808030;">[</span>keyword<span style="color: #808030;">]</span> <span style="color: #808030;">[</span>nvarchar<span style="color: #808030;">]</span><span style="color: #808030;">(</span><span style="color: #008c00;">255</span><span style="color: #808030;">)</span> <span style="color: #800000; font-weight: bold;">COLLATE</span> Latin1_General_CI_AS <span style="color: #800000; font-weight: bold;">NULL</span><span style="color: #808030;">,</span>
    <span style="color: #808030;">[</span>visitors<span style="color: #808030;">]</span> <span style="color: #808030;">[</span>nvarchar<span style="color: #808030;">]</span><span style="color: #808030;">(</span><span style="color: #008c00;">255</span><span style="color: #808030;">)</span> <span style="color: #800000; font-weight: bold;">COLLATE</span> Latin1_General_CI_AS <span style="color: #800000; font-weight: bold;">NULL</span><span style="color: #808030;">,</span>
    <span style="color: #808030;">[</span>rank<span style="color: #808030;">]</span> <span style="color: #808030;">[</span><span style="color: #800000; font-weight: bold;">int</span><span style="color: #808030;">]</span> <span style="color: #800000; font-weight: bold;">NULL</span><span style="color: #808030;">,</span>
    <span style="color: #808030;">[</span>lastvisit<span style="color: #808030;">]</span> <span style="color: #808030;">[</span>smalldatetime<span style="color: #808030;">]</span> <span style="color: #800000; font-weight: bold;">NULL</span>
<span style="color: #808030;">)</span> <span style="color: #800000; font-weight: bold;">ON</span> <span style="color: #808030;">[</span><span style="color: #800000; font-weight: bold;">PRIMARY</span><span style="color: #808030;">]</span></pre>
<p>Diese SQL-Statements gelten für den SQL-Server. Sie können für andere Datenbanksysteme leicht abweichen.</p>
<h3>Keyword Abfrage in Analytics</h3>
<p>Nun kommen wir zu Analytics. Da wir für die Keywords einzelne Seiten und nicht die ganze Website optimieren wollen, müssen wir uns auch die Top Keywords zur jeweiligen Seite heraussuchen. Dazu benötigen wir als erstes die Top-Websiten. Diese sieht man unter Content-&gt;Top Webseiten. Ich selbst habe erst mal nur die Top 10 Seiten analysiert.</p>
<p>Nun musst Du auf die Top-Seite klicken und du kommst zum Beispiel zu folgender Übersicht:</p>
<div id="attachment_4261" class="wp-caption alignnone" style="width: 424px"><a href="http://blog.stevieswebsite.de/wp-content/uploads/2010/03/analytics-content-details.jpg"><img class="size-full wp-image-4261 " title="Analytics Content-Details" src="http://blog.stevieswebsite.de/wp-content/uploads/2010/03/analytics-content-details.jpg" alt="Analytics Content-Details" width="414" height="561" /></a><p class="wp-caption-text">Analytics Content-Details</p></div>
<p>An dieser Stelle legst Du in der Tabelle pages einen neuen Eintrag mit der Url der jeweiligen Top-Seite an.</p>
<p>Um nun zu den Keywords der Seite zu kommen musst Du auf &#8220;Einstiegs-Keywords&#8221; klicken. Dann kommt zum Beispiel sowas dabei heraus:</p>
<div id="attachment_4265" class="wp-caption alignnone" style="width: 421px"><a href="http://blog.stevieswebsite.de/wp-content/uploads/2010/03/einstiegs-keywords-analytics.jpg"><img class="size-full wp-image-4265   " title="Analytics Einstiegs Keywords" src="http://blog.stevieswebsite.de/wp-content/uploads/2010/03/einstiegs-keywords-analytics.jpg" alt="Analytics Einstiegs Keywords" width="411" height="544" /></a><p class="wp-caption-text">Analytics Einstiegs Keywords</p></div>
<h3>Keywords eintragen</h3>
<p>Als nächstes trägst Du erst mal die Top 15 Keywords mit der Anzahl der Besucher in deine keywords-Tabelle ein. Schreibe in die lastvisit-Spalte das aktuelle Datum. In die Spalte page kommt die id der Zeile, der pages Tabelle.</p>
<p>Nun gib das jeweilige Keyword bei Google ein und trage die Platz deiner Seite in die Spalte rank ein. Sollte ein Keyword nicht unter den Top 50 Keywords sein, trage dort eine -1 ein.</p>
<p>Das Keyword Eintragen dauert seine Zeit. Ich habe ca. 2 Stunden für 10 Seiten mit 15 Keywords gebraucht.</p>
<h3>Auswertung</h3>
<p>Jetzt kommt der Teil auf den Du gewartet hast! Mit dem folgenden Select-Statement bekommst ein Ranking der Keywords, auf die Du optimieren solltest:</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #800000; font-weight: bold;">SELECT</span> keyword<span style="color: #808030;">,</span> rank<span style="color: #808030;">,</span> rank <span style="color: #808030;">*</span> rank <span style="color: #808030;">*</span> visitors <span style="color: #800000; font-weight: bold;">FROM</span> keywords <span style="color: #800000; font-weight: bold;">WHERE</span> rank <span style="color: #808030;">&gt;</span> <span style="color: #008c00;">1</span> <span style="color: #800000; font-weight: bold;">ORDER</span> <span style="color: #800000; font-weight: bold;">BY</span> rank <span style="color: #808030;">*</span> rank <span style="color: #808030;">*</span> visitors <span style="color: #800000; font-weight: bold;">DESC</span></pre>
<h3>Vorteile des Verfahrens</h3>
<p>Natürlich kann man auch durch die Webmaster Tools der Suchmaschinen zu optimierende Keywords herausfinden. Doch die Keywords in Analytics zeigen wirklich für welche Seiten sich die Besucher überhaupt interessieren (also wo Besucher auch geklickt haben). Was bringt es auf Platz 1 im Ranking zu sein, ohne das das Thema den Besucher interessiert?</p>
<p>Desweiteren wird nicht nur eine Suchmaschine berücksichtigt sondern alle.</p>

<img src="http://feeds.feedburner.com/~r/stevieswebsite/~4/rOUXkvjmGes" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.stevieswebsite.de/2010/03/keyword-optimierung-mit-google-analytics/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://blog.stevieswebsite.de/2010/03/keyword-optimierung-mit-google-analytics/</feedburner:origLink></item>
		<item>
		<title>Datenbankklasse Teil 2 (CMS)</title>
		<link>http://feedproxy.google.com/~r/stevieswebsite/~3/WyB_aXPTzh0/</link>
		<comments>http://blog.stevieswebsite.de/2010/03/datenbankklasse-teil-2-cms/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 18:54:21 +0000</pubDate>
		<dc:creator>Stefan Wienströer</dc:creator>
				<category><![CDATA[Code & Blog]]></category>
		<category><![CDATA[mysql klasse]]></category>

		<guid isPermaLink="false">http://blog.stevieswebsite.de/?p=4245</guid>
		<description><![CDATA[
In der Datenbankklasse unseres CMS geht es heute hauptsächlich um die Klasse MySQL lediglich kleine Änderungen der Klasse DataBase müssen noch gemacht werden.
Und genau damit fangen wir an. Wie im letzt en Beitrag geschrieben, hatte ich die abstrakte Klasse noch nicht gestet -&#62; Ich hatte ja schließlich keine MySQL Klasse.
Da ich in der geerbten Klasse nicht [...]]]></description>
			<content:encoded><![CDATA[
<p>In der Datenbankklasse <a title="unseres CMS" href="http://blog.stevieswebsite.de/eigenes-cms-erstellen/" target="_self">unseres CMS</a> geht es heute hauptsächlich um die Klasse MySQL lediglich kleine Änderungen der Klasse DataBase müssen noch gemacht werden.</p>
<p>Und genau damit fangen wir an. Wie im letzt en Beitrag geschrieben, hatte ich die abstrakte Klasse noch nicht gestet -&gt; Ich hatte ja schließlich keine MySQL Klasse.<span id="more-4245"></span></p>
<p>Da ich in der geerbten Klasse nicht auf private Vatiablen der Superklasse zugreifen kann, musste ich diese auf Public setzen. Das ist auch nicht weiter schlimm, denn Plugins &amp; Co können sich die Daten so oder so aus der Config Datei ziehen.</p>
<p>Der neue Code der <strong>/system/classes/database.php</strong> sieht so aus:</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #a65700; background: #ffffe8;">&lt;?</span><span style="color: #000000; background: #ffffe8;">PHP</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">abstract</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">class</span><span style="color: #000000; background: #ffffe8;"> DataBase</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">  </span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$Name</span><span style="color: #000000; background: #ffffe8;">     </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #0000e6; background: #ffffe8;">''</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$Prefix</span><span style="color: #000000; background: #ffffe8;">   </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #0000e6; background: #ffffe8;">''</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$User</span><span style="color: #000000; background: #ffffe8;">     </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #0000e6; background: #ffffe8;">''</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$Password</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #0000e6; background: #ffffe8;">''</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$Host</span><span style="color: #000000; background: #ffffe8;">     </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #0000e6; background: #ffffe8;">''</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$Type</span><span style="color: #000000; background: #ffffe8;">     </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #0000e6; background: #ffffe8;">''</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">abstract</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> Execute</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">abstract</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> GetTables</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">abstract</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> GetColumns</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$table</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">abstract</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> ReadField</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">abstract</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> ReadRow</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">abstract</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> ReadRows</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">abstract</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> Connect</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">abstract</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> Disconnect</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">__construct</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$config</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">include</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$config</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">Prefix</span><span style="color: #000000; background: #ffffe8;">   </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$dbpraefix</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">Host</span><span style="color: #000000; background: #ffffe8;">     </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$dbhost</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">Password</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$dbpassword</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">User</span><span style="color: #000000; background: #ffffe8;">     </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$dbuser</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">Name</span><span style="color: #000000; background: #ffffe8;">     </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$db</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">Connect</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">  </span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #a65700; background: #ffffe8;">?&gt;</span></pre>
<p>Kommen wir zur Klasse MySQL. Dort werden die abstrakten Methoden umgesetzt. Die Verbindung wird in der privaten Variable $connection gespeichert. Der Tabellenprefix wird nun immer über <em>{&#8216;dbprefix&#8217;} </em>angegeben. Dieser wird automatisch in den Datenbankklassen ersetzt. Das hat den Vorteil, das wir nicht immer mit global $dbprefix arbeiten müssen.</p>
<p>Eine weitere Neuerung in unseren Datenbankabfragen ist, dass wir aus der Klasse nur noch Objekte zurückgeben.</p>
<p>Die neue Datenbankklasse liegt in <strong>/system/classes/mysql.php</strong> und hat den folgenden Quellcode:</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #a65700; background: #ffffe8;">&lt;?</span><span style="color: #000000; background: #ffffe8;">PHP</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">class</span><span style="color: #000000; background: #ffffe8;"> MySQL </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">extends</span><span style="color: #000000; background: #ffffe8;"> DataBase</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">private</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$connection</span><span style="color: #800080; background: #ffffe8;">;</span>

<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> Execute</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">mysql_query</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #400000; background: #ffffe8;">str_replace</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"{'dbprefix'}"</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">Prefix</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span><span style="color: #000000; background: #ffffe8;"> </span>
<span style="color: #000000; background: #ffffe8;">    </span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> GetTables</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">mysql_query</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"SHOW TABLES"</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">while</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">mysql_fetch_row</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">          </span><span style="color: #000000; background: #ffffe8;">$tables</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #008c00; background: #ffffe8;">0</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #400000; background: #ffffe8;">sort</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$tables</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$tables</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">      </span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> GetColumns</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$table</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$mysqlres</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">Execute</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #0000e6; background: #ffffe8;">"SHOW COLUMNS FROM "</span><span style="color: #808030; background: #ffffe8;">.</span><span style="color: #000000; background: #ffffe8;">$table</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">while</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">mysql_fetch_object</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$mysqlres</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">      </span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> ReadField</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">Execute</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">mysql_fetch_row</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #008c00; background: #ffffe8;">0</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">      </span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> ReadRow</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">Execute</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">mysql_fetch_object</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">      </span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> ReadRows</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$mysqlRes</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">Execute</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">while</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">mysql_fetch_object</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$mysqlRes</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #808030; background: #ffffe8;">[</span><span style="color: #808030; background: #ffffe8;">]</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$row</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">return</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$res</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">      </span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> Connect</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">connection</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">mysql_connect</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">Host</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">User</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">Password</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #400000; background: #ffffe8;">mysql_select_db</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">Name</span><span style="color: #808030; background: #ffffe8;">,</span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">connection</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">      </span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> Disconnect</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #400000; background: #ffffe8;">mysql_close</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">connection</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">    </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #a65700; background: #ffffe8;">?&gt;</span></pre>
<p>Der nächste Schritt wird der wohl brutalste Schritt, den wir bisher gemacht haben. Wir werden nämlich als nächstes die alte Datenbankverbindung entfernen. Dann wird das CMS erst mal überhaupt nicht funktionieren. Nach und nach werden wir dann die Klassen und Dateien auf das neue Datennbankmodell umstellen.</p>

<img src="http://feeds.feedburner.com/~r/stevieswebsite/~4/WyB_aXPTzh0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.stevieswebsite.de/2010/03/datenbankklasse-teil-2-cms/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://blog.stevieswebsite.de/2010/03/datenbankklasse-teil-2-cms/</feedburner:origLink></item>
		<item>
		<title>Feeds analysieren und Besucher gewinnen</title>
		<link>http://feedproxy.google.com/~r/stevieswebsite/~3/-u-WvSWxESQ/</link>
		<comments>http://blog.stevieswebsite.de/2010/03/feeds-analysieren-und-besucher-gewinnen/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 17:55:17 +0000</pubDate>
		<dc:creator>Stefan Wienströer</dc:creator>
				<category><![CDATA[Konzepzion]]></category>
		<category><![CDATA[analyse]]></category>
		<category><![CDATA[feedburner]]></category>

		<guid isPermaLink="false">http://blog.stevieswebsite.de/?p=4228</guid>
		<description><![CDATA[
Die Analyse von Feeds bringt viele Vorteile mit sich. Man kann so zum Beispiel Wissen, welche Artikel oft gelesen werden und bei welchen Artikeln der Besucher darüber die Website besucht. 
Viele Blogger denken, dass sie mit verkürzten Feeds mehr Besucher auf die eigene Seite bekommen als mit Fullfeeds. Ich bin eher anderer Meinung, aber das kann muss [...]]]></description>
			<content:encoded><![CDATA[
<p>Die Analyse von Feeds bringt viele Vorteile mit sich. Man kann so zum Beispiel Wissen, welche Artikel oft gelesen werden und bei welchen Artikeln der Besucher darüber die Website besucht. </p>
<p>Viele Blogger denken, dass sie mit verkürzten Feeds mehr Besucher auf die eigene Seite bekommen als mit <strong>Fullfeeds</strong>. Ich bin eher anderer Meinung, aber das kann muss jeder für sich selbst herausfinden. Dies und noch mehr kann man mit dem Tool <a title="Feedburner" href="http://feedburner.google.com" target="_self">Feedburner</a> analysieren. <span id="more-4228"></span></p>
<p>Ihr müsst um Feedburner zu nutzen dort euren Feed anlegen. Dann bekommt ihr eine Url, welche ihr euren Usern als Feed anbieten könnt. Dieser Feed beinhaltet Tracking-Code, so dass Statistiken gespeichert werden können. Bei Wordpress kann man auch alle Feedleser zum Feedburner weiterleiten. Dies geht über das Plugin <strong>FeedBurner FeedSmith</strong>. </p>
<p>Um die erweiterte Analyse freizuschalten geht ihr auf Analyse und dann auf TotalStats. Hier bekommt ihr folgendes zu sehen: </p>
<div id="attachment_4229" class="wp-caption alignnone" style="width: 471px"><a href="http://blog.stevieswebsite.de/wp-content/uploads/2010/03/feedburner-totalstats.jpg"><img class="size-full wp-image-4229 " title="Feedburner TotalStats" src="http://blog.stevieswebsite.de/wp-content/uploads/2010/03/feedburner-totalstats.jpg" alt="Feedburner TotalStats" width="461" height="414" /></a><p class="wp-caption-text">Feedburner TotalStats</p></div>
<p>Normalerweise sind diese Dienste nur in der <strong>Pro-Version</strong> verfügbar, bei mir konnte ich nach einiger Zeit auch ohne Pro-Version darauf zugreifen. </p>
<p>Wenn ihr nun nach ein paar Tage / Wochen erste Zahlen erfasst habt geht es an die Auswertung. Dort kann man zum Beispiel folgendes machen: </p>
<h3>Element Nutzung</h3>
<p>Diese Statistik gibt die Views und Clicks der einzelnen Artikel wieder. Das ist meiner Meinung nach ein interessantes Mittel, um die eben besprochene Problemetik bzgl. Fullfeed zu testen. Bei mir sieht das zur Zeit so aus: </p>
<div id="attachment_4232" class="wp-caption alignnone" style="width: 447px"><a href="http://blog.stevieswebsite.de/wp-content/uploads/2010/03/feedburner-element-nutzung.jpg"><img class="size-full wp-image-4232 " title="Feedburner Element Nutzung" src="http://blog.stevieswebsite.de/wp-content/uploads/2010/03/feedburner-element-nutzung.jpg" alt="Feedburner Element Nutzung" width="437" height="596" /></a><p class="wp-caption-text">Feedburner Element Nutzung</p></div>
<p>Eine schöne Verbesserung an der Stelle wäre eine Sortierungsmöglichkeit und die Klickrate. Aber auch so sind die Statistiken sehr interessant. </p>
<h3>Abonennten</h3>
<p>Über die Abonennten kann man sehen, mit welchen Feedreadern die Feeds abonniert sind. Einen wirklichen Nutzen sehe ich darin aber eher nicht. Bei mir ist der Google Reader auf Platz 1: </p>
<div id="attachment_4235" class="wp-caption alignnone" style="width: 472px"><a href="http://blog.stevieswebsite.de/wp-content/uploads/2010/03/feedburner-abonennten.jpg"><img class="size-full wp-image-4235" title="Feedburner Abonennten" src="http://blog.stevieswebsite.de/wp-content/uploads/2010/03/feedburner-abonennten.jpg" alt="Feedburner Abonennten" width="462" height="713" /></a><p class="wp-caption-text">Feedburner Abonennten</p></div>
<h3>Map Overlay</h3>
<div id="attachment_4236" class="wp-caption alignnone" style="width: 448px"><a href="http://blog.stevieswebsite.de/wp-content/uploads/2010/03/feedburner-map-overlay.jpg"><img class="size-full wp-image-4236 " title="Feedburner Map Overlay" src="http://blog.stevieswebsite.de/wp-content/uploads/2010/03/feedburner-map-overlay.jpg" alt="Feedburner Map Overlay" width="438" height="582" /></a><p class="wp-caption-text">Feedburner Map Overlay</p></div>
<p>Hier sind man ähnlich wie in Analytics, woher die Leser kommen. Leider kann man an dieser Stelle jedoch nur die Länder sehen. </p>
<h3>Fazit </h3>
<p>Durch die Analyse und anschließender Optimierung des Feeds kann man seine Abonnenenten gezielt dazu bringe, die Website zu besuchen. Alle Feedleser sind quasi Stammkunden. Um diese solltet ihr euch gut kümmern!</p>

<img src="http://feeds.feedburner.com/~r/stevieswebsite/~4/-u-WvSWxESQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.stevieswebsite.de/2010/03/feeds-analysieren-und-besucher-gewinnen/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://blog.stevieswebsite.de/2010/03/feeds-analysieren-und-besucher-gewinnen/</feedburner:origLink></item>
		<item>
		<title>Der Slogan für ContentLion heißt…</title>
		<link>http://feedproxy.google.com/~r/stevieswebsite/~3/PiUp2W_Y8uA/</link>
		<comments>http://blog.stevieswebsite.de/2010/03/der-slogan-fur-contentlion-heist/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 17:31:29 +0000</pubDate>
		<dc:creator>Stefan Wienströer</dc:creator>
				<category><![CDATA[Code & Blog]]></category>
		<category><![CDATA[contentlion]]></category>
		<category><![CDATA[sloagn]]></category>

		<guid isPermaLink="false">http://blog.stevieswebsite.de/?p=4224</guid>
		<description><![CDATA[
&#8230; The King Of Content. Bei der Abstimmung hatte jeder für etwas anderes gestimmt, so dass meine Stimme entscheidend war. The King Of Content hieß in der Auswahl zwar nur King Of Content doch ich finde so kann man es besser sprechen:
ContentLion &#8211; The King Of Content
Dann können wir ja bald königlich an der Datenbank [...]]]></description>
			<content:encoded><![CDATA[
<p>&#8230; The King Of Content. Bei der Abstimmung hatte jeder für etwas anderes gestimmt, so dass meine Stimme entscheidend war. The King Of Content hieß in der Auswahl zwar nur King Of Content doch ich finde so kann man es besser sprechen:<span id="more-4224"></span></p>
<p>ContentLion &#8211; The King Of Content</p>
<p>Dann können wir ja bald königlich an der Datenbank Klasse arbeiten <img src='http://blog.stevieswebsite.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>

<img src="http://feeds.feedburner.com/~r/stevieswebsite/~4/PiUp2W_Y8uA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.stevieswebsite.de/2010/03/der-slogan-fur-contentlion-heist/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.stevieswebsite.de/2010/03/der-slogan-fur-contentlion-heist/</feedburner:origLink></item>
		<item>
		<title>Datenbankklasse Teil 1</title>
		<link>http://feedproxy.google.com/~r/stevieswebsite/~3/1SS194JuulA/</link>
		<comments>http://blog.stevieswebsite.de/2010/03/datenbankklasse-teil-1/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 18:21:11 +0000</pubDate>
		<dc:creator>Stefan Wienströer</dc:creator>
				<category><![CDATA[Code & Blog]]></category>
		<category><![CDATA[datenbankklasse]]></category>

		<guid isPermaLink="false">http://blog.stevieswebsite.de/?p=4215</guid>
		<description><![CDATA[
Heute fangen wir in unserem CMS ein etwas größeres Thema an: Wir erstellen eine Datenklasse und benutzen sie im ganzen System. Der Vorschlag kam vom Johann, der mich auch erst einmal davon überzeugen musste. Desweiteren gibt es heute einen neuen Einstiegspunkt, siehe unten.
Ab jetzt werden alle Sachen, die irgendwas mit Datenbanken zu tun haben (mysql_query, [...]]]></description>
			<content:encoded><![CDATA[
<p>Heute fangen wir in unserem CMS ein etwas größeres Thema an: Wir erstellen eine Datenklasse und benutzen sie im ganzen System. Der Vorschlag kam vom <a title="Johann" href="http://photohunters.de" target="_self">Johann</a>, der mich auch erst einmal davon überzeugen musste. Desweiteren gibt es heute einen neuen Einstiegspunkt, siehe unten.<span id="more-4215"></span></p>
<p>Ab jetzt werden alle Sachen, die irgendwas mit Datenbanken zu tun haben (mysql_query, mysql_fetch_row) in dieser Klasse abgebildet. Die Datenbankklasse ist allerdings abstrakt. Es wird die erbende Klasse MySQL geben, die zum Beispiel alle MySQL-Sachen regelt. Das System hat folgende Vorteile:</p>
<ul>
<li>Wir können die Datenbankpräfix automatisiert einfügen</li>
<li>Wir können später ohne große Probleme auch Datenbanken wie SQLite oder den Sql Server unterstützen</li>
<li>Wir können Datenbankfehler an einer Stelle abhandeln und zum Beispiel dem Admin eine Mail schicken</li>
<li>Wir können uns in der Klasse automatisiert gegen Sql Injektions schützen (mysql_real_escape_string)</li>
<li>&#8230;</li>
</ul>
<p>Wir müssen diese Änderung sofort durchführen, da es später noch schwieriger wird das ganze umzusetzen. Im Kern des CMS werden alleine einige Erweiterungen hinzukommen, die wir sonst ersetzten müssten. Von Plugins mal ganz abgesehen.</p>
<p>Genug geredet, jetzt kommt der Quellcode. Johann hat mir schon ein paar Vorschläge für die Umsetzung der Klasse gemacht, die ich noch geschickt erweitert habe. Vielleicht habt ihr es schon vergessen: Wir haben bereits eine Datenbankklasse (siehe /system/classes/mysql.php). Diese ist hauptsächlich für unseren derzeit pausierenden DB-Manager zuständig. Einige Methoden habe ich in die abstrakte Klasse übernommen, andere ausgelassen (system/classes/database.php):</p>
<pre style="color: #000000; background: #ffffff;"><span style="color: #a65700; background: #ffffe8;">&lt;?</span><span style="color: #000000; background: #ffffe8;">PHP</span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">abstract</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">class</span><span style="color: #000000; background: #ffffe8;"> DataBase</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">  </span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$Name</span><span style="color: #000000; background: #ffffe8;">      </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #0000e6; background: #ffffe8;">''</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">  </span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">private</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$prefix</span><span style="color: #000000; background: #ffffe8;">   </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #0000e6; background: #ffffe8;">''</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">private</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$server</span><span style="color: #000000; background: #ffffe8;">   </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #0000e6; background: #ffffe8;">''</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">private</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$user</span><span style="color: #000000; background: #ffffe8;">     </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #0000e6; background: #ffffe8;">''</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">private</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$password</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #0000e6; background: #ffffe8;">''</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">private</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$host</span><span style="color: #000000; background: #ffffe8;">     </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #0000e6; background: #ffffe8;">''</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">abstract</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> Execute</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">abstract</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> GetTables</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">abstract</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> GetColumns</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$table</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">abstract</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> ReadField</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">abstract</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> ReadRow</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">abstract</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> ReadRows</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$sql</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">abstract</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> Connect</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">abstract</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">function</span><span style="color: #000000; background: #ffffe8;"> Disconnect</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">public</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #400000; background: #ffffe8;">__construct</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$config</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">{</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #800000; background: #ffffe8; font-weight: bold;">include</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #000000; background: #ffffe8;">$config</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">prefix</span><span style="color: #000000; background: #ffffe8;">   </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$dbpraefix</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">host</span><span style="color: #000000; background: #ffffe8;">     </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$dbhost</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">password</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$dbpassword</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">user</span><span style="color: #000000; background: #ffffe8;">     </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$dbuser</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-&gt;</span><span style="color: #000000; background: #ffffe8;">Name</span><span style="color: #000000; background: #ffffe8;">     </span><span style="color: #808030; background: #ffffe8;">=</span><span style="color: #000000; background: #ffffe8;"> </span><span style="color: #000000; background: #ffffe8;">$db</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">        </span><span style="color: #000000; background: #ffffe8;">$</span><span style="color: #800000; background: #ffffe8; font-weight: bold;">this</span><span style="color: #808030; background: #ffffe8;">-</span><span style="color: #808030; background: #ffffe8;">&gt;</span><span style="color: #000000; background: #ffffe8;">Connect</span><span style="color: #808030; background: #ffffe8;">(</span><span style="color: #808030; background: #ffffe8;">)</span><span style="color: #800080; background: #ffffe8;">;</span>
<span style="color: #000000; background: #ffffe8;">      </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #000000; background: #ffffe8;">  </span>
<span style="color: #000000; background: #ffffe8;">  </span><span style="color: #800080; background: #ffffe8;">}</span>
<span style="color: #a65700; background: #ffffe8;">?&gt;</span></pre>
<p>Als Entschädigung für die bevorstehende Arbeit habe ich euch einen neuen Einstiegpunkt gemacht:</p>
<p><a href="http://blog.stevieswebsite.de/download/132.zip">http://blog.stevieswebsite.de/download/132.zip</a></p>
<p>Wenn ihr Probleme mit ContentLion habt meldet euch am besten im Forum.</p>

<img src="http://feeds.feedburner.com/~r/stevieswebsite/~4/1SS194JuulA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.stevieswebsite.de/2010/03/datenbankklasse-teil-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://blog.stevieswebsite.de/2010/03/datenbankklasse-teil-1/</feedburner:origLink></item>
	</channel>
</rss>
