<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>WebstersProdigy &#187; php</title>
	<atom:link href="http://webstersprodigy.net/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://webstersprodigy.net</link>
	<description>Updates every other Friday... usually</description>
	<lastBuildDate>Sat, 26 May 2012 06:58:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='webstersprodigy.net' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>WebstersProdigy &#187; php</title>
		<link>http://webstersprodigy.net</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://webstersprodigy.net/osd.xml" title="WebstersProdigy" />
	<atom:link rel='hub' href='http://webstersprodigy.net/?pushpress=hub'/>
		<item>
		<title>Some Interesting URI Parsing Quirks and Open Redirects</title>
		<link>http://webstersprodigy.net/2012/03/16/some-interesting-uri-parsing-quirks-and-open-redirects/</link>
		<comments>http://webstersprodigy.net/2012/03/16/some-interesting-uri-parsing-quirks-and-open-redirects/#comments</comments>
		<pubDate>Fri, 16 Mar 2012 21:36:50 +0000</pubDate>
		<dc:creator>webstersprodigy</dc:creator>
				<category><![CDATA[GrayHat]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[owasp]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[uri]]></category>

		<guid isPermaLink="false">http://webstersprodigy.net/?p=979</guid>
		<description><![CDATA[Parsing the &#8220;relativeness&#8221; of a URI seems to be a pretty browser specific thing, and doing some quick tests there are several quirks that might be useful/dangerous. The Tangled Web (which is an awesome book) aludes to some of these. Some URI Quirks Let&#8217;s look at some tests with the URIs grabbed from the location [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webstersprodigy.net&#038;blog=35949064&#038;post=979&#038;subd=webstersprodigy&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Parsing the &#8220;relativeness&#8221; of a URI seems to be a pretty browser specific thing, and doing some quick tests there are several quirks that might be useful/dangerous. The Tangled Web (which is an awesome book) aludes to some of these.</p>
<h3>Some URI Quirks</h3>
<p>Let&#8217;s look at some tests with the URIs grabbed from the location header. The browsers I&#8217;m testing right now are IE9, Chrome 17 something, and Firefox 11.</p>
<p>All browsers are happy with this, and go to google.com</p>
<blockquote><p>header(&#8220;Location: //google.com&#8221;);</p></blockquote>
<p>Both Firefox and chrome truncate extra slashes<br />
So</p>
<blockquote><p>header(&#8220;Location: <a href="http://google.com">http:///////////////////////google.com</a>&#8220;);</p></blockquote>
<p>is completely happy.</p>
<p>IE is interesting, as it will be equally happy with and /</p>
<blockquote><p>header(&#8220;Location: <a href="https://google.com/">https:\\google.com\</a>&#8220;); &lt;&#8211; this works</p></blockquote>
<p>The spacing doesn&#8217;t seem to matter, so all browsers are happy with:</p>
<blockquote><p>header(&#8220;Location:                        <a href="http://google.com">http://google.com</a>&#8220;);</p></blockquote>
<p>as well as</p>
<blockquote><p>header(&#8220;Location:http://google.com&#8221;);</p></blockquote>
<p>My favorite is this. In chrome and Firefox</p>
<blockquote><p>header(&#8220;Location: http:google.com&#8221;);</p></blockquote>
<p>will redirect to a relative URI, but for whatever reason</p>
<blockquote><p>header(&#8220;Location: <a href="https://google.com">https:google.com</a>&#8220;);</p></blockquote>
<p>will redirect to google.com. wtf?</p>
<h3>Same Domain Redirect</h3>
<p>These parsing quirks can be useful for several attacks, and the first thing that came to mind for me was open redirects.  It&#8217;s a pretty common scenario to want to allow sites  redirecting based on the parameter as long as it&#8217;s in the same domain. It can be expensive to whitelist every URI (which would be ideal), so although that&#8217;s a great solution, I also think allowing redirects to your own domain is sometimes better than nothing &#8230;despite there being some risks associated with it, like giving an attacker a way to bypass the IE8 XSS filter <a href="http://packetstorm.wowhacker.com/papers/general/msie-xssbypass.pdf">http://packetstorm.wowhacker.com/papers/general/msie-xssbypass.pdf</a>.</p>
<p>So, below are some (broken) examples of websites trying to accomplish this, allowing a redirect but only to their own site.</p>
<p><strong>Broken Example 1 &#8211; startswith /</strong></p>
<p>One naive way to try to perform arbitrary on-site local redirects would be something like the following, which takes the redir query parameter and make sure it starts with a slash:</p>
<p><pre class="brush: php;">
$redir = $_GET['redir'];
#if redir starts with /
if (strpos($redir, &quot;/&quot;, 0) === 0)
header(&quot;Location: &quot; . $redir);
</pre></p>
<p>Obviously, this can be bypassed in all browsers with //google.com</p>
<p><strong>Broken Example 2 - No Semicolons, Can&#8217;t start with /, and in fact, don&#8217;t start with // either</strong></p>
<p>This PHP tries to prevent off-site redirects with the following snippet</p>
<p><pre class="brush: php;">
$redir = $_GET['redir'];
#make sure redir doesn't have slashes, and doesn't have semicolons
if ((strpos($redir, &quot;/&quot;, 0) != 0) and (strpos($redir, &quot;/&quot;, 1) != 1) and (strpos($redir, &quot;:&quot;) === false))
{
header(&quot;Location: &quot; . $redir);
}
</pre></p>
<p>Because you can prepend spaces, one way to bypass this is to send the following:</p>
<blockquote><p>redir=%20%20//google.com</p></blockquote>
<p><strong>Broken Example 3 &#8211; No Slashes at all</strong></p>
<p>Ok, what if there are no slashes are allowed at all? You can&#8217;t very well have <a href="http://blah.com">http://blah.com</a> without a slash, after all, so this intuitively might make sense. The code for this might look something like:</p>
<p><pre class="brush: php;">
$redir = $_GET['redir'];
#if no / in the string
if (strpos($redir, &quot;/&quot;) === false)
  header(&quot;Location: &quot; . $redir);
</pre></p>
<p>However, using the quirks above, this can be bypassed by using redir=https:google.com in FF and chrome, and it can be bypassed in IE with redir=\google.com</p>
<p><strong>Broken Example 4 &#8211; Built in Libraries:</strong></p>
<p>Surely there are libraries that solve this problem. Well, maybe there are, but there are certainly libraries people use to <em>try</em> to solve this problem, but they don&#8217;t do it as people expect (e.g. a library might call a URI relative when a browser treats it as absolute). Making a library that works well is a fundamentally tough problem because all these browsers have quirks and the library has to match all browsers. So is a library supposed to call <a href="https://google.com">https:google.com</a> a relative or a full uri? (it&#8217;s relative in IE but full in chrome and FF)</p>
<p>Here&#8217;s one C# example where someone might try to figure out if a URI is relative URI using the IsAbsoluteUri property in .net system.Uri.</p>
<p><pre class="brush: cpp;">
        static void Main(string[] args)
        {

            String[] uriArray = new String[] {
                &quot;//google.com/test.html&quot;,                 //relative
                &quot;\\google.com\test.html&quot;,              //relative
                &quot;/////////google.com/test.html&quot;,          //relative
                &quot;https:google.com&quot;,                       //relative
                &quot;http://google.com&quot;,                      //absolute
                &quot;http:///////////////////google.com&quot;,     //absolute
                &quot;           http://google.com&quot;            //absolute
            };

            foreach (String uriString in uriArray)
            {
                try
                {
                    Uri uri = new Uri(uriString, UriKind.Relative); //works
                    if (!uri.IsAbsoluteUri)
                    {
                        Console.WriteLine(&quot;is a relative URI: {0}&quot;, uriString);
                    }
                }
                catch (UriFormatException e)
                {
                    Console.WriteLine(&quot;not a relative URI: {0}&quot;, uriString);
                }
            }
        }
</pre></p>
<p><strong>Broken Example 5 &#8211; startswith Whitelisted Domain</strong></p>
<p>This is a classic example. Even though it doesn&#8217;t have much do do with parsing quirks, it can be subtle and illustrates an important point.  So say an application does the following to make sure the redirect is on the correct domain.</p>
<p><pre class="brush: cpp;">
String redir = Request[&quot;redir&quot;];
if (redir.StartsWith(&quot;http://goodsite.com&quot;))
{
	Response.Redirect(redir);
}
</pre></p>
<p>Can an attacker still exploit this? The answer is yes, by setting redir=http://goodsite.com.badsite.com/</p>
<h3>What&#8217;s the Right Way to do on-domain Redirects?</h3>
<p>So open redirects are in the owasp top ten, and they have some guidance here: <a href="https://www.owasp.org/index.php/Top_10_2010-A10-Unvalidated_Redirects_and_Forwards">https://www.owasp.org/index.php/Top_10_2010-A10-Unvalidated_Redirects_and_Forwards</a>. However, to summarize, it basically says to whitelist and don&#8217;t redirect. I do agree, but again, what if you want to do on-domain redirects? The best I can think of is to do something like this:</p>
<blockquote><p>startswith(http://goodsite.com/ || <a href="https://google.com/">https://goodsite.com/</a>)</p></blockquote>
<p>Note the trailing slash, which prevents broken example #5.  I don&#8217;t think it&#8217;s possible to redirect off-site with this type of code&#8230; but if someone knows otherwise, I&#8217;d definitely be interested in how to do it :)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webstersprodigy.wordpress.com/979/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webstersprodigy.wordpress.com/979/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/webstersprodigy.wordpress.com/979/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/webstersprodigy.wordpress.com/979/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/webstersprodigy.wordpress.com/979/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/webstersprodigy.wordpress.com/979/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/webstersprodigy.wordpress.com/979/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/webstersprodigy.wordpress.com/979/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/webstersprodigy.wordpress.com/979/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/webstersprodigy.wordpress.com/979/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/webstersprodigy.wordpress.com/979/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/webstersprodigy.wordpress.com/979/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/webstersprodigy.wordpress.com/979/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/webstersprodigy.wordpress.com/979/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webstersprodigy.net&#038;blog=35949064&#038;post=979&#038;subd=webstersprodigy&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webstersprodigy.net/2012/03/16/some-interesting-uri-parsing-quirks-and-open-redirects/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/be2c27a28b3788a3b9a7a8fa243d2978?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">webstersprodigy</media:title>
		</media:content>
	</item>
		<item>
		<title>php multiuser system &#8211; the www-data problem</title>
		<link>http://webstersprodigy.net/2009/03/19/php-multiuser-system-the-www-data-problem/</link>
		<comments>http://webstersprodigy.net/2009/03/19/php-multiuser-system-the-www-data-problem/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 20:58:19 +0000</pubDate>
		<dc:creator>webstersprodigy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://webstersprodigy.net/?p=459</guid>
		<description><![CDATA[On our multi-user system, one where we have 300+ users all with usermod enabled, we also happen to have other web services running. It's inconvenient and in some ways insecure for everyone to be running their dynamic web stuff as the same user. One problem in particular is php. suexec was built for cgi-bin stuff - but php is a whole other beast. That's what I'm talking about here - getting php to run as the user who owns it. More specifically, this will show how /home/user/public_html/myphp.php will run as "user", but stuff in /var/www will still run as www-data.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webstersprodigy.net&#038;blog=35949064&#038;post=459&#038;subd=webstersprodigy&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>On a lot of multi-user systems, like the one at the school where we have 300+ users all with usermod enabled, we also happen to have other web services running. It&#8217;s inconvenient and in insecure for everyone to be running their dynamic web stuff as the same user. I understand this is nearly impossible to do with good security, but this is a university and the point of this server is to let students learn, which means being able to host code.</p>
<p>One security problem in particular is php. suexec was built for cgi-bin stuff &#8211; but php is a whole other beast. That&#8217;s what I&#8217;m talking about here &#8211; getting php to run as the user who owns it. More specifically, this will show how /home/user/public_html/myphp.php will run as &#8220;user&#8221;, but stuff in /var/www will still run as www-data.</p>
<p>One good article I found describing this is here: http://alain.knaff.lu/howto/PhpSuexec/</p>
<p>First things first &#8211; mod_php needs to be disabled. This can be done globally, but it&#8217;s better to just disable it for public_html dirs. This can be done by adding the following to /etc/apache2/apache2.conf.<br />
<pre class="brush: plain;">
&lt;Directory /home&gt;
 php_admin_flag engine off
&lt;/Directory&gt;
</pre><br />
Now, to enable suphp.</p>
<p>First install php-cgi. and the apache2 prefork which has some things we&#8217;ll need later on.<br />
<pre class="brush: plain;">apt-get install php-cgi apache2-prefork-dev</pre><br />
Do not install libapache2-mod-suphp &#8211; at least not on 8.04. This older version lacks some of the things most people need&#8230; like having more than one directory.</p>
<p>Download the latest suphp module from http://www.suphp.org/Home.html.  Compile this like:<br />
<pre class="brush: plain;">
tar xfzv suphp-SNAPSHOT-2008-03-31.tar.gz
cd suphp-SNAPSHOT-2008-03-31
./configure --with-apxs=/usr/bin/apxs2 --with-setid-mode=owner
make
make install
</pre></p>
<p>Modify apache&#8217;s config<br />
<pre class="brush: plain;">
LoadModule suphp_module /usr/lib/apache2/modules/mod_suphp.so
&lt;Directory /home&gt;
AddHandler application/x-httpd-php .php .php3 .php4 .php5 .phtml
suPHP_AddHandler application/x-httpd-php
suPHP_Engine on
&lt;/Directory&gt;
</pre></p>
<p>Now in /usr/local/etc/suphp.conf</p>
<p><pre class="brush: plain;">
[global]
webserver_user=www-data
docroot=${HOME}/public_html
check_vhost_docroot=false

[handlers]
;Handler for php-scripts
application/x-httpd-php=&quot;php:/usr/bin/php-cgi&quot;
</pre></p>
<p>Restart apache. To debug, check /var/log/apache2/errors.log.  To test create scripts in public_html directories and in /var/www that exec(&#8216;whoami&#8217;) and make sure they&#8217;re called with the correct permissions.</p>
<p>It&#8217;s a start, but then there&#8217;s always stuff like XSS, etc.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webstersprodigy.wordpress.com/459/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webstersprodigy.wordpress.com/459/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/webstersprodigy.wordpress.com/459/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/webstersprodigy.wordpress.com/459/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/webstersprodigy.wordpress.com/459/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/webstersprodigy.wordpress.com/459/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/webstersprodigy.wordpress.com/459/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/webstersprodigy.wordpress.com/459/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/webstersprodigy.wordpress.com/459/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/webstersprodigy.wordpress.com/459/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/webstersprodigy.wordpress.com/459/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/webstersprodigy.wordpress.com/459/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/webstersprodigy.wordpress.com/459/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/webstersprodigy.wordpress.com/459/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webstersprodigy.net&#038;blog=35949064&#038;post=459&#038;subd=webstersprodigy&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webstersprodigy.net/2009/03/19/php-multiuser-system-the-www-data-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/be2c27a28b3788a3b9a7a8fa243d2978?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">webstersprodigy</media:title>
		</media:content>
	</item>
		<item>
		<title>Simple Beauty Website Baker Template</title>
		<link>http://webstersprodigy.net/2008/04/21/simple-beauty-website-baker-template/</link>
		<comments>http://webstersprodigy.net/2008/04/21/simple-beauty-website-baker-template/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 02:14:07 +0000</pubDate>
		<dc:creator>webstersprodigy</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[websitebaker]]></category>

		<guid isPermaLink="false">http://webstersprodigy.net/?p=304</guid>
		<description><![CDATA[This is a port of simple beauty found at oswd.com to websitebaker with some modifications.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webstersprodigy.net&#038;blog=35949064&#038;post=304&#038;subd=webstersprodigy&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is a port of simple beauty found at oswd.com to websitebaker with some modifications.</p>
<p>You can download the template <a href="https://skydrive.live.com/redir.aspx?cid=19794fac33285fd5&amp;resid=19794FAC33285FD5!137&amp;parid=19794FAC33285FD5!127">here</a>.</p>
<p>Here are some Screenshots</p>
<p>First &#8211; this is what you get with a simple install. I made it so you don&#8217;t need a banner &#8211; though it certainly looks better with one I think.</p>
<p><a href="http://webstersprodigy.wordpress.com/2008/04/21/simple-beauty-website-baker-template/simple_default/" rel="attachment wp-att-1192"><img class="alignnone size-medium wp-image-1192" title="simple_default" src="https://webstersprodigy.files.wordpress.com/2008/04/simple_default.png?w=500&h=314" alt="" width="500" height="314" /></a></p>
<p>Here it is with a banner.  Though I suppose you don&#8217;t need a screenshot for this.  OTOH maybe I&#8217;ll change the template again so&#8230;</p>
<p><a href="http://webstersprodigy.wordpress.com/2008/04/21/simple-beauty-website-baker-template/custom/" rel="attachment wp-att-1193"><img class="alignnone size-medium wp-image-1193" title="custom" src="https://webstersprodigy.files.wordpress.com/2008/04/custom.png?w=500&h=312" alt="" width="500" height="312" /></a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/webstersprodigy.wordpress.com/304/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/webstersprodigy.wordpress.com/304/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webstersprodigy.wordpress.com/304/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webstersprodigy.wordpress.com/304/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/webstersprodigy.wordpress.com/304/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/webstersprodigy.wordpress.com/304/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/webstersprodigy.wordpress.com/304/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/webstersprodigy.wordpress.com/304/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/webstersprodigy.wordpress.com/304/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/webstersprodigy.wordpress.com/304/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/webstersprodigy.wordpress.com/304/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/webstersprodigy.wordpress.com/304/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/webstersprodigy.wordpress.com/304/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/webstersprodigy.wordpress.com/304/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/webstersprodigy.wordpress.com/304/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/webstersprodigy.wordpress.com/304/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webstersprodigy.net&#038;blog=35949064&#038;post=304&#038;subd=webstersprodigy&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webstersprodigy.net/2008/04/21/simple-beauty-website-baker-template/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/be2c27a28b3788a3b9a7a8fa243d2978?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">webstersprodigy</media:title>
		</media:content>

		<media:content url="https://webstersprodigy.files.wordpress.com/2008/04/simple_default.png?w=500" medium="image">
			<media:title type="html">simple_default</media:title>
		</media:content>

		<media:content url="https://webstersprodigy.files.wordpress.com/2008/04/custom.png?w=500" medium="image">
			<media:title type="html">custom</media:title>
		</media:content>
	</item>
		<item>
		<title>websitebaker module: Random pic with text</title>
		<link>http://webstersprodigy.net/2007/11/29/websitebaker-module-random-pic-with-text/</link>
		<comments>http://webstersprodigy.net/2007/11/29/websitebaker-module-random-pic-with-text/#comments</comments>
		<pubDate>Thu, 29 Nov 2007 19:03:30 +0000</pubDate>
		<dc:creator>webstersprodigy</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[websitebaker]]></category>

		<guid isPermaLink="false">http://webstersprodigy.net/?p=188</guid>
		<description><![CDATA[This module includes a function you can call to randomly pick an image from a directory.  For an example see http://progeny.isu.edu/~lundeen/pages/randompicture.php. (though my websitebaker site is being discontinued). It is based on a module written by John Maats, and I just added the captioning.  Pretty trivial...<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webstersprodigy.net&#038;blog=35949064&#038;post=188&#038;subd=webstersprodigy&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This module includes a function you can call to randomly pick an image from a directory. It is based on a module written by John Maats, and I just added the captioning.  </p>
<p><a href="https://skydrive.live.com/redir.aspx?cid=19794fac33285fd5&amp;resid=19794FAC33285FD5!131&amp;parid=19794FAC33285FD5!127">Here is a link to the zip</a>.</p>
<p><pre class="brush: php;">
&lt;?php
/* Random image snippet
   Call this nsippet with:
   RandomImage (&#039;/media&#039;);
   in your template */

function RandomImage($dir) {
        //read folder and get the picture names
        $folder=opendir(WB_PATH.$dir.&#039;/.&#039;);
        while ($file = readdir($folder))
        $names[count($names)] = $file;
        closedir($folder);

        //remove any non-images from array
        $tempvar=0;
        for ($i=0;$names[$i];$i++){
                $ext=strtolower(substr($names[$i],-4));
                if ($ext==&amp;quot;.jpg&amp;quot;||$ext==&amp;quot;.gif&amp;quot;||$ext==&amp;quot;.png&amp;quot;){
			$names1[$tempvar]=$names[$i];$tempvar++;
		}
        }

        //random
        srand ((double) microtime() * 10000000);
        $rand_keys = array_rand ($names1, 2);

        //random image from array
        $image=$names1[$rand_keys[0]];

        //name of image for alt text
        $name=substr($image,0,-4);

        //print associated Text
        echo &amp;quot;&lt;p&gt;&lt;b&gt;$name&lt;/b&gt;&lt;/p&gt;&quot;;

        //read in the file if it exists

        if(file_exists(WB_PATH.$dir . '/' . &quot;$name&quot; . &quot;.txt&quot;))
        {
                $myfile=file(WB_PATH.$dir . '/' . &quot;$name&quot; . &quot;.txt&quot;);
                echo '&lt;p&gt;';

                foreach ($myfile as $val)
                {
                  echo &quot;$val &quot;;
                }
                echo '&lt;/p&gt;';
        }

        //image dimensions
        $dimensions = GetImageSize(WB_URL.$dir.'/'.$image);
        echo '&lt;img src=&quot;'.WB_URL.$dir.'/'.$image.'&quot; alt=&quot;'.$name.' image&quot; /&gt;';
}
?&gt;
</pre> </p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/webstersprodigy.wordpress.com/188/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/webstersprodigy.wordpress.com/188/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webstersprodigy.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webstersprodigy.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/webstersprodigy.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/webstersprodigy.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/webstersprodigy.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/webstersprodigy.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/webstersprodigy.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/webstersprodigy.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/webstersprodigy.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/webstersprodigy.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/webstersprodigy.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/webstersprodigy.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/webstersprodigy.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/webstersprodigy.wordpress.com/188/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webstersprodigy.net&#038;blog=35949064&#038;post=188&#038;subd=webstersprodigy&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webstersprodigy.net/2007/11/29/websitebaker-module-random-pic-with-text/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/be2c27a28b3788a3b9a7a8fa243d2978?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">webstersprodigy</media:title>
		</media:content>
	</item>
		<item>
		<title>websitebaker modules</title>
		<link>http://webstersprodigy.net/2007/09/10/websitebaker-modules/</link>
		<comments>http://webstersprodigy.net/2007/09/10/websitebaker-modules/#comments</comments>
		<pubDate>Mon, 10 Sep 2007 03:17:34 +0000</pubDate>
		<dc:creator>webstersprodigy</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[websitebaker]]></category>

		<guid isPermaLink="false">http://webstersprodigy.net/?p=169</guid>
		<description><![CDATA[Here are two modules I wrote for website baker. One allows you to sort news arbitrarily, the other allows you to post multiple groups. Writing these is how I wiped out this very website :) I didn&#8217;t have the installer quite right at the time. If you&#8217;re installing this, back things up just in case. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webstersprodigy.net&#038;blog=35949064&#038;post=169&#038;subd=webstersprodigy&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here are two modules I wrote for website baker. One allows you to sort<br />
news arbitrarily, the other allows you to post multiple groups.</p>
<p>Writing these is how I wiped out this very website :) I didn&#8217;t have the installer quite right at the time. If you&#8217;re installing this, back things up just in case. But they really shouldn&#8217;t break anything. I swear.</p>
<p><a href="https://skydrive.live.com/redir.aspx?cid=19794fac33285fd5&amp;resid=19794FAC33285FD5!128&amp;parid=19794FAC33285FD5!127"><br />
anews.zip</a><br />
<a href="https://skydrive.live.com/redir.aspx?cid=19794fac33285fd5&amp;resid=19794FAC33285FD5!129&amp;parid=19794FAC33285FD5!127">gnewswrapper.zip</a></p>
<p>Here is a screenshot of anews. It allows you to sort news posts by title, date, reverstitle, or reversedate. Plus everything else the news module does, as it is just an extension of that.</p>
<p><a href="http://webstersprodigy.wordpress.com/2007/09/10/websitebaker-modules/anews/" rel="attachment wp-att-1098"><img class="alignnone size-medium wp-image-1098" title="anews" src="https://webstersprodigy.files.wordpress.com/2007/09/anews.png?w=500&h=319" alt="" width="500" height="319" /></a></p>
<p>Here is a screenshot of gnewswrapper. It allows you to post stuff by section from arbitrary groups.</p>
<p><a href="http://webstersprodigy.wordpress.com/2007/09/10/websitebaker-modules/gnews/" rel="attachment wp-att-1099"><img class="alignnone size-medium wp-image-1099" title="gnews" src="https://webstersprodigy.files.wordpress.com/2007/09/gnews.png?w=500&h=312" alt="" width="500" height="312" /></a></p>
<p>From the readme:</p>
<blockquote><p>Although the news module is extremely versitile, it lacks an easy way to post products or data items. For example:</p>
<p>-if you have a website that lists various types of faculty<br />
-if you have a page that lists your various types of products<br />
-if you have a page that lists courses for the current term</p>
<p>The news module can almost handle many of these problems. However, there are several shortcomings when the news module is ued for this purpose.</p>
<p>1. Although entries can be reordered, they are ordered by date. It can be a pain to click the up or down arrows until you get an order tham makes sense. With products, it might be better to have the entries ordered by price, for example. For faculty it would most likely be by their name.<br />
2. Multiple groups, and only the groups selected cannot be easily specified. See the example below.</p>
<p>The group wrapper and anews modules provide a solution to this problem.</p>
<p>Example Usage<br />
&#8212;&#8212;&#8212;-<br />
Problem: I have hundreds of faculty, council members, and staff I want to specify at various points on the webpage. I have a CS page where I want to list the CS faculty. Elsewhere on the website, I have a University Contact page where I want to list everyone.</p>
<p>Solution:</p>
<p>-Create a single anews page that stores all people. Create different groups for CS Faculty, Council Members, etc. Make this page hidden.<br />
-Sort it as desired, probably by name<br />
-Create a group wrapper page and add the groups that you want displayed.</p>
<p>Todo<br />
&#8212;&#8212;&#8212;&#8211;<br />
It&#8217;s definitely conceivable of a time where this is insufficient.</p>
<p>-if you want to show items, but not necessarily the whole group<br />
-if you want to show items in an order not specified</p>
<p>It should be pretty easy to extend the module to include these cases</p>
<p>&#8212;&#8212;&#8212;&#8212;<br />
These modules were written by Rich Lundeen</p></blockquote>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/webstersprodigy.wordpress.com/169/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/webstersprodigy.wordpress.com/169/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/webstersprodigy.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/webstersprodigy.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/webstersprodigy.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/webstersprodigy.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/webstersprodigy.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/webstersprodigy.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/webstersprodigy.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/webstersprodigy.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/webstersprodigy.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/webstersprodigy.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/webstersprodigy.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/webstersprodigy.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/webstersprodigy.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/webstersprodigy.wordpress.com/169/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=webstersprodigy.net&#038;blog=35949064&#038;post=169&#038;subd=webstersprodigy&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://webstersprodigy.net/2007/09/10/websitebaker-modules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/be2c27a28b3788a3b9a7a8fa243d2978?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">webstersprodigy</media:title>
		</media:content>

		<media:content url="https://webstersprodigy.files.wordpress.com/2007/09/anews.png?w=500" medium="image">
			<media:title type="html">anews</media:title>
		</media:content>

		<media:content url="https://webstersprodigy.files.wordpress.com/2007/09/gnews.png?w=500" medium="image">
			<media:title type="html">gnews</media:title>
		</media:content>
	</item>
	</channel>
</rss>
