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

<channel>
	<title>lemmingzshadow.net &#187; PHP</title>
	<atom:link href="http://lemmingzshadow.net/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://lemmingzshadow.net</link>
	<description>a webdevel&#039;s weblog</description>
	<lastBuildDate>Fri, 13 Aug 2010 09:10:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>SFTP Upload mit PHP</title>
		<link>http://lemmingzshadow.net/301/sftp-upload-mit-php/</link>
		<comments>http://lemmingzshadow.net/301/sftp-upload-mit-php/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 19:49:27 +0000</pubDate>
		<dc:creator>Lemmingz Shadow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SFTP]]></category>
		<category><![CDATA[Webtechnik]]></category>

		<guid isPermaLink="false">http://lemmingzshadow.net/?p=301</guid>
		<description><![CDATA[Seit einiger Zeit bietet PHP mit der SSH2-Library einige Methoden um das SFTP-Subsystem von SSH zu nutzen. Leider fehlt eine Methode um Dateien per SFTP hochzuladen. Zwar existiert mit der Methode ssh2_scp_send eine Möglichkeit Dateien über einer SSH-Verbindung hochzuladen, allerdings wird hier das SCP-Protokoll benutzt. Sollte der verwendete Account serverseitig jedoch auf SFTP beschränkt sein [...]]]></description>
			<content:encoded><![CDATA[<p>Seit einiger Zeit bietet PHP mit der <a href="http://de.php.net/manual/en/book.ssh2.php">SSH2-Library</a> einige Methoden um das SFTP-Subsystem von SSH zu nutzen. Leider fehlt eine Methode um Dateien per SFTP hochzuladen. Zwar existiert mit der Methode <em>ssh2_scp_send</em> eine Möglichkeit Dateien über einer SSH-Verbindung hochzuladen, allerdings wird hier das SCP-Protokoll benutzt. Sollte der verwendete Account serverseitig jedoch auf SFTP beschränkt sein funktioniert diese Methode nicht.<br />
Um dennoch Dateien per SFTP hochladen zu können kann man sich mit der Methode <em>fopen</em> und dem <a href="http://de.php.net/manual/en/wrappers.ssh2.php">ssh2-sftp Wrapper</a> eine funktionierende Lösung basteln. <span id="more-301"></span></p>
<p>Eine sftp-upload Funktion könnte beispielsweise so aussehen:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> sftp_putfile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$local_file</span><span style="color: #339933;">,</span> <span style="color: #000088;">$remote_file</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mode</span> <span style="color: #339933;">=</span> <span style="color: #208080;">0664</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$remote_file</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$remote_file</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'/'</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">'/'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$remote_file</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$remote_file</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$sftp_stream</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ssh2.sftp://'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sftp_connection</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$remote_file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'w'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$sftp_stream</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_sftp_error</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">7</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000088;">$data_to_send</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$local_file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$data_to_send</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_sftp_error</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">7</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sftp_stream</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data_to_send</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_sftp_error</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">7</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sftp_stream</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Diese beispielhafte Methode stammt aus einer SFTP Klasse die ich vor kurzem für eine Projekt geschrieben habe. Die komplette Klasse habe ich <a href="http://lemmingzshadow.net/wp-content/uploads/2010/08/class.sftp.php.txt">hier zum download</a> hinterlegt.</p>
]]></content:encoded>
			<wfw:commentRss>http://lemmingzshadow.net/301/sftp-upload-mit-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter API mit oAuth nutzen</title>
		<link>http://lemmingzshadow.net/295/twitter-api-mit-oauth-nutzen/</link>
		<comments>http://lemmingzshadow.net/295/twitter-api-mit-oauth-nutzen/#comments</comments>
		<pubDate>Sun, 06 Jun 2010 11:58:48 +0000</pubDate>
		<dc:creator>Lemmingz Shadow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[oAuth]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Webtechnik]]></category>

		<guid isPermaLink="false">http://lemmingzshadow.net/?p=295</guid>
		<description><![CDATA[Am 30. Juni wird Twitter die Standard Authentifizierung der Twitter API abschalten. Bis dahin sollte man seine Scripte so umstellen, dass sie oAuth benutzen. Wie lange man dafür noch Zeit hat erfährt man übrigens hier: http://www.countdowntooauth.com/ Da es mittlerweile schon einige PHP Klassen gibt welche oAuth unterstützen ist die Umstellung relativ einfach zu bewerkstelligen. Hier [...]]]></description>
			<content:encoded><![CDATA[<p>Am 30. Juni wird Twitter die Standard Authentifizierung der Twitter API abschalten. Bis dahin sollte man seine Scripte so umstellen, dass sie oAuth benutzen. Wie lange man dafür noch Zeit hat erfährt man übrigens hier: <a href="http://www.countdowntooauth.com/">http://www.countdowntooauth.com/</a> <img src='http://lemmingzshadow.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Da es mittlerweile schon einige PHP Klassen gibt welche oAuth unterstützen ist die Umstellung relativ einfach zu bewerkstelligen. Hier ein kleines Tutorial:</p>
<p>Zunächst muss man auf <a href="http://dev.twitter.com/">http://dev.twitter.com/</a> eine neue &#8220;App&#8221; anlegen. (Vorher einloggen) Der Prozess ist selbsterklärend. Nachdem man die App angelegt hat erhält man einen &#8220;Consumer key&#8221; und ein &#8220;Consumer secret&#8221;. Diese beiden Strings benötigen wir später für die Authentifizierung. Weiterhin braucht man den &#8220;oAuth Token&#8221; und das &#8220;oAuth Token Secret&#8221;. Um diese zu bekommen oben auf <a href="http://dev.twitter.com/apps">Your apps</a> klicken. Dann auf &#8220;Edit Details&#8221; der entsprechen App. Nach zwei weiteren Klicks auf &#8220;Application detail&#8221; (rechts) und &#8220;My Access Token&#8221; (auch rechts) hat man alle benötigten Tokens und Passwörter zusammen die man in einem PHP-Script benötigt.<span id="more-295"></span></p>
<p>Nun kann man entweder selbst damit anfangen eine oAuth Authentifizierung zu coden oder man benutzt eine der fertigen Klassen. Ich habe für dieses Beispiel eine fertige <a href="http://github.com/abraham/twitteroauth">oAuth Klasse von Abraham Williams</a> benutzt.<br />
Hier ein kleines Codebeispiel für die Authentifizierung mit oAuth und dem anschließenden posten eines Tweets:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$consumer_key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'insert_key'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$consumer_secret</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'insert_secret'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$access_key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'insert_key'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$access_secret</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'insert_secret'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'twitteroauth/twitteroauth.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$twitter</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> TwitterOAuth <span style="color: #009900;">&#40;</span><span style="color: #000088;">$consumer_key</span><span style="color: #339933;">,</span> <span style="color: #000088;">$consumer_secret</span><span style="color: #339933;">,</span> <span style="color: #000088;">$access_key</span><span style="color: #339933;">,</span> <span style="color: #000088;">$access_secret</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$twitter</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'statuses/update'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'status'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Testing oAuth. Please ignore...'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://lemmingzshadow.net/295/twitter-api-mit-oauth-nutzen/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Konstanten für Datumsformate in PHP</title>
		<link>http://lemmingzshadow.net/245/konstanten-fuer-datumsformate-in-php/</link>
		<comments>http://lemmingzshadow.net/245/konstanten-fuer-datumsformate-in-php/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 17:06:06 +0000</pubDate>
		<dc:creator>Lemmingz Shadow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://lemmingzshadow.net/?p=245</guid>
		<description><![CDATA[Andauernd vergesse ich dass es Sie gibt: Konstanten für verschiedene Datumsformate. Ausserdem sind Sie (wie ich finde) bei php.net nur schlecht dokumentiert. Darum hier nun für alle ein Codebeispiel und der Link zu den restlichen Konstanten. Folgender Code würde z.B. soetwas ausgeben: Wednesday, 10-Feb-10 18:02:49 CET 1 echo date&#40;DATE_COOKIE, time&#40;&#41;&#41;; Alle dieser nützlichen Konstanten sind [...]]]></description>
			<content:encoded><![CDATA[<p>Andauernd vergesse ich dass es Sie gibt: Konstanten für verschiedene Datumsformate. Ausserdem sind Sie (wie ich finde) bei php.net nur schlecht dokumentiert. Darum hier nun für alle ein Codebeispiel und der Link zu den restlichen Konstanten.<br />
Folgender Code würde z.B. soetwas ausgeben:<br />
<em>Wednesday, 10-Feb-10 18:02:49 CET</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span>DATE_COOKIE<span style="color: #339933;">,</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Alle dieser nützlichen Konstanten sind hier dokumentiert: <a href="http://php.net/manual/en/class.datetime.php"><strong>Datumskonstanten bei php.net</strong></a></p>
]]></content:encoded>
			<wfw:commentRss>http://lemmingzshadow.net/245/konstanten-fuer-datumsformate-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: isset vs. array_key_exists</title>
		<link>http://lemmingzshadow.net/232/php-isset-vs-array_key_exists/</link>
		<comments>http://lemmingzshadow.net/232/php-isset-vs-array_key_exists/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 16:32:29 +0000</pubDate>
		<dc:creator>Lemmingz Shadow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webtechnik]]></category>

		<guid isPermaLink="false">http://lemmingzshadow.net/?p=232</guid>
		<description><![CDATA[Heute möchte ich mal ein paar Worte zu den Funktionen isset und array_key_exists loswerden. Genauer angeschaut habe ich mir das Verhalten der beiden Funktionen beim Prüfen ob ein Feld in einem Array existiert. Bevor ich zur Performance komme möchte ich jedoch noch auf ein paar Besonderheiten der Funktionen eingehen: Um zu prüfen ob ein Feld [...]]]></description>
			<content:encoded><![CDATA[<p>Heute möchte ich mal ein paar Worte zu den Funktionen <em>isset</em> und <em>array_key_exists</em> loswerden. Genauer angeschaut habe ich mir das Verhalten der beiden Funktionen beim Prüfen ob ein Feld in einem Array existiert. Bevor ich zur Performance komme möchte ich jedoch noch auf ein paar Besonderheiten der Funktionen eingehen:</p>
<p>Um zu prüfen ob ein Feld in einem Array existiert ohne dabei Fehlermeldungen zu erzeugen muss vor beiden Funktionen <em>isset</em> und <em>is_array</em> aufgerufen werden.</p>
<p><strong>Beispiel:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$foo</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$foo</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$foo</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'bar'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$check</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$foo</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$foo</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">array_key_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'bar'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$foo</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$check</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><span id="more-232"></span><br />
Der Grund hierfür ist nicht immer direkt ersichtlich, deswegen hier die Erklärung:<br />
<em>isset</em> erzeugt zwar keine Notices oder Warnings falls die Variable $foo nicht gesetzt ist, aber es gibt ein anderes Problem. Wenn die Variable $foo vom Typ String ist würde die Prüfung auf ein Array-Feld mit isset true liefern.</p>
<p><strong>Beispiel:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$foo</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'bar'</span><span style="color: #339933;">;</span>
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$foo</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'bar'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// true</span></pre></td></tr></table></div>

<p>Dieses Verhalten erklärt die Notwendigkeit von <em>is_array</em> vor dem Prüfen mit isset. Das <em>isset</em> vor dem <em>is_array</em> ist schließlich notwendig weil <em>is_array</em> eine Notice erzeugt wenn die zu prüfende Variable nicht gesetzt ist.</p>
<p>Die Funktion<em> array_key_exists</em> erzeugt ein Warning falls das zu prüfende Array nicht existiert oder die übergebene Variable nicht vom Typ Array ist. Somit ist hier ebenfalls die Nutzung von <em>is_array</em> in Kombination mit <em>isset</em> zu empfehlen.</p>
<p>Mit obiger Syntax lässt sich nun eigentlich in beide Fällen prüfen ob ein Feld im einem Array existiert. Dabei ist jedoch eine Ausnahme zu beachten, und zwar der Wert null in einem Array.</p>
<p><strong>Beispiel:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$foo</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'bar'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$foo</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'bar'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// false</span>
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array_key_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'bar'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$foo</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// true</span></pre></td></tr></table></div>

<p>Damit sollte die Verwendung der beiden Funktionen geklärt sein (falls nicht bitte ich um einen kurzen Kommentar), aber es bleibt die Frage: Welche der beiden Varianten ist schneller, <em>isset</em> oder <em>array_key_exists</em>?<br />
Hier das Ergebnis:<br />
<a href="http://lemmingzshadow.net/wp-content/uploads/2009/10/performance_array_key_exists.jpg"><img src="http://lemmingzshadow.net/wp-content/uploads/2009/10/performance_array_key_exists-150x150.jpg" alt="performance_array_key_exists" title="performance_array_key_exists" width="150" height="150" class="alignnone size-thumbnail wp-image-240" style="float: left; margin: 5px;" /></a> <a href="http://lemmingzshadow.net/wp-content/uploads/2009/10/performance_isset.jpg"><img src="http://lemmingzshadow.net/wp-content/uploads/2009/10/performance_isset-150x150.jpg" alt="performance_isset" title="performance_isset" width="150" height="150" class="alignnone size-thumbnail wp-image-241" style="float: left; margin: 5px;" /></a></p>
<div style="clear: both;"></div>
<p>Klare Sache: <em>isset</em> ist wesentlich schneller als <em>array_key_exists</em>, 10000 Prüfungen dauert nur etwa halb so lange.<br />
Zudem fallen zwei weitere Dinge auf: <em>isset</em> taucht nicht in den Xdebug Ergebnissen auf. Die Begründung ist relativ simpel. Da <em>isset</em> keine Funktion ist sondern lediglich ein Sprachkonstrukt, taucht dieses nicht in den Xdebug-Listings auf. Weiterhin fällt auf, dass is_array fast genauso viel Zeit in Anspruch nimmt wie <em>array_key_exists</em>. Hierfür habe ich leider keine Erklärung, denn ich hätte erwarten dass <em>array_key_exists</em> im Gegensatz zu <em>is_array</em> eine Array-Funktion und damit wesentlich langsamer ist. Falls jemand eine Erklärung hat: Immer her damit!</p>
]]></content:encoded>
			<wfw:commentRss>http://lemmingzshadow.net/232/php-isset-vs-array_key_exists/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP-Performance: preg_match vs. strpos</title>
		<link>http://lemmingzshadow.net/214/php-performance-preg_match-vs-strpos/</link>
		<comments>http://lemmingzshadow.net/214/php-performance-preg_match-vs-strpos/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 17:40:42 +0000</pubDate>
		<dc:creator>Lemmingz Shadow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Webtechnik]]></category>

		<guid isPermaLink="false">http://lemmingzshadow.net/?p=214</guid>
		<description><![CDATA[Folgendes Problem hat man als Coder sicherlich öfters zu lösen: Man möchte wissen ob String A, String B oder String C (u.s.w) in einem Text vorkommen. Beispielsweise holt man eine Liste mit Keywords aus einer Datenbank und möchte wissen ob eins dieser Keywords in einem Text vorkommt. Um das Problem zu lösen gibt es sicherlich [...]]]></description>
			<content:encoded><![CDATA[<p>Folgendes Problem hat man als Coder sicherlich öfters zu lösen: Man möchte wissen ob String A,  String B oder String C (u.s.w) in einem Text vorkommen. Beispielsweise holt man eine Liste mit Keywords aus einer Datenbank und möchte wissen ob eins dieser Keywords in einem Text vorkommt.<br />
Um das Problem zu lösen gibt es sicherlich zig verschiedene Möglichkeiten. Die gängigsten sehen wahrscheinlich in etwas so aus:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">stripos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$haystack</span><span style="color: #339933;">,</span> <span style="color: #000088;">$needle</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$found</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$needle</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/is'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$haystack</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$found</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>		
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><span id="more-214"></span><br />
Hierbei wird eine Sache schnell klar: Bei mehr als einem Suchsting wird das ganze etwas komplizierter. Man muss die strpos Variante für jeden Suchstring einmal laufen lassen, bzw. in der zweiten Variante die Suchstrings mit einem oder verknüpfen.<br />
Die Frage ist nun: Welche der beiden Varianten ist schneller?</p>
<p>Ich habe ein kurzes Testscript gebastelt, und hier ist das Ergebnis:<br />
<a href="http://lemmingzshadow.net/wp-content/uploads/2009/10/performance_preg_match.jpg"><img src="http://lemmingzshadow.net/wp-content/uploads/2009/10/performance_preg_match-150x150.jpg" alt="performance_preg_match" title="performance_preg_match" width="150" height="150" class="alignnone size-thumbnail wp-image-217" style="margin: 5px; float: left;" /></a> <a href="http://lemmingzshadow.net/wp-content/uploads/2009/10/performance_strpos.jpg"><img src="http://lemmingzshadow.net/wp-content/uploads/2009/10/performance_strpos-150x150.jpg" alt="performance_strpos" title="performance_strpos" width="150" height="150" class="alignnone size-thumbnail wp-image-228" style="margin: 5px; float: left;" /></a>
<div style="clear: both;"></div>
<p>Die preg_match Varinate ist um einiges schneller. Ausserdem fällt auf das bei 10000 Durchläufen des Testscript die Funktion stripos öfter als 10000 mal ausgeführt wird. Die liegt daran, dass die Funktion so oft aufgerufen werden muss, bis der erste Suchstring gefunden wurde (oder eben keiner der gesuchten Strings im Text vorkommt). Durch die oder-Verknüpfung der einzelnen Strings muss preg_match bei jedem Durchlauf nur einmal ausgeführt werden.<br />
Klar wird also: Je mehr Suchstrings in einem Text gesucht werden sollen, desto langsamer wird die strpos Variante im Vergleich zu preg_match, obwohl natürlich auch der reguläre Ausdruck bei einem längeren Suchstring etwas langsamer wird.</p>
<p>Zum Schluss noch das Script mit dem ich dieses Verhalten getestet habe:<br />
<a href='http://lemmingzshadow.net/wp-content/uploads/2009/10/performance_preg_vs_strpos_php.txt'>performance_preg_vs_strpos.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://lemmingzshadow.net/214/php-performance-preg_match-vs-strpos/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MySQLi und UTF-8</title>
		<link>http://lemmingzshadow.net/182/mysqli-und-utf-8/</link>
		<comments>http://lemmingzshadow.net/182/mysqli-und-utf-8/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 10:12:35 +0000</pubDate>
		<dc:creator>Lemmingz Shadow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MySQLi]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://lemmingzshadow.net/?p=182</guid>
		<description><![CDATA[Um auf MySQL Datenbanken zuzugreifen verwende ich gerne die MySQLi-Erweiterung von PHP. Vor ein paar Tagen musste ich dabei feststellen, dass es einen fiesen Fehler in der Methode &#8220;set_charset&#8221; gibt der zur Folge hat, dass die UTF-8 Unterstützung teilweise nicht funktioniert. Wenn man eine Verbindung zur Datenbank herstellt und dabei den Konstruktor der MySQLi-Klasse verwendet [...]]]></description>
			<content:encoded><![CDATA[<p>Um auf MySQL Datenbanken zuzugreifen verwende ich gerne die MySQLi-Erweiterung von PHP. Vor ein paar Tagen musste ich dabei feststellen, dass es einen fiesen Fehler in der Methode <em>&#8220;set_charset&#8221;</em> gibt der zur Folge hat, dass die UTF-8 Unterstützung teilweise nicht funktioniert. Wenn man eine Verbindung zur Datenbank herstellt und dabei den Konstruktor der MySQLi-Klasse verwendet funktioniert das anschließende setzten des UTF-8 Zeichensatzes nicht. Wenn man die Verbindung allerdings mit der Methode <em>&#8220;real_connect&#8221;</em> öffnet funktioniert es wunderbar.<br />
<span id="more-182"></span><br />
Ein Codebeispiel:</p>
<p>Funktioniert <strong>nicht</strong>:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">mysqli</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> mysqli<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;host&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;user&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;pass&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;db&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_charset</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'uft8'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">character_set_name</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Ausgabe: latin1</span></pre></td></tr></table></div>

<p>Funktioniert:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">mysqli</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysqli_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">real_connect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;host&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;user&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;pass&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;db&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_charset</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;utf8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">mysqli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">character_set_name</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Ausgabe: utf8</span></pre></td></tr></table></div>

<p>Der Fehler ist <a href="http://bugs.php.net/bug.php?id=42902">hier</a> zwar gemeldet und als closed markiert, tritt bei mir jedoch immer noch auf. </p>
]]></content:encoded>
			<wfw:commentRss>http://lemmingzshadow.net/182/mysqli-und-utf-8/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jitt.cc &#8211; Erste Gehversuche mit Websockets</title>
		<link>http://lemmingzshadow.net/163/jittcc-erste-gehversuche-mit-websockets/</link>
		<comments>http://lemmingzshadow.net/163/jittcc-erste-gehversuche-mit-websockets/#comments</comments>
		<pubDate>Mon, 04 May 2009 17:58:07 +0000</pubDate>
		<dc:creator>Lemmingz Shadow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ActiveMQ]]></category>
		<category><![CDATA[Kaazing]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[STOMP]]></category>
		<category><![CDATA[Websockets]]></category>

		<guid isPermaLink="false">http://lemmingzshadow.net/?p=163</guid>
		<description><![CDATA[Am Wochenende habe ich ein erstes kleines neues Projekt zusammen gebastelt um ein wenig mit Websocketes zu experimentieren. jitt.cc macht momentan nicht viel mehr als die Twitter Public Timeline &#8220;live&#8221; im Browser anzuzeigen. Natürlich ist mir bekannt, dass es schon viele Projekte gibt die genau diese Funktion bereits bieten. Mir geht es aber weniger um [...]]]></description>
			<content:encoded><![CDATA[<p>Am Wochenende habe ich ein erstes kleines neues Projekt zusammen gebastelt um ein wenig mit Websocketes zu experimentieren. <a href="http://jitt.cc"><strong>jitt.cc</strong></a> macht momentan nicht viel mehr als die Twitter Public Timeline &#8220;live&#8221; im Browser anzuzeigen. Natürlich ist mir bekannt, dass es schon viele Projekte gibt die genau diese Funktion bereits bieten. Mir geht es aber weniger um die Funktion sondern um die eingesetzte Technik.<span id="more-163"></span><br />
Die meisten Live-Twitter Seiten verwenden irgendeine Art des Pollings um den Live-Effekt zu erzeugen, bei jitt.cc hingegen werden die Daten über eine persistente Verbindung direkt vom Server an den Client geschickt. Hierzu setze ich das <a href="http://www.kaazing.org">Kaazing Open Gateway</a> und einen <a href="http://activemq.apache.org/">ActiveMQ</a> Server ein.<br />
Kaazing stellt quasi eine Proxy zwischen dem ActiveMQ Server und dem Brower dar. Wie das genau funktioniert ist <a href="http://www.kaazing.org/confluence/display/Doc/Architecture+Overview#kegcomps">hier</a> sehr schön dargestellt.<br />
Die Textnachrichten werden dann mittels <a href="http://en.wikipedia.org/wiki/Streaming_Text_Orientated_Messaging_Protocol">STOMP</a> vom ActiveMQ Server über eine Websocket-Verbindung an den Client gesendet.</p>
<p>Alles in Allem ein wirklich sehr interessantes Thema, welches ich jedem Webentwickler nur ans Herz legen kann. Einen super Einstieg bietet das Kaazing Gateway und die darin enthaltenen Demos.</p>
<p>Einziges Manko bisher: Kazzing (benötigt Java) ist ein bisschen speicherhungrig,  und ich weiss nicht wie lange mein kleiner VServer damit noch klar kommt <img src='http://lemmingzshadow.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://lemmingzshadow.net/163/jittcc-erste-gehversuche-mit-websockets/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>strtolower zerlegt UTF-8</title>
		<link>http://lemmingzshadow.net/161/strtolower-zerlegt-utf-8/</link>
		<comments>http://lemmingzshadow.net/161/strtolower-zerlegt-utf-8/#comments</comments>
		<pubDate>Sat, 18 Apr 2009 11:34:24 +0000</pubDate>
		<dc:creator>Lemmingz Shadow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://lemmingzshadow.net/?p=161</guid>
		<description><![CDATA[Gerade habe ich (erneut) festgestellt, dass die php-Funktion strtolower nicht mit UTF-8 kodierten Zeichenketten klarkommt. Damit ich diesen Fehler nicht noch 10x mache und auch als Hinweise für Andere dieser kurze Beitrag. Hier die funktionierende Alternative: 1 $string = mb_strtolower&#40;$string, 'utf-8'&#41;;]]></description>
			<content:encoded><![CDATA[<p>Gerade habe ich (erneut) festgestellt, dass die php-Funktion strtolower nicht mit UTF-8 kodierten Zeichenketten klarkommt. Damit ich diesen Fehler nicht noch 10x mache und auch als Hinweise für Andere dieser kurze Beitrag. Hier die funktionierende Alternative:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$string</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mb_strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'utf-8'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://lemmingzshadow.net/161/strtolower-zerlegt-utf-8/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>vBulletin Login mit cURL</title>
		<link>http://lemmingzshadow.net/131/vbulletin-login-mit-curl/</link>
		<comments>http://lemmingzshadow.net/131/vbulletin-login-mit-curl/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 11:17:19 +0000</pubDate>
		<dc:creator>Lemmingz Shadow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[vBulletin]]></category>

		<guid isPermaLink="false">http://lemmingzshadow.net/?p=131</guid>
		<description><![CDATA[Ich brauchte kürzlich ein Methode mit der man einen vBulletin Login per cURL ausführen kann. Da sowas sicherlich für den Ein oder Anderen hilfreich ist stelle ich die Funktion hier zur Verfügung. Als Parameter werden Benutzername, Passwort und die URL des vBulletins übergeben und die Funktion übernimmt dann den Login eines Benutzer. Da Cookies gesetzt [...]]]></description>
			<content:encoded><![CDATA[<p>Ich brauchte kürzlich ein Methode mit der man einen vBulletin Login per cURL ausführen kann. Da sowas sicherlich für den Ein oder Anderen hilfreich ist stelle ich die Funktion hier zur Verfügung.<br />
Als Parameter werden Benutzername, Passwort und die URL des vBulletins übergeben und die Funktion übernimmt dann den Login eines Benutzer. Da Cookies gesetzt werden muss die Funktion vor der ersten Borwserausgabe aufgerufen werden.<span id="more-131"></span><br />
Nützlich ist die Funktion zum Beispiel dann wenn man mit einem CMS und einem vBulletin arbeitet. Meldet sich ein User am CMS an kann man ihn mit der Funktion gleichzeigt beim vBulletin anmelden. Voraussetzung hierfür ist natürlich dass man die Benutzerdaten abgleicht.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/** function do_vbulletin_login
 *
 *	With this function you can login a user into a vbulletin board.
 *
 *	@param string vb_username The vbulletin-account username
 *	@param string vb_password The vbulletin-account password
 * 	@param string vb_url	The url to the board 
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> do_vbulletin_login<span style="color: #009900;">&#40;</span><span style="color: #000088;">$vb_username</span><span style="color: #339933;">,</span> <span style="color: #000088;">$vb_password</span><span style="color: #339933;">,</span> <span style="color: #000088;">$vb_url</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000088;">$vb_username</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$vb_username</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$vb_password</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$vb_password</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
	<span style="color: #000088;">$vb_password_md5</span> <span style="color: #339933;">=</span> <span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$vb_password</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$vb_url</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'login.php'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$vb_url</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$vb_url</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'/'</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$vb_url</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/'</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$vb_url</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$vb_url</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$vb_url</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'login.php?do=login'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000088;">$postfields</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'vb_login_username'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$vb_username</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'vb_login_password'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'cookieuser'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'s'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>		
		<span style="color: #0000ff;">'do'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'login'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'vb_login_md5password'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$vb_password_md5</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'vb_login_md5password_utf'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$vb_password_md5</span>	
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$httpheaders</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$httpheaders</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$httpheaders</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Accept-Language: en-us,en;q=0.5&quot;</span><span style="color: #339933;">;</span>	
	<span style="color: #000088;">$httpheaders</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// do login and fetch return (with header)</span>
	<span style="color: #000088;">$curl</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$vb_url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
	<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #339933;">,</span> CURLOPT_AUTOREFERER<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #339933;">,</span> CURLOPT_FOLLOWLOCATION<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #339933;">,</span> CURLOPT_MAXREDIRS<span style="color: #339933;">,</span> <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #339933;">,</span> CURLOPT_TIMEOUT<span style="color: #339933;">,</span> <span style="color: #cc66cc;">30</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #339933;">,</span> CURLOPT_CONNECTTIMEOUT<span style="color: #339933;">,</span> <span style="color: #cc66cc;">30</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #339933;">,</span> CURLOPT_ENCODING<span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #339933;">,</span> CURLOPT_USERAGENT<span style="color: #339933;">,</span> <span style="color: #0000ff;">'User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.16) Gecko/20080718 Ubuntu/8.04 (hardy) Firefox/2.0.0.16'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #339933;">,</span> CURLOPT_HTTPHEADER<span style="color: #339933;">,</span> <span style="color: #000088;">$httpheaders</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
	<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #339933;">,</span> CURLOPT_POST<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #339933;">,</span> CURLOPT_POSTFIELDS<span style="color: #339933;">,</span> <span style="color: #000088;">$postfields</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
	<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #339933;">,</span> CURLOPT_HEADER<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$curl_return</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
	<span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// get cookies from curl return:</span>
	<span style="color: #000088;">$curl_return</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$curl_return</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$cookies</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array_keys</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_return</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$i</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">stripos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_return</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'set-cookie'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$cookies</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_return</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">12</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_return</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// prepare cookies to set at user:</span>
	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cookies</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$cookies</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">';'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #990000;">array_walk</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cookies</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">,</span> <span style="color: #990000;">create_function</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&amp;$temp'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'$temp = trim($temp);'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cookies</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$inner_key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$inner_value</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$temp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'='</span><span style="color: #339933;">,</span> <span style="color: #000088;">$inner_value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$temp</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">2</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$temp</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'path'</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$temp</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'expires'</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$temp</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'domain'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$cookies</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$temp</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$temp</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$temp</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$cookies</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$temp</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$cookies</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'value'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$temp</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
&nbsp;
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$temp</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$temp</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'HttpOnly'</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$cookies</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HttpOnly'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">else</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$cookies</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HttpOnly'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cookies</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$inner_key</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// set cookies from server at user:</span>
	<span style="color: #000088;">$set_result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cookies</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$cookie</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>		
		<span style="color: #000088;">$set_result</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">setcookie</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cookie</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$cookie</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'value'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cookie</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'expires'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cookie</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'expires'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$cookie</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'path'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$cookie</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'domain'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #000088;">$cookie</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HttpOnly'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://lemmingzshadow.net/131/vbulletin-login-mit-curl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WBB 1.2 zu phpBB3 konvertieren</title>
		<link>http://lemmingzshadow.net/123/wbb-12-zu-phpbb3-konvertieren/</link>
		<comments>http://lemmingzshadow.net/123/wbb-12-zu-phpbb3-konvertieren/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 10:51:00 +0000</pubDate>
		<dc:creator>Lemmingz Shadow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[phpBB]]></category>
		<category><![CDATA[WBB]]></category>

		<guid isPermaLink="false">http://lemmingzshadow.net/?p=123</guid>
		<description><![CDATA[Vor kurzem musste ich die Daten eines Woltlab Burning Board 1.2 in ein phpBB3 importieren. Aufgrund des hohen Alters des WBB ist das jedoch gar nicht so einfach da es keine Import-Scripte gibt. (Jedenfalls habe ich keins gefunden) Zudem habe ich das WBB natürlich im Laufe der Zeit immer wieder modifiziert und diverse Erweiterungen eingebaut. [...]]]></description>
			<content:encoded><![CDATA[<p>Vor kurzem musste ich die Daten eines Woltlab Burning Board 1.2 in ein phpBB3 importieren. Aufgrund des hohen Alters des WBB ist das jedoch gar nicht so einfach da es keine Import-Scripte gibt. (Jedenfalls habe ich keins gefunden) Zudem habe ich das WBB natürlich im Laufe der Zeit immer wieder modifiziert und diverse Erweiterungen eingebaut. Mit folgenden Schritten habe ich Konvertierung jedoch trotzdem hinbekommen:<span id="more-123"></span></p>
<ul>
<li>1. Update des WBB 1.2 auf ein WBBLite 1.0.2. Diese frühe Version des WBBLite findet man noch bei google. Woltlab selbst bietet sie nicht mehr an.</li>
<li>2. Konvertieren des WBBLite zum einem phpBB 2.0.23. Hierfür gibt es bereits ein fertiges Script welches auch die benötigte  phpBB Version beinhaltet. Herunterladen kann man das Script hier: <a href="http://nationsofmetal.na.funpic.de/forum/viewtopic.php?f=4&#038;t=19">http://nationsofmetal.na.funpic.de/forum/viewtopic.php?f=4&#038;t=19</a></li>
<li>3. Update des phpBB 2.0.23 auf die aktuelle Version. Die aktuellen 3er Versionen des phpBB bringen bereits Importer mit um Daten einer älteren phpBB Version zu importieren.</li>
</ul>
<p>Nach diesen 3 Schritten hatte ich die meisten Daten konvertiert. Einige Kleinigkeiten wie das setzen der Moderatoren mussten zwar noch manuell erledigt werden aber die wichtigsten Dinge wie Beiträge, Userdaten und Ähnliches wurden korrekt umgewandelt.</p>
<p>Einziges Problem waren die Dateianhänge da diese von Haus aus im WBB 1.2 nicht unterstützt werde und ich <a href="http://www.mywbb.info/board/thread.php?threadid=105103">diesen Mod</a> dafür eingebaut hatte.<br />
Um diese Anhänge in das phpBB3 zu importieren musste ich ein kleines Script bauen welches ich hier zur Verfügung stellen möchte:</p>
<p><a href='http://lemmingzshadow.net/123/wbb-12-zu-phpbb3-konvertieren/attachment_importer_wbb12_to_phpbb304/' rel='attachment wp-att-124'><strong>attachment_importer_wbb12_to_phpbb304.tar</strong></a></p>
<p>Zur Verwendung einfach die MySQL-Verbindungsdaten sowie die Pfade zu den Attachments eintragen und das Script ausführen. Wichtiger Hinweis: Wenn die Tabellen nicht den Standard-Präfix des jeweiligen Boards haben müssten die SQL-Queries entsprechend angepasst werden.</p>
]]></content:encoded>
			<wfw:commentRss>http://lemmingzshadow.net/123/wbb-12-zu-phpbb3-konvertieren/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
