<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1835188757937857652</id><updated>2024-09-22T16:20:03.472-07:00</updated><title type='text'>.:: enakans blog ::.</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://enakans.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://enakans.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Anton Subagja</name><uri>http://www.blogger.com/profile/12195114675684409523</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>16</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1835188757937857652.post-6309457752041959480</id><published>2008-01-01T18:05:00.000-08:00</published><updated>2008-01-01T18:09:12.566-08:00</updated><title type='text'>CGI</title><content type='html'>CGI, the Common Gateway Interface, enables your page to interact with viewers. Generally, CGI is used to process the data submitted by users and send the response back to them.&lt;br /&gt;&lt;h3&gt;Link to CGI reource web sites:&lt;/h3&gt;&lt;br /&gt;&lt;a href=&quot;http://www.cgi-resources.com/&quot;&gt;CGI Resource Index&lt;/a&gt;: This site contains a ton of links to CGI Scripts on the WWW. They are well categorized and easy to browse.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.xav.com/scripts/index.html&quot;&gt;Fluid Dynamics&lt;/a&gt;: Many useful CGI scripts are here, such as Search, Counter, etc. The documents are easy to understand and follow.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.worldwidemart.com/scripts/&quot;&gt;Matt&#39;s Script Archive&lt;/a&gt;: This site is always popular on the Net. You&#39;ll find a bunch of CGIs written in C++ and Perl. All of them are free. &lt;em&gt;Matt&#39;s Script Archive&lt;/em&gt; provides a Guestbook, Counter, Text Counter, Search, WWW Board, FormMail, etc.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.extropia.com/products.html&quot;&gt;Salena Sol&#39;s CGI Script Archives&lt;/a&gt;: Like Matt&#39;s Script, Salena give you a bunch of useful scripts, Form Processor, Guestbook, Basic Animation Scripts, Random Banner Gennerator, Web Chat, etc. The new URL is at extropia.com. Scripts are still free, but there are now (paid) registered versions.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.awsd.com/scripts/&quot;&gt;WebScripts&lt;/a&gt;: This site contains many useful scripts written by Darryl C. Burgdorf. Some examples of scripts here are WebBBS, WebSearch, WebLog, etc. All scripts are always updated!&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.technotrade.com/cgi/index.html&quot;&gt;The CGI Archive&lt;/a&gt;: Many useful scripts such as Message Board, URL Search Engine, Random Image Displayer, etc. Scripts are easy to install.&lt;br /&gt;&lt;br /&gt;Also, &lt;a href=&quot;http://www.yahoo.com/Computers_and_Internet/Internet/World_Wide_Web/CGI___Common_Gateway_Interface/&quot;&gt;Yahoo&lt;/a&gt; has a frequently updated list about CGI.&lt;br /&gt;&lt;br /&gt;The following are sites where you can get other particular scripts that may match your needs.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Counter:&lt;/h3&gt;&lt;br /&gt;It seems like everyone wants to have one. If you&#39;re paying for hosting service, your provider should have one for you. If you&#39;re getting free hosting service from your organization such as a university, you may try to install the script by yourself, but don&#39;t forget to ask the system administrator whether he or she allows you to have CGI Script. If it isn&#39;t allowed, don&#39;t waste your time. The alternative is running a counter from other people&#39;s servers, such as &lt;a href=&quot;http://www.tips-tricks.com/cgi.asp#commercial_counter&quot;&gt;commercial counter&lt;/a&gt;, or let &lt;a href=&quot;http://www.tips-tricks.com/j_script.html#javacounter&quot;&gt;Java&lt;/a&gt;, which doesn&#39;t require installation on a server, counts visitors for you.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.fccc.edu/users/muquit/Count.html&quot;&gt;WWW Homepage Access Counter and Clock!&lt;/a&gt;: This site provides a reliable CGI counter and clock with an explanation in great detail. You will also find JavaApplets at this site.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.lerc.nasa.gov/YAAC/&quot;&gt;YAAC (Yet Another Access Counter)&lt;/a&gt;: This site provides access counter script written in Perl.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.webtools.org/counter/&quot;&gt;Counter 4.0&lt;/a&gt;: This site provides a text counter.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.bcpl.lib.md.us/~sandyste/ezcount.html&quot;&gt;Easy Counter&lt;/a&gt;: The alternative for people who aren&#39;t allowed to have CGI script on their own server, but you need to be able to read an access log.&lt;br /&gt;&lt;br /&gt;&lt;a title=&quot;commercial_counter&quot; href=&quot;http://www.digits.com/&quot; name=&quot;commercial_counter&quot;&gt;Web Counter&lt;/a&gt; at digits.com, they used to offer a free counter, but not anymore. Their commercial counter starts at $5 a month.&lt;br /&gt;&lt;h3&gt;Email Form:&lt;/h3&gt;&lt;br /&gt;&lt;a href=&quot;http://www.worldwidemart.com/scripts/formmail.shtml&quot;&gt;Formmail&lt;/a&gt;: Located at Matt&#39;s Script site. Get results from forms and send mail to specified users.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://web.mit.edu/wwwdev/cgiemail/&quot;&gt;CGIemail&lt;/a&gt;: Developed by MIT. CGIemail script can accept the results of forms and use a template file to build and construct an email message containning those results.&lt;br /&gt;&lt;h3&gt;Links with Drop Down Box:&lt;/h3&gt;&lt;br /&gt;&lt;a href=&quot;http://www.panix.com/~wizjd/jumpbox.htm&quot;&gt;Jump Box:&lt;/a&gt; This redirection script uses a pull-down select box to allow users to select a site and then click a &#39;GO&#39; button to visit it. This script is OK for only a few URLs, but if you have many, it can become very hard to configure, as each selection has to be configured into the CGI script.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://kuoi.asui.uidaho.edu/~collinf/selection/&quot;&gt;Selection:&lt;/a&gt; Users choose a link from a pull down menu and then click a button to go there.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.mrdomain.com/perl/&quot;&gt;Newbie Perl Archive:&lt;/a&gt; Form Navigator: This script enables you to navigate your user to different pages depending on their choice from a selection box.&lt;br /&gt;&lt;h3&gt;Running your CGI remotely:&lt;/h3&gt;&lt;br /&gt;&lt;a href=&quot;http://www.i-depth.com/&quot;&gt;i-Depth&lt;/a&gt;: Run Ad Banners, Forums, Guestbooks, Webforms to Mail, Counters, Chat, Postcards, Classified Ads, and Calculating Order Pages from this remote host.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.worldwidemart.com/wwmprices.shtml#cgi&quot;&gt;Worldwidemart&lt;/a&gt;: They offer service for you to run your CGI from their site at $7 a month.</content><link rel='replies' type='application/atom+xml' href='http://enakans.blogspot.com/feeds/6309457752041959480/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1835188757937857652/6309457752041959480' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/6309457752041959480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/6309457752041959480'/><link rel='alternate' type='text/html' href='http://enakans.blogspot.com/2008/01/cgi.html' title='CGI'/><author><name>Anton Subagja</name><uri>http://www.blogger.com/profile/12195114675684409523</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1835188757937857652.post-808605683675546442</id><published>2008-01-01T17:45:00.000-08:00</published><updated>2008-01-01T18:03:41.209-08:00</updated><title type='text'>JavaScript</title><content type='html'>&lt;h3&gt;Java vs. JavaScript&lt;/h3&gt;&lt;br /&gt;Java is a programing language developed by &lt;a href=&quot;http://www.sun.com/&quot;&gt;Sun&lt;/a&gt;. Java allows programmers to create programs. One example is &lt;a href=&quot;http://www.tips-tricks.com/j_applet.html&quot;&gt;Java Applets&lt;/a&gt;, a small program embedded within a web page.&lt;br /&gt;&lt;br /&gt;JavaScript is a scripting language developed by &lt;a href=&quot;http://home.netscape.com/&quot;&gt;Netscape&lt;/a&gt; and later joined in a partnership with Sun. You can insert it directly to your HTML documents. Creating JavaScript is not difficult. What you need are only simple text editor and browser that supports JavaScript.&lt;br /&gt;&lt;h3&gt;JavaScript&lt;/h3&gt;&lt;br /&gt;We are not going to show you how to write JavaScript here because useful JavaScripts are widely available for you to copy. You may not need to know how to write it unless you want customized Script for your site. If you want to learn how to write the script, try &lt;a href=&quot;http://www.tips-tricks.com/books.html#JavaScript&quot;&gt;JavaScript for the world wide web&lt;/a&gt; book.&lt;br /&gt;&lt;br /&gt;Shown below are some examples of useful JavaScripts and links to some JavaScript web sites&lt;br /&gt;&lt;h4&gt;Alert message:&lt;/h4&gt;&lt;br /&gt;Here is the code for alert message:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&amp;lt;a href=&quot;j_script.html&quot; onclick=&quot;alert(&#39;Reload this page?&#39;);&quot;&amp;gt;Click here&amp;lt;/a&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;h4&gt;Dynamic images and menus:&lt;/h4&gt;&lt;br /&gt;Dynamic menu can either be created by JavaScript or JavaApplet. The JavaScript version will work only on Netscape 3.0 or higher. JavaApplet version should work on both Netscape and Explorer but it will run much slower than JavaScript.&lt;br /&gt;&lt;br /&gt;JavaScript example:&lt;br /&gt;&lt;br /&gt;&amp;gt;&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;a onmouseover=&quot;imgAct(&#39;img1&#39;);&quot; onmouseout=&quot;imgInact(&#39;img1&#39;);&quot; href=&quot;http://www.tips-tricks.com/index.asp&quot;&gt;&lt;img id=&quot;img1&quot; height=&quot;25&quot; alt=&quot;example of dynamic menu&quot; src=&quot;http://www.tips-tricks.com/img/old/dymenu1.gif&quot; width=&quot;242&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The principle is that you have two images. One will be displayed when you put your mouse on it, and the other will be displayed when the mouse is off the image.&lt;br /&gt;&lt;br /&gt;Installation is easy. This code originally written by &lt;a href=&quot;http://webreference.com/javascript/960930/index.html&quot;&gt;Nick Heinle and Athenia Associates&lt;/a&gt;. Follow the link to get detail instruction.&lt;br /&gt;&lt;h4&gt;Customized Message in Status Bar&lt;/h4&gt;&lt;br /&gt;&lt;a onmouseover=&quot;display(&#39;Hello...put your text here&#39;); return true;&quot; href=&quot;http://www.tips-tricks.com/j_script.html&quot;&gt;To see how it works, simply put your cursor over (but don&#39;t &quot;click&quot;) on this links and watch the status bar at the bottom of your screen.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You can get this script from &quot;&lt;a href=&quot;http://www.infohiway.com/javascript/&quot;&gt;Cut-N-Paste JavaScript&lt;/a&gt;&quot;&lt;br /&gt;&lt;h4&gt;Counter:&lt;/h4&gt;&lt;br /&gt;There is no example shown here. To use this counter script, your server must support server-side includes (SSI) feature. You can get it at &lt;a href=&quot;http://www.cris.com/~adaml/Counter.shtml&quot;&gt;http://www.cris.com/~adaml/Counter.shtml&lt;/a&gt;. The script developed by Adam Levental.&lt;br /&gt;&lt;h3&gt;Links to JavaScript resources:&lt;/h3&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;a href=&quot;http://www.geocities.com/SiliconValley/Park/3091/main.htm&quot;&gt;All U Wanna Know About &#39;Java Script&#39;&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href=&quot;http://www.gascripts.com/&quot;&gt;GAScripts&lt;/a&gt;&lt;br /&gt;JavaScript Tutorial, Workshops, Archives, and Links.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href=&quot;http://www.bloke.com/java/&quot;&gt;Cameron&#39;s Java Stuff&lt;/a&gt;- This site contains many cool java stuff which you can get them free. Thanks Cameron!&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href=&quot;http://www.calpoly.edu/~dpopeney/javascript.html&quot;&gt;JavaScript Made Easy&lt;/a&gt;- This page describes in detail how to impliment numerous JavaScripts into your homepage! The author has done all the work. All you need to do is cut and paste a few things and that&#39;s it!&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href=&quot;http://www.webreference.com/javascript/&quot;&gt;JavaScript Tips of the Week&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href=&quot;http://jrc.livesoftware.com/&quot;&gt;Live Software&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href=&quot;http://home.netscape.com/eng/mozilla/Gold/handbook/javascript/index.html&quot;&gt;Netscape JavaScript Authoring Guide&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href=&quot;http://home.netscape.com/comprod/products/navigator/version_2.0/script/script_info/index.html&quot;&gt;Netscape JavaScript Resources&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href=&quot;http://javascriptsource.com/&quot;&gt;The JavaScript Source&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href=&quot;http://www.wsabstract.com/&quot;&gt;Website Abstraction&lt;/a&gt;- A site featuring over 200 free javascripts and java applets&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h4&gt;On line JavaScript Tutorial:&lt;/h4&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;a href=&quot;http://www.freqgrafx.com/411/tutorial.html&quot;&gt;Javascript 411&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href=&quot;http://www.hardlink.com/~robyoung&quot;&gt;JavaScript for the Total Non-Programmer&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://enakans.blogspot.com/feeds/808605683675546442/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1835188757937857652/808605683675546442' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/808605683675546442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/808605683675546442'/><link rel='alternate' type='text/html' href='http://enakans.blogspot.com/2008/01/javascript.html' title='JavaScript'/><author><name>Anton Subagja</name><uri>http://www.blogger.com/profile/12195114675684409523</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1835188757937857652.post-6358806854186030393</id><published>2007-11-03T21:13:00.000-07:00</published><updated>2007-11-03T21:20:37.793-07:00</updated><title type='text'>XOR-Encryption With C</title><content type='html'>&lt;p&gt;Exclusive-OR encryption, while not a public-key system such as RSA, is almost unbreakable through brute force methods. It is susceptible to patterns, but this weakness can be avoided through first compressing the file (so as to remove patterns). Exclusive-or encryption requires that both encryptor and decryptor have access to the encryption key, but the encryption algorithm, while extremely simple, is nearly unbreakable.&lt;/p&gt; &lt;p&gt;Exclusive-OR encrytion works by using the boolean algebra function exclusive-OR (XOR). XOR is a binary operator (meaning that it takes two arguments - similar to the addition sign, for example). By its name, exclusive-OR, it is easy to infer (correctly, no less) that it will return true if one, and only one, of the two operators is true. The truth table is as follows:&lt;/p&gt;&lt;pre class=&quot;example&quot;&gt;A   B    A XOR B&lt;br /&gt;&lt;br /&gt;T   T       F&lt;br /&gt;&lt;br /&gt;T   F       T&lt;br /&gt;&lt;br /&gt;F   T       T&lt;br /&gt;&lt;br /&gt;F   F       F&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;(A truth table works like a multiplication or addition table: the top row is one list of possible inputs, the side column is one list of possible inputs. The intersection of the rows and columns contains the result of the operation when done performed with the inputs from each row and column)&lt;/p&gt; &lt;p&gt;The idea behind exclusive-OR encryption is that it is impossible to reverse the operation without knowing the initial value of one of the two arguments. For example, if you XOR two variables of unknown values, you cannot tell from the output what the values of those variables are. For example, if you take the operation A XOR B, and it returns TRUE, you cannot know whether A is FALSE and B is TRUE, or whether B is FALSE and A is TRUE. Furthermore, even if it returns FALSE, you cannot be certain if both were TRUE or if both were FALSE.&lt;/p&gt; &lt;p&gt;If, however, you know either A or B it is entirely reversible, unlike logical-AND and logical-OR. For exclusive-OR, if you perform the operation A XOR TRUE and it returns a value of TRUE you know A is FALSE, and if it returns FALSE, you know A is true. Exclusive-OR encryption works on the principle that if you have the encrypted string and the encryption key you can always decrypt correctly. If you don’t have the key, it is impossible to decrypt it without making entirely random keys and attempting each one of them until the decryption program’s output is something akin to readable text. The longer you make the encryption key, the more difficult it becomes to break it.&lt;/p&gt; &lt;p&gt;The actual way exclusive-OR encryption is used is to take the key and encrypt a file by repeatedly applying the key to successive segments of the file and storing the output. The output will be the equivalent of an entirely random program, as the key is generated randomly. Once a second person has access to the key, that person is able to decrypt the files, but without it, decryption is almost impossible. For every bit added to the length of the key, you double the number of tries it will take to break the encryption through brute force.&lt;/p&gt; &lt;p&gt;C++ uses ^ for bit-level exclusive-OR. To encrypt a single character you can use char x=x^key; if you have a key of one byte. To encrypt a string of characters with a longer key, you can use something akin to the following code:&lt;/p&gt; &lt;pre class=&quot;example&quot;&gt;#include &lt;iostream.h&gt;&lt;br /&gt;&lt;br /&gt;int main()&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt; char string[11]=&quot;A nice cat&quot;;&lt;br /&gt;&lt;br /&gt; char key[11]=&quot;ABCDEFGHIJ&quot;;&lt;br /&gt;&lt;br /&gt; for(int x=0; x&amp;lt;10; x++)    {  &lt;br /&gt; &lt;br /&gt; string[x]=string[x]^key[x]; &lt;br /&gt;  &lt;br /&gt; cout&amp;lt;&amp;lt;string[x];&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;  return 0;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;The program encrypts each character in the string using the ^ bit operator to exclusive-OR the string value with the key value for each character.&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;http://www.cprogramming.com/&quot;&gt;http://www.cprogramming.com&lt;/a&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://enakans.blogspot.com/feeds/6358806854186030393/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1835188757937857652/6358806854186030393' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/6358806854186030393'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/6358806854186030393'/><link rel='alternate' type='text/html' href='http://enakans.blogspot.com/2007/11/xor-encryption-with-c.html' title='XOR-Encryption With C'/><author><name>Anton Subagja</name><uri>http://www.blogger.com/profile/12195114675684409523</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1835188757937857652.post-3297112258303156900</id><published>2007-08-16T00:54:00.001-07:00</published><updated>2007-08-16T01:08:00.684-07:00</updated><title type='text'>Regular Expressions</title><content type='html'>&lt;h2&gt;Basic Syntax of Regular Expressions (as from &lt;a href=&quot;http://www.phpbuilder.com/columns/dario19990616.php3&quot;&gt;PHPBuilder.com&lt;/a&gt;)&lt;/h2&gt;&lt;br /&gt;First of all, let&#39;s take a look at two special symbols: &#39;^&#39; and &#39;$&#39;.&lt;br /&gt;&lt;br /&gt;What they do is indicate the start and the end of a string, respectively, like this:&quot;^The&quot;: matches any string that starts with &quot;The&quot;;&lt;br /&gt;&lt;br /&gt;&quot;of despair$&quot;: matches a string that ends in the substring &quot;of despair&quot;;&lt;br /&gt;&lt;br /&gt;&quot;^abc$&quot;: a string that starts and ends with &quot;abc&quot; -- that could only be &quot;abc&quot; itself!&lt;br /&gt;&lt;br /&gt;&quot;notice&quot;: a string that has the text &quot;notice&quot; in it.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can see that if you don&#39;t use either of the two characters we mentioned, as in the last example,&lt;br /&gt;you&#39;re saying that the pattern may occur anywhere inside the string -- you&#39;re not &quot;hooking&quot; it to any of the edges.&lt;br /&gt;&lt;br /&gt;There are also the symbols &#39;*&#39;, &#39;+&#39;, and &#39;?&#39;, which denote the number of times a character or a sequence of&lt;br /&gt;characters may occur. What they mean is: &quot;zero or more&quot;, &quot;one or more&quot;, and &quot;zero or one.&quot;&lt;br /&gt;&lt;br /&gt;Here are some examples:&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&quot;ab*&quot;: matches a string that has an a followed by zero or more b&#39;s (&quot;a&quot;, &quot;ab&quot;, &quot;abbb&quot;, etc.);&lt;br /&gt;&lt;br /&gt;&quot;ab+&quot;: same, but there&#39;s at least one b (&quot;ab&quot;, &quot;abbb&quot;, etc.);&lt;br /&gt;&lt;br /&gt;&quot;ab?&quot;: there might be a b or not;&lt;br /&gt;&lt;br /&gt;&quot;a?b+$&quot;: a possible a followed by one or more b&#39;s ending a string.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can also use bounds, which come inside braces and indicate ranges in the number of occurences:&quot;ab{2}&quot;: matches a string that has an a followed by exactly two b&#39;s (&quot;abb&quot;);&lt;br /&gt;&lt;br /&gt;&quot;ab{2,}&quot;: there are at least two b&#39;s (&quot;abb&quot;, &quot;abbbb&quot;, etc.);&lt;br /&gt;&lt;br /&gt;&quot;ab{3,5}&quot;: from three to five b&#39;s (&quot;abbb&quot;, &quot;abbbb&quot;, or &quot;abbbbb&quot;).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Note that you must always specify the first number of a range (i.e, &quot;{0,2}&quot;, not &quot;{,2}&quot;).&lt;br /&gt;Also, as you might have noticed, the symbols &#39;*&#39;, &#39;+&#39;, and &#39;?&#39; have the same effect as using the bounds &quot;{0,}&quot;, &quot;{1,}&quot;, and &quot;{0,1}&quot;,&lt;br /&gt;respectively.&lt;br /&gt;&lt;br /&gt;Now, to quantify a sequence of characters, put them inside parentheses:&quot;a(bc)*&quot;: matches a string that has an a followed by zero or more copies of the sequence &quot;bc&quot;;&lt;br /&gt;&lt;br /&gt;&quot;a(bc){1,5}&quot;: one through five copies of &quot;bc.&quot;&lt;br /&gt;&lt;br /&gt;There&#39;s also the &#39;|&#39; symbol, which works as an OR operator:&lt;br /&gt;&lt;br /&gt;&quot;hi|hello&quot;: matches a string that has either &quot;hi&quot; or &quot;hello&quot; in it;&lt;br /&gt;&lt;br /&gt;&quot;(b|cd)ef&quot;: a string that has either &quot;bef&quot; or &quot;cdef&quot;;&lt;br /&gt;&lt;br /&gt;&quot;(a|b)*c&quot;: a string that has a sequence of alternating a&#39;s and b&#39;s ending in a c;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A period (&#39;.&#39;) stands for any single character:&lt;br /&gt;&lt;br /&gt;&quot;a.[0-9]&quot;: matches a string that has an a followed by one character and a digit;&lt;br /&gt;&lt;br /&gt;&quot;^.{3}$&quot;: a string with exactly 3 characters.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Bracket expressions specify which characters are allowed in a single position of a string:&lt;br /&gt;&lt;br /&gt;&quot;[ab]&quot;: matches a string that has either an a or a b (that&#39;s the same as &quot;a|b&quot;);&lt;br /&gt;&lt;br /&gt;&quot;[a-d]&quot;: a string that has lowercase letters &#39;a&#39; through &#39;d&#39; (that&#39;s equal to &quot;a|b|c|d&quot; and even &quot;[abcd]&quot;);&lt;br /&gt;&lt;br /&gt;&quot;^[a-zA-Z]&quot;: a string that starts with a letter;&lt;br /&gt;&lt;br /&gt;&quot;[0-9]%&quot;: a string that has a single digit before a percent sign;&lt;br /&gt;&lt;br /&gt;&quot;,[a-zA-Z0-9]$&quot;: a string that ends in a comma followed by an alphanumeric character.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can also list which characters you DON&#39;T want -- just use a &#39;^&#39; as the first symbol in a bracket expression (i.e., &quot;%[^a-zA-Z]%&quot; matches a string with a character that is not a letter between two percent signs).&lt;br /&gt;&lt;br /&gt;In order to be taken literally, you must escape the characters &quot;^.[$()|*+?{\&quot; with a backslash (&#39;&#39;), as they have special meaning. On top of that, you must escape the backslash character itself in PHP3 strings, so, for instance, the regular expression &quot;($|¥)[0-9]+&quot; would have the function call: ereg(&quot;($|¥)[0-9]+&quot;, $str)&lt;br /&gt;&lt;br /&gt;(what string does that validate?)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example 1.&lt;/strong&gt; Examples of valid patterns * /&amp;lt;/w+&amp;gt;/&lt;br /&gt;&lt;br /&gt;* |(d{3})-d+|Sm&lt;br /&gt;&lt;br /&gt;* /^(?i)php[34]/&lt;br /&gt;&lt;br /&gt;* {^s+(s+)?$}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example 2.&lt;/strong&gt; Examples of invalid patterns&lt;br /&gt;&lt;br /&gt;* /href=&#39;(.*)&#39; - missing ending delimiter&lt;br /&gt;&lt;br /&gt;* /w+s*w+/J - unknown modifier &#39;J&#39;&lt;br /&gt;&lt;br /&gt;* 1-d3-d3-d4| - missing starting delimiter&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Some useful PHP Keywords and their use  (&lt;a href=&quot;http://us4.php.net/manual/en/index.php&quot;&gt;php.net man pages&lt;/a&gt;)&lt;!--adsense--&gt;&lt;br /&gt;&lt;/h2&gt;&lt;br /&gt;&lt;h3&gt;&lt;em&gt;preg_split&lt;/em&gt;&lt;/h3&gt;&lt;br /&gt;(PHP 3&amp;gt;= 3.0.9, PHP 4 )&lt;br /&gt;preg_split -- Split string by a regular expression&lt;br /&gt;&lt;br /&gt;Description&lt;br /&gt;array preg_split ( string pattern, string subject [, int limit [, int flags]])&lt;br /&gt;Returns an array containing substrings of subject split along boundaries matched by pattern.&lt;br /&gt;&lt;br /&gt;If limit is specified, then only substrings up to limit are returned, and if limit is -1, it&lt;br /&gt;actually means &quot;no limit&quot;, which is useful for specifying the flags.&lt;br /&gt;flags can be any combination of the following flags (combined with bitwise | operator):&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PREG_SPLIT_NO_EMPTY&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;   If this flag is set, only non-empty pieces will be returned by preg_split().&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PREG_SPLIT_DELIM_CAPTURE&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;   If this flag is set, parenthesized expression in the delimiter pattern will be captured and&lt;br /&gt;returned as well. This flag was added for 4.0.5.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PREG_SPLIT_OFFSET_CAPTURE&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;   If this flag is set, for every occuring match the appendant string offset will also be returned. Note that this changes the return value in an array where every element is an array consisting of the matched string at offset 0 and it&#39;s string offset into subject at offset 1. This flag is available since PHP 4.3.0 .&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example 1. &lt;/strong&gt;preg_split() example : Get the parts of a search string&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;&lt;br /&gt;// split the phrase by any number of commas or space characters,&lt;br /&gt;&lt;br /&gt;// which include &quot; &quot;, r, t, n and f&lt;br /&gt;&lt;br /&gt;$keywords = preg_split (&quot;/[s,]+/&quot;, &quot;hypertext language, programming&quot;);&lt;br /&gt;&lt;br /&gt;?&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example 2. &lt;/strong&gt;Splitting a string into component characters&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;&lt;br /&gt;$str = &#39;string&#39;;&lt;br /&gt;&lt;br /&gt;$chars = preg_split(&#39;//&#39;, $str, -1, PREG_SPLIT_NO_EMPTY);&lt;br /&gt;&lt;br /&gt;print_r($chars);&lt;br /&gt;&lt;br /&gt;?&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;strong&gt;Example 3. &lt;/strong&gt;Splitting a string into matches and their offsets&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;&lt;br /&gt;$str = &#39;hypertext language programming&#39;;&lt;br /&gt;&lt;br /&gt;$chars = preg_split(&#39;/ /&#39;, $str, -1, PREG_SPLIT_OFFSET_CAPTURE);&lt;br /&gt;&lt;br /&gt;print_r($chars);&lt;br /&gt;&lt;br /&gt;?&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;will yield:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Array&lt;br /&gt;&lt;br /&gt;(&lt;br /&gt;&lt;br /&gt;   [0] =&amp;gt; Array&lt;br /&gt;&lt;br /&gt;       (&lt;br /&gt;&lt;br /&gt;           [0] =&amp;gt; hypertext&lt;br /&gt;&lt;br /&gt;           [1] =&amp;gt; 0&lt;br /&gt;&lt;br /&gt;       )&lt;br /&gt;&lt;br /&gt;[1] =&amp;gt; Array&lt;br /&gt;&lt;br /&gt;       (&lt;br /&gt;&lt;br /&gt;           [0] =&amp;gt; language&lt;br /&gt;&lt;br /&gt;           [1] =&amp;gt; 10&lt;br /&gt;&lt;br /&gt;       )&lt;br /&gt;&lt;br /&gt;[2] =&amp;gt; Array&lt;br /&gt;&lt;br /&gt;       (&lt;br /&gt;&lt;br /&gt;           [0] =&amp;gt; programming&lt;br /&gt;&lt;br /&gt;           [1] =&amp;gt; 19&lt;br /&gt;&lt;br /&gt;       )&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;em&gt;Note: Parameter flags was added in PHP 4 Beta 3.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;&lt;em&gt;preg_match&lt;/em&gt;&lt;/h3&gt;(PHP 3&amp;gt;= 3.0.9, PHP 4 )&lt;br /&gt;preg_match -- Perform a regular expression match&lt;br /&gt;&lt;br /&gt;Description&lt;br /&gt;int preg_match ( string pattern, string subject [, array matches [, int flags]])Searches subject for a match to the regular expression given in pattern.&lt;br /&gt;&lt;br /&gt;If matches is provided, then it is filled with the results of search. $matches[0] will&lt;br /&gt;contain the text that matched the full pattern, $matches[1] will have the text that matched&lt;br /&gt;the first captured parenthesized subpattern, and so on.&lt;br /&gt;&lt;br /&gt;flags can be the following flag:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PREG_OFFSET_CAPTURE&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;   If this flag is set, for every occuring match the appendant string offset will also be returned. Note that this changes the return value in an array where every element is an array consisting of the matched string at offset 0 and it&#39;s string offset into subject at offset 1. This flag is available since PHP 4.3.0 .&lt;br /&gt;&lt;br /&gt;The flags parameter is available since PHP 4.3.0 .&lt;br /&gt;&lt;br /&gt;&lt;em&gt;preg_match()&lt;/em&gt; returns the number of times pattern matches. That will be either 0 times (no match) or 1 time because preg_match() will stop searching after the first match.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;preg_match_all()&lt;/em&gt; on the contrary will continue until it reaches the end of subject.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;preg_match()&lt;/em&gt; returns FALSE if an error occured.&lt;br /&gt;&lt;br /&gt;Tip: Do not use preg_match() if you only want to check if one string is contained in another string. Use strpos() or strstr() instead as they will be faster.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example 1.&lt;/strong&gt; Find the string of text &quot;php&quot;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;&lt;br /&gt;// The &quot;i&quot; after the pattern delimiter indicates a case-insensitive search&lt;br /&gt;&lt;br /&gt;if (preg_match (&quot;/php/i&quot;, &quot;PHP is the web scripting language of choice.&quot;)) {&lt;br /&gt;&lt;br /&gt;   print &quot;A match was found.&quot;;&lt;br /&gt;&lt;br /&gt;} else {&lt;br /&gt;&lt;br /&gt;   print &quot;A match was not found.&quot;;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;strong&gt;Example 2.&lt;/strong&gt; Find the word &quot;web&quot;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;&lt;br /&gt;/* The b in the pattern indicates a word boundary, so only the distinct&lt;br /&gt;&lt;br /&gt;* word &quot;web&quot; is matched, and not a word partial like &quot;webbing&quot; or &quot;cobweb&quot; */&lt;br /&gt;&lt;br /&gt;if (preg_match (&quot;/bwebb/i&quot;, &quot;PHP is the web scripting language of choice.&quot;)) {&lt;br /&gt;&lt;br /&gt;   print &quot;A match was found.&quot;;&lt;br /&gt;&lt;br /&gt;} else {&lt;br /&gt;&lt;br /&gt;   print &quot;A match was not found.&quot;;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;if (preg_match (&quot;/bwebb/i&quot;, &quot;PHP is the website scripting language of choice.&quot;)) {&lt;br /&gt;&lt;br /&gt;   print &quot;A match was found.&quot;;&lt;br /&gt;&lt;br /&gt;} else {&lt;br /&gt;&lt;br /&gt;   print &quot;A match was not found.&quot;;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;strong&gt;Example 3.&lt;/strong&gt; Getting the domain name out of a URL&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;&lt;br /&gt;// get host name from URL&lt;br /&gt;&lt;br /&gt;preg_match(&quot;/^(http://)?([^/]+)/i&quot;,&lt;br /&gt;&lt;br /&gt;   &quot;http://www.php.net/index.html&quot;, $matches);&lt;br /&gt;&lt;br /&gt;$host = $matches[2];&lt;br /&gt;&lt;br /&gt;// get last two segments of host name&lt;br /&gt;&lt;br /&gt;preg_match(&quot;/[^./]+.[^./]+$/&quot;, $host, $matches);&lt;br /&gt;&lt;br /&gt;echo &quot;domain name is: {$matches[0]}n&quot;;&lt;br /&gt;&lt;br /&gt;?&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This example will produce: domain name is: php.net&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Perl Style Delimiters  (&lt;a href=&quot;http://www.crazygrrl.com/weav/regex.php3&quot;&gt;as from crazygrrl.com&lt;/a&gt;)&lt;/h2&gt;&lt;br /&gt;When using Perl-style matching, the pattern also has to be enclosed by special delimiters.&lt;br /&gt;The default is the forward slash, though you can use others. For example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;     /colou?r/&lt;/pre&gt;&lt;br /&gt;Usually you&#39;ll want to stick with the default, but if you need to use the forward slash a lot in the actual pattern (especially if you&#39;re dealing with pathnames) you might want to use something else:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;     !/root/home/random!&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;To make a match case-insensitive, all you need to do is append the option &lt;i&gt;i&lt;/i&gt; to the pattern:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;     /colou?r/i&lt;/pre&gt;&lt;br /&gt;Perl-style functions support these extra metacharacters (this is not a full list):&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;b A word boundary, the spot between word (w) and non-word (W) characters.&lt;br /&gt;&lt;br /&gt;    B A non-word boundary.&lt;br /&gt;&lt;br /&gt;    d A single digit character.&lt;br /&gt;&lt;br /&gt;    D A single non-digit character.&lt;br /&gt;&lt;br /&gt;    n The newline character. (ASCII 10)&lt;br /&gt;&lt;br /&gt;    r The carriage return character. (ASCII 13)&lt;br /&gt;&lt;br /&gt;    s A single whitespace character.&lt;br /&gt;&lt;br /&gt;    S A single non-whitespace character.&lt;br /&gt;&lt;br /&gt;    t The tab character. (ASCII 9)&lt;br /&gt;&lt;br /&gt;    w A single word character - alphanumeric and underscore.&lt;br /&gt;&lt;br /&gt;    W A single non-word character.&lt;/pre&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;     /bhomerb/&lt;/pre&gt;&lt;br /&gt;Have a donut, Homer no match A tale of homeric proportions! no match&lt;br /&gt;    Do you think he can hit a homer? match&lt;br /&gt;&lt;br /&gt;Corresponding to ereg() is preg_match(). Syntax:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;     preg_match(pattern (string), target (string), optional_array);&lt;/pre&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;pre&gt;$pattern = &quot;/b(do(ugh)?nut)b.*b(Homer|Fred)b/i&quot;;&lt;br /&gt;&lt;/pre&gt;&lt;pre&gt;$target = &quot;Have a donut, Homer.&quot;;&lt;br /&gt;&lt;/pre&gt;&lt;pre&gt;if (preg_match($pattern, $target, $matches)) {&lt;br /&gt;&lt;/pre&gt;&lt;pre&gt; print(&quot;&amp;lt;P&amp;gt;Match: $reg[0]&amp;lt;/P&amp;gt;&quot;);&lt;br /&gt;&lt;br /&gt;    print(&quot;&amp;lt;P&amp;gt;Pastry: $reg[1]&amp;lt;/P&amp;gt;&quot;);&lt;br /&gt;&lt;br /&gt;    print(&quot;&amp;lt;P&amp;gt;Variant: $reg[2]&amp;lt;/P&amp;gt;&quot;);&lt;br /&gt;&lt;br /&gt;    print(&quot;&amp;lt;P&amp;gt;Name: $reg[3]&amp;lt;/P&amp;gt;&quot;);&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;pre&gt;else {&lt;br /&gt;&lt;br /&gt;    print(&quot;No match.&quot;);&lt;br /&gt;&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;Results:&lt;br /&gt;&lt;pre&gt;Match: donut, Homer&lt;br /&gt;&lt;/pre&gt;&lt;pre&gt;Pastry: donut&lt;br /&gt;&lt;/pre&gt;&lt;pre&gt;Variant: [blank because there was no &quot;ugh&quot;]&lt;br /&gt;&lt;/pre&gt;&lt;pre&gt;Name: Homer&lt;/pre&gt;&lt;br /&gt;If you use the $target &quot;Doughnut, Frederick?&quot; there will be no match, since there has to be a word boundary after Fred.&lt;br /&gt;&lt;br /&gt;but &quot;Doughnut, fred?&quot; will match since we&#39;ve specified it to be case-insensitive.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Contributed code which is applicable (and very useful!)&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;mkr at binarywerks dot dk&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;A (AFAIK) correct implementation of Ipv4 validation, this one supports optional ranges&lt;br /&gt;(CIDR notation) and it validates numbers from 0-255 only in the address part, and 1-32&lt;br /&gt;only after the /&lt;/em&gt;&lt;?&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;function valid_ipv4($ip_addr)&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;       $num=&quot;([0-9]|1?dd|2[0-4]d|25[0-5])&quot;;&lt;br /&gt;&lt;br /&gt;       $range=&quot;([1-9]|1d|2d|3[0-2])&quot;;&lt;br /&gt;&lt;br /&gt;if(preg_match(&quot;/^$num.$num.$num.$num(/$range)?$/&quot;,$ip_addr))&lt;br /&gt;&lt;br /&gt;       {&lt;br /&gt;&lt;br /&gt;               return 1;&lt;br /&gt;&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;return 0;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;$ip_array[] = &quot;127.0.0.1&quot;;&lt;br /&gt;&lt;br /&gt;$ip_array[] = &quot;127.0.0.256&quot;;&lt;br /&gt;&lt;br /&gt;$ip_array[] = &quot;127.0.0.1/36&quot;;&lt;br /&gt;&lt;br /&gt;$ip_array[] = &quot;127.0.0.1/1&quot;;&lt;br /&gt;&lt;br /&gt;foreach ($ip_array as $ip_addr)&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;       if(valid_ipv4($ip_addr))&lt;br /&gt;&lt;br /&gt;       {&lt;br /&gt;&lt;br /&gt;               echo &quot;$ip_addr is valid&amp;lt;BR&amp;gt;n&quot;;&lt;br /&gt;&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       else&lt;br /&gt;&lt;br /&gt;       {&lt;br /&gt;&lt;br /&gt;               echo &quot;$ip_addr is NOT valid&amp;lt;BR&amp;gt;n&quot;;&lt;br /&gt;&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;strong&gt;plenque at hotmail dot com&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;I wrote a function that checks if a given regular expression is valid. I think some of&lt;br /&gt;you might find it useful. It changes the error_handler and restores it, I didn&#39;t find&lt;br /&gt;any other way to do it.&lt;/em&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Function IsRegExp ($sREGEXP)&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;   $sPREVIOUSHANDLER = Set_Error_Handler (&quot;TrapError&quot;);&lt;br /&gt;&lt;br /&gt;   Preg_Match ($sREGEXP, &quot;&quot;);&lt;br /&gt;&lt;br /&gt;   Restore_Error_Handler ($sPREVIOUSHANDLER);&lt;br /&gt;&lt;br /&gt;   Return !TrapError ();&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Function TrapError ()&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;   Static $iERRORES;&lt;br /&gt;&lt;br /&gt;If (!Func_Num_Args ())&lt;br /&gt;&lt;br /&gt;   {&lt;br /&gt;&lt;br /&gt;       $iRETORNO = $iERRORES;&lt;br /&gt;&lt;br /&gt;       $iERRORES = 0;&lt;br /&gt;&lt;br /&gt;       Return $iRETORNO;&lt;br /&gt;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   Else&lt;br /&gt;&lt;br /&gt;   {&lt;br /&gt;&lt;br /&gt;       $iERRORES++;&lt;br /&gt;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;strong&gt;PHP Get_title tag code which uses simple regex and nice php string functions&lt;/strong&gt;&lt;br /&gt;(As from &lt;a href=&quot;http://www.zend.com/codex.php?id=233&amp;single=1&quot;&gt;Zend PHP&lt;/a&gt;)&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;&lt;br /&gt;function get_title_tag($chaine){&lt;br /&gt;&lt;br /&gt;   $fp = fopen ($chaine, &#39;r&#39;);&lt;br /&gt;&lt;br /&gt;   while (! feof ($fp)){&lt;br /&gt;&lt;br /&gt;        $contenu .= fgets ($fp, 1024);&lt;br /&gt;&lt;br /&gt;        if (stristr($contenu, &#39;&amp;lt;title&amp;gt;&#39; )){&lt;br /&gt;&lt;br /&gt;                break;&lt;br /&gt;&lt;br /&gt;               }&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;   if (eregi(&quot;&quot;, $contenu, $out)) {&lt;br /&gt;&lt;br /&gt;       return $out[1];&lt;br /&gt;&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;   else{&lt;br /&gt;&lt;br /&gt;       return false;&lt;br /&gt;&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;?&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;strong&gt;My Own &#39;Visitor Trac&#39; code which uses regex XML parsing methods&lt;/strong&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;&lt;br /&gt;$referer = $_SERVER[&#39;HTTP_REFERER&#39;];&lt;br /&gt;&lt;br /&gt;$filename = $_SERVER[REMOTE_ADDR] . &#39;.txt&#39;;&lt;br /&gt;&lt;br /&gt;//print_r($_SERVER);&lt;br /&gt;&lt;br /&gt;if (file_exists($filename)){&lt;br /&gt;&lt;br /&gt;$lastvisit = filectime($filename);&lt;br /&gt;&lt;br /&gt;$currentdate = date(&#39;U&#39;);&lt;br /&gt;&lt;br /&gt;$difference = round(($currentdate - $lastvisit)/84600);&lt;br /&gt;&lt;br /&gt;if ($difference &amp;gt; 7)  {&lt;br /&gt;&lt;br /&gt; unlink($filename);&lt;br /&gt;&lt;br /&gt; $fp = fopen($filename, &quot;a&quot;);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;else $fp = fopen($filename, &quot;a&quot;);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;else $fp = fopen($filename, &quot;a&quot;);&lt;br /&gt;&lt;br /&gt;if (!$_SERVER[&#39;HTTP_REFERER&#39;]) $url_test = &#39;http://dinki.mine.nu/weblog/&#39;;&lt;br /&gt;&lt;br /&gt;else $url_test = $_SERVER[&#39;HTTP_REFERER&#39;];&lt;br /&gt;&lt;br /&gt;$new_title = return_title ($url_test);&lt;br /&gt;&lt;br /&gt;//print $new_title;&lt;br /&gt;&lt;br /&gt;$new_name = stripslashes(&quot;&amp;lt;beg&amp;gt;$new_titlen&quot;);&lt;br /&gt;&lt;br /&gt;$new_URL = stripslashes(&quot;&amp;lt;beg&amp;gt;$referern&quot;);&lt;br /&gt;&lt;br /&gt;fwrite($fp,$new_URL);&lt;br /&gt;&lt;br /&gt;fwrite($fp,$new_name);&lt;br /&gt;&lt;br /&gt;fclose($fp);&lt;br /&gt;&lt;br /&gt;$fp = fopen($filename, &quot;r&quot;);&lt;br /&gt;&lt;br /&gt;$file = implode(&#39;&#39;, file ($filename));&lt;br /&gt;&lt;br /&gt;$foo = preg_split(&quot;/&amp;lt;beg&amp;gt;/&quot;,$file);&lt;br /&gt;&lt;br /&gt;$number = count($foo);&lt;br /&gt;&lt;br /&gt;//print $number;&lt;br /&gt;&lt;br /&gt;if ($number &amp;gt; 11) {&lt;br /&gt;&lt;br /&gt;fclose($fp);&lt;br /&gt;&lt;br /&gt;$fp = fopen($filename, &quot;w&quot;);&lt;br /&gt;&lt;br /&gt;$count = $number - 10;&lt;br /&gt;&lt;br /&gt;while ($count &amp;lt; $number)  {&lt;br /&gt;&lt;br /&gt; $print1 = $foo[$count];&lt;br /&gt;&lt;br /&gt; $print2 = $foo[$count+1];&lt;br /&gt;&lt;br /&gt; print &quot; &amp;lt;img src = arrow.gif&amp;gt; &quot;;&lt;br /&gt;&lt;br /&gt; print &quot;&amp;lt;a href=$print1&amp;gt;$print2&amp;lt;/a&amp;gt;&quot;; //print $count;&lt;br /&gt;&lt;br /&gt; $count += 2;&lt;br /&gt;&lt;br /&gt; $new_name = stripslashes(&quot;&amp;lt;beg&amp;gt;$print2&quot;);&lt;br /&gt;&lt;br /&gt; $new_URL = stripslashes(&quot;&amp;lt;beg&amp;gt;$print1&quot;);&lt;br /&gt;&lt;br /&gt; fwrite($fp,$new_URL);&lt;br /&gt;&lt;br /&gt; fwrite($fp,$new_name);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;fclose($fp);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//print_r($foo);&lt;br /&gt;&lt;br /&gt;else  {&lt;br /&gt;&lt;br /&gt;$count = 1;&lt;br /&gt;&lt;br /&gt;while ($count &amp;lt;= $number)  {&lt;br /&gt;&lt;br /&gt; $print1 = $foo[$count];&lt;br /&gt;&lt;br /&gt; $print2 = $foo[$count+1];&lt;br /&gt;&lt;br /&gt; print &quot; &amp;lt;img src = arrow.gif&amp;gt; &quot;;&lt;br /&gt;&lt;br /&gt; print &quot;&amp;lt;a href=$print1&amp;gt;$print2&amp;lt;/a&amp;gt;&quot;; //print $count;&lt;br /&gt;&lt;br /&gt; $count += 2;&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;fclose($fp);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function return_title($url)  {&lt;br /&gt;&lt;br /&gt;print $filename.&quot; &quot;.$difference;&lt;br /&gt;&lt;br /&gt;  $array = file ($url);&lt;br /&gt;&lt;br /&gt;   for ($i = 0; $i &amp;lt; count($array); $i++)&lt;br /&gt;&lt;br /&gt;   {&lt;br /&gt;&lt;br /&gt;  if (preg_match(&quot;/&amp;lt;title&amp;gt;(.*)&amp;lt;/title&amp;gt;/i&quot;,$array[$i], $tag_contents))  {&lt;br /&gt;&lt;br /&gt;   $title = $tag_contents[1];&lt;br /&gt;&lt;br /&gt;   $title = strip_tags($title);&lt;br /&gt;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   return $title;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://enakans.blogspot.com/feeds/3297112258303156900/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1835188757937857652/3297112258303156900' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/3297112258303156900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/3297112258303156900'/><link rel='alternate' type='text/html' href='http://enakans.blogspot.com/2007/08/regular-expressions.html' title='Regular Expressions'/><author><name>Anton Subagja</name><uri>http://www.blogger.com/profile/12195114675684409523</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1835188757937857652.post-2561615294421576918</id><published>2007-08-15T01:41:00.000-07:00</published><updated>2007-08-15T01:43:01.830-07:00</updated><title type='text'>Assembly Language</title><content type='html'>&lt;p&gt;Assembly language is essentially the native language of your computer. Technically the processor of your machine understands &lt;em&gt;machine code&lt;/em&gt; (consisting of ones and zeroes). But in order to write such a machine code program, you first write it in assembly language and then use an &lt;em&gt;assembler&lt;/em&gt; to convert it to machine code.&lt;/p&gt;  &lt;p&gt;However nothing is lost when the assembler does its conversion, since assembly language simply consists of mnemonic codes which are easy to remember (they are similar to words in the english language), which stand for each of the different machine code instructions that the machine is capable of executing.&lt;/p&gt;  &lt;p&gt;Here is an example of a short excerpt from an assembly language program:&lt;/p&gt;  &lt;pre&gt;MOV EAX,1&lt;br /&gt;SHL EAX,5&lt;br /&gt;MOV ECX,17&lt;br /&gt;SUB EAX,ECX&lt;br /&gt;....&lt;br /&gt;&lt;/pre&gt;  &lt;p&gt;An assembler would convert this set of instructions into a series of ones and zeros (i.e. an executable program) that the machine could understand.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Because it is extremely &lt;em&gt;low level&lt;/em&gt;, assembly language can be optimized extremely well. Therefore assembly language is used where the utmost performance is required for applications.&lt;/p&gt;  &lt;p&gt;Assembly language is also useful for communicating with the machine at a hardware level. For this reason, it is often used for writing device drivers.&lt;/p&gt;  &lt;p&gt;A third benefit of assembly language is the size of the resulting programs. Because no conversion from a higher level by a compiler is required, the resulting programs can be exceedingly small. For this reason, assembly language has been a language of choice for the &lt;em&gt;demo scene&lt;/em&gt;. This involves coders writing extremely small programs which show off their creative and technical abilities to other members of the scene.&lt;/p&gt;  &lt;p&gt;In this tutorial you will learn how to write assembly language programs and how to make use of these to do interesting things such as calculations, graphics, writing windows programs and optimizing programs written in other languages.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://enakans.blogspot.com/feeds/2561615294421576918/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1835188757937857652/2561615294421576918' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/2561615294421576918'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/2561615294421576918'/><link rel='alternate' type='text/html' href='http://enakans.blogspot.com/2007/08/assembly-language.html' title='Assembly Language'/><author><name>Anton Subagja</name><uri>http://www.blogger.com/profile/12195114675684409523</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1835188757937857652.post-1136157482641916472</id><published>2007-07-16T19:06:00.000-07:00</published><updated>2007-07-16T20:19:37.355-07:00</updated><title type='text'>All about computer’s virusses</title><content type='html'>&lt;p _extended=&quot;true&quot;&gt;Your computer is as slow as molasses. Your mouse freezes  every 15 minutes, and that Microsoft Word program just won’t seem to open.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;You might have a virus.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;Just what exactly is a virus? What kind is in your computer?  How did it get there? How is it spreading and wreaking such havoc? And why is it  bothering with your computer anyway?&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;Viruses are pieces of programming code that make copies of  themselves, or replicate, inside your computer without asking your explicit  written permission to do so. Forget getting your permission down on paper.  Viruses don’t bother to seek your permission at all! Very invasive.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;In comparison, there are pieces of code that might replicate  inside your computer, say something your IT guy thinks you need. But the code  spreads, perhaps throughout your office network, with your consent (or at least  your IT guy’s consent). These types of replicating code are called agents, said  Jimmy Kuo, a research fellow with McAfee AVERT, a research arm of anti-virus  software-maker McAfee Inc.&lt;br /&gt;&lt;br /&gt;In this article, though, we’re not talking about the good  guys, or the agents. We’ll be talking about the bad guys, the viruses.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;A long, long time ago in computer years, like five, most  viruses were comprised of a similar breed. They entered your computer perhaps  through an email attachment or a floppy disk (remember those?). Then they  attached themselves to one of your files, say your Microsoft Word program.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;When you opened your Microsoft Word program, the virus  replicated and attached itself to other files. These could be other random files  on your hard drive, the files furthest away from your Microsoft Word program, or  other files, depending on how the virus writer wanted the virus to behave.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;This virus code could contain hundreds or thousands of  instructions. When it replicates it inserts those instructions, into the files  it infects, said Carey Nachenberg, Chief Architect at Symantec Research Labs, an  arm of anti-virus software-maker Symantec. Corp.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;Because so many other types of viruses exist now, the kind  just described is called a classic virus. Classic viruses still exist but  they’re not quite as prevalent as they used to be. (Perhaps we could put classic  viruses on the shelf with Hemingway and Dickens.)&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;These days, in the modern era, viruses are known to spread  through vulnerabilities in web browsers, files shared over the internet, emails  themselves, and computer networks.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;As far as web browsers are concerned, Microsoft’s Internet  Explorer takes most of the heat for spreading viruses because it’s used by more  people for web surfing than any other browser.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;Nevertheless, “Any web browser potentially has  vulnerabilities,” Nachenberg said.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;For instance, let’s say you go to a website in IE you have  every reason to think is safe, Nachenberg said.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;But unfortunately it isn’t. It has virus code hidden in its  background that IE isn’t protecting you from. While you’re looking at the site,  the virus is downloaded onto your computer, he said. That’s one way of catching  a nasty virus.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;During the past two years, another prevalent way to catch a  virus has been through downloads computer users share with one another, mostly  on music sharing sites, Kuo said. On Limewire or Kazaa, for instance, teenagers  or other music enthusiasts might think they’re downloading that latest Justin  Timberlake song, when in reality they’re downloading a virus straight into their  computer. It’s easy for a virus writer to put a download with a virus on one of  these sites because everyone’s sharing with everyone else anyway.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;Here’s one you might not have thought of. If you use Outlook  or Outlook Express to send and receive email, do you have a preview pane below  your list of emails that shows the contents of the email you have highlighted?  If so, you may be putting yourself at risk.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;Some viruses, though a small percentage according to  Nachenberg, are inserted straight into emails themselves.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;Forget opening the attachment. All you have to do is view  the email to potentially get a virus, Kuo added. For instance, have you ever  opened or viewed an email that states it’s “loading”? Well, once everything is  “loaded,” a virus in the email might just load onto your computer.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;So if I were you, I’d click on View on the toolbar in your  Outlook or Outlook Express and close the preview pane. (You have to click on  View and then Layout in Outlook Express.)&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;On a network at work? You could get a virus that way. Worms  are viruses that come into your computer via networks, Kuo said. They travel  from machine to machine and, unlike, the classic viruses, they attack the  machine itself rather than individual files.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;Worms sit in your working memory, or RAM, Nachenberg  said.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;OK, so we’ve talked about how the viruses get into a  computer. How do they cause so much damage once they’re there?&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;Let’s say you’ve caught a classic virus, one that replicates  and attacks various files on your computer. Let’s go back to the example of the  virus that initially infects your Microsoft Word program.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;Well, it might eventually cause that program to crash,  Nachenberg said. It also might cause damage to your computer as it looks for new  targets to infect.&lt;br /&gt;This process of infecting targets and  looking for new ones could eventually use up your computer’s ability to  function, he said.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;Often the destruction a virus causes is pegged to a certain  event or date and time, called a trigger. For instance, a virus could be  programmed to lay dormant until January 28. When that date rolls around, though,  it may be programmed to do something as innocuous but annoying as splash popups  on your screen, or something as severe as reformat your computer’s hard drive,  Nachenberg said.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;There are other potential reasons, though, for a virus to  cause your computer to be acting slow or in weird ways. And that leads us to a  new segment – the reason virus writers would want to waste their time creating  viruses in the first place.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;The majority of viruses are still written by teenagers  looking for some notoriety, Nachenberg said. But a growing segment of the  virus-writing population has other intentions in mind.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;For these other intentions, we first need to explain the  “backdoor” concept.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;The sole purpose of some viruses is to create a  vulnerability in your computer. Once it creates this hole of sorts, or backdoor,  it signals home to mama or dada virus writer (kind of like in E.T.). Once the  virus writer receives the signal, they can use and abuse your computer to their  own likings.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;Trojans are sometimes used to open backdoors. In fact that  is usually their sole purpose, Kuo said.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;Trojans are pieces of code you might download onto your  computer, say, from a newsgroup. As in the Trojan War they are named after, they  are usually disguised as innocuous pieces of code. But Trojans aren’t considered  viruses because they don’t replicate.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;Now back to the real viruses. Let’s say we have Joe Shmo  virus writer. He sends out a virus that ends up infecting a thousand machines.  But he doesn’t want the feds on his case. So he instructs the viruses on the  various machines to send their signals, not of course to his computer, but to a  place that can’t be traced. Hotmail email happens to be an example of one such  place, Kuo said.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;OK, so the virus writers now control these computers. What  will they use them for?&lt;br /&gt;One use is to send spam. Once that  backdoor is open, they bounce spam off of those computers and send it to other  machines, Nachenberg said.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;That’s right. Some spam you have in your email right now may  have been originally sent to other innocent computers before it came to yours so  that it could remain in disguise. If the authorities could track down the  original senders of spam, they could crack down on spam itself. Spam senders  don’t want that.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;Ever heard of phishing emails? Those are the ones that  purport to be from your internet service provider or bank. They typically  request some information from you, like your credit card number. The problem is,  they’re NOT from your internet service provider or your bank. They’re from evil  people after your credit card number! Well, these emails are often sent the same  way spam is sent, by sending them via innocent computers.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;Of course makers of anti-virus software use a variety of  methods to combat the onslaught of viruses. Norton, for instance, uses signature  scanning, Nachenberg said.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;Signature scanning is similar to the process of looking for  DNA fingerprints, he said. Norton examines programming code to find what viruses  are made of. It adds those bad instructions it finds to its large database of  other bad code. Then it uses this vast database to seek out and match the code  in it with similar code in your computer. When it finds such virus code, it lets  you know!&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;by Kara Glover&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://enakans.blogspot.com/feeds/1136157482641916472/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1835188757937857652/1136157482641916472' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/1136157482641916472'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/1136157482641916472'/><link rel='alternate' type='text/html' href='http://enakans.blogspot.com/2007/07/all-about-computers-virusses.html' title='All about computer’s virusses'/><author><name>Anton Subagja</name><uri>http://www.blogger.com/profile/12195114675684409523</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1835188757937857652.post-5717495065719351422</id><published>2007-06-08T00:16:00.000-07:00</published><updated>2007-06-08T00:17:18.576-07:00</updated><title type='text'>How to Install a WebDAV Server in PHP</title><content type='html'>&lt;div class=&quot;post-chapo&quot;&gt;&lt;p&gt;How to install a webdav server in PHP&lt;/p&gt;&lt;/div&gt; &lt;p&gt;It&#39;s very simple.&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;Download this &lt;a href=&quot;http://www.keyphrene.com/download/webdav_srv_1.1.zip&quot; hreflang=&quot;en&quot;&gt;package&lt;/a&gt;, and decompress it.&lt;/li&gt;&lt;li&gt;The &lt;q&gt;inc&lt;/q&gt; folder contains &lt;strong&gt;PEAR&lt;/strong&gt; and the &lt;strong&gt;HTTP_WebDAV_Server&lt;/strong&gt; &lt;em&gt;class&lt;/em&gt;.&lt;/li&gt;&lt;li&gt;Copy the &lt;q&gt;inc&lt;/q&gt; folder and &lt;q&gt;authenticate.php&lt;/q&gt; file in the &lt;em&gt;include_path&lt;/em&gt; (see php.ini)&lt;/li&gt;&lt;li&gt;Copy &lt;q&gt;webdav.php&lt;/q&gt; file in the root of your site.&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;The &lt;q&gt;authenticate.php&lt;/q&gt; file contains a digest authentification.&lt;/p&gt;    &lt;p&gt;The &lt;q&gt;webdav.php&lt;/q&gt; file create a webdav server&lt;/p&gt;  &lt;pre class=&quot;php&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;&lt;?&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(177, 177, 0);&quot;&gt;include_once&lt;/span&gt;&lt;span style=&quot;color: rgb(102, 204, 102);&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&quot;authenticate.php&quot;&lt;/span&gt;&lt;span style=&quot;color: rgb(102, 204, 102);&quot;&gt;)&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 102);&quot;&gt;ini_set&lt;/span&gt;&lt;span style=&quot;color: rgb(102, 204, 102);&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&quot;error_reporting&quot;&lt;/span&gt;, &lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: rgb(102, 204, 102);&quot;&gt;)&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(128, 128, 128); font-style: italic;&quot;&gt;# Name of your restricted area&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$realm&lt;/span&gt; = &lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&#39;Restricted area Keyphrene&#39;&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$DBUSER&lt;/span&gt; = &lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&quot;your login&quot;&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$DBPWD&lt;/span&gt; = &lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&quot;your password&quot;&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$users&lt;/span&gt; = &lt;span style=&quot;color: rgb(0, 0, 102);&quot;&gt;array&lt;/span&gt;&lt;span style=&quot;color: rgb(102, 204, 102);&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$DBUSER&lt;/span&gt; =&gt; &lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$DBPWD&lt;/span&gt;&lt;span style=&quot;color: rgb(102, 204, 102);&quot;&gt;)&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: rgb(128, 128, 128); font-style: italic;&quot;&gt;# With this authentication method, &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(128, 128, 128); font-style: italic;&quot;&gt;# your password is not readable when you use this service&lt;/span&gt;&lt;br /&gt;AuthenticationDigestHTTP&lt;span style=&quot;color: rgb(102, 204, 102);&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$realm&lt;/span&gt;, &lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$users&lt;/span&gt;&lt;span style=&quot;color: rgb(102, 204, 102);&quot;&gt;)&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: rgb(128, 128, 128); font-style: italic;&quot;&gt;# AuthenticationBasicHTTP($realm, $users);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(177, 177, 0);&quot;&gt;require_once&lt;/span&gt; &lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&quot;HTTP/WebDAV/Server/Filesystem.php&quot;&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$server&lt;/span&gt; = &lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;new&lt;/span&gt; HTTP_WebDAV_Server_Filesystem&lt;span style=&quot;color: rgb(102, 204, 102);&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(102, 204, 102);&quot;&gt;)&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: rgb(128, 128, 128); font-style: italic;&quot;&gt;# Database configuration for the lock method&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$server&lt;/span&gt;-&gt;&lt;span style=&quot;color: rgb(0, 102, 0);&quot;&gt;db_host&lt;/span&gt; = &lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$DBHOST&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$server&lt;/span&gt;-&gt;&lt;span style=&quot;color: rgb(0, 102, 0);&quot;&gt;db_name&lt;/span&gt; = &lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$DB_WEBDAV&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$server&lt;/span&gt;-&gt;&lt;span style=&quot;color: rgb(0, 102, 0);&quot;&gt;db_user&lt;/span&gt; = &lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$DBUSER&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$server&lt;/span&gt;-&gt;&lt;span style=&quot;color: rgb(0, 102, 0);&quot;&gt;db_passwd&lt;/span&gt; = &lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$DBPWD&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: rgb(128, 128, 128); font-style: italic;&quot;&gt;# Real path of your site&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$server&lt;/span&gt;-&gt;&lt;span style=&quot;color: rgb(0, 102, 0);&quot;&gt;ServeRequest&lt;/span&gt;&lt;span style=&quot;color: rgb(102, 204, 102);&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;$DOCUMENT_ROOT&lt;/span&gt;.&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&quot;/www/&quot;&lt;/span&gt;&lt;span style=&quot;color: rgb(102, 204, 102);&quot;&gt;)&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 0, 0); font-weight: bold;&quot;&gt;?&gt;&lt;/span&gt;&lt;/pre&gt;    &lt;p&gt;To use this service, you must connect you at this adress http://mysite.org/webdav.php. You can configure a lot of access on your site. Becareful, if you must copy files on your server, you must use the good permissions with the FTP client.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://enakans.blogspot.com/feeds/5717495065719351422/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1835188757937857652/5717495065719351422' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/5717495065719351422'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/5717495065719351422'/><link rel='alternate' type='text/html' href='http://enakans.blogspot.com/2007/06/how-to-install-webdav-server-in-php.html' title='How to Install a WebDAV Server in PHP'/><author><name>Anton Subagja</name><uri>http://www.blogger.com/profile/12195114675684409523</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1835188757937857652.post-1703899322519156704</id><published>2007-06-07T23:16:00.000-07:00</published><updated>2007-06-08T00:15:21.279-07:00</updated><title type='text'>LIBNAME Statement Support for WebDAV Servers</title><content type='html'>&lt;pre&gt;&lt;span&gt;&lt;span point  style=&quot;font-family:COURIER NEW;font-size:10;&quot;&gt;   LIBNAME statement support for WebDAV servers will be available for use&lt;br /&gt;  in SAS® 9.1.3 (9.1 TS1M3) with hot fix D9BA08, which is currently&lt;br /&gt;  under production.&lt;br /&gt;&lt;br /&gt;  The LIBNAME statement is being extended to allow access to content&lt;br /&gt;  stored in a Web Distributed Authoring and Versioning (WebDAV) server.&lt;br /&gt;&lt;br /&gt;  Syntax&lt;br /&gt;&lt;br /&gt;  LIBNAME libref &lt;engine&gt; &#39;SAS-library&#39; &lt;options&gt; WEBDAV USER=&quot;user-ID&quot;&lt;br /&gt;           PASSWORD=&quot;user-password&quot;;&lt;br /&gt;&lt;br /&gt;  Where &#39;SAS-library&#39; specifies the URL location (path) on a WebDAV&lt;br /&gt;  server. The URL specifies either HTTP or HTTPS communication protocols.&lt;br /&gt;&lt;br /&gt;  Only one data library is supported when using the WebDAV extension to&lt;br /&gt;  libnames. REMOTE engines are not supported with the WebDAV options.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  WebDAV Specific Options&lt;br /&gt;&lt;br /&gt;  WEBDAV&lt;br /&gt;  specifies that the libref accesses a WebDAV server.&lt;br /&gt;&lt;br /&gt;  USER=&quot;user-ID&quot;&lt;br /&gt;  specifies the user name for access to the WebDAV server. The user-ID is&lt;br /&gt;  case-sensitive, so it must be in single or double quotes.&lt;br /&gt;  Alias:       UID&lt;br /&gt;&lt;br /&gt;  PASSWORD=&quot;user-password&quot;&lt;br /&gt;  specifies a password for the user to access the WebDAV server. The&lt;br /&gt;  user-password is case-sensitive, so it must be in single or double&lt;br /&gt;  quotes.&lt;br /&gt;  Alias:       PWD=, PW=, PASS=&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  Data Set Options&lt;br /&gt;&lt;br /&gt;  The following table lists the data set options that have different&lt;br /&gt;  functionality when using a WebDAV server. All other data set options&lt;br /&gt;  will function as described in the SAS Language: Reference.&lt;br /&gt;&lt;br /&gt;  Data Set Option Functionality with WebDAV&lt;br /&gt;&lt;br /&gt;  Data Set Option  WebDAV Storage Functionality&lt;br /&gt;&lt;br /&gt;  CNTLLEV=         LIB locks all data sets in the library prior to writing&lt;br /&gt;                   the data into the local cache. All members are unlocked&lt;br /&gt;                   once the data step has completed and the data set has&lt;br /&gt;                   been written back to the WebDAV server.&lt;br /&gt;&lt;br /&gt;                   MEM locks the member prior to writing the data into the&lt;br /&gt;                   local cache. Member is unlocked once the data step has&lt;br /&gt;                   completed and the data has been written back to the&lt;br /&gt;                   WebDAV server.&lt;br /&gt;&lt;br /&gt;                   REC is not supported. WebDAV will only allow updates to&lt;br /&gt;                   the entire data set.&lt;br /&gt;&lt;br /&gt;  FILECLOSE        VxTAPE engine is not supported, therefore this option&lt;br /&gt;                   is ignored.&lt;br /&gt;&lt;br /&gt;  GENMAX=          This functionality is not supported because the maximum&lt;br /&gt;                   number of revisions to keep cannot be specified in&lt;br /&gt;                   WebDAV.&lt;br /&gt;&lt;br /&gt;  GENNUM=          If present, the specific version specified isnot&lt;br /&gt;                   retrieved from the WebDAV server for read-only access.&lt;br /&gt;&lt;br /&gt;  IDXNAME=         Users can specify an index to use if one exists.&lt;br /&gt;                   However, to use this option, you need to&lt;br /&gt;                   have accessed the data set (to get it locally) then&lt;br /&gt;                   created an index so that it would be available.&lt;br /&gt;&lt;br /&gt;  INDEX=           Indexes may be created in the local cache and used in&lt;br /&gt;                   subsequent DATA steps.&lt;br /&gt;&lt;br /&gt;  TOBSNO=          Remote engines are not supported, so this option&lt;br /&gt;                   is not needed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  Details&lt;br /&gt;&lt;br /&gt;  When accessing a WebDAV server, the file is pulled from the WebDAV&lt;br /&gt;  server to your local disk storage for processing. When you complete the&lt;br /&gt;  updating, the file is pushed back to the WebDAV server for storage. The&lt;br /&gt;  file is removed from the local disk storage when it is pushed back.&lt;br /&gt;&lt;br /&gt;  Example&lt;br /&gt;&lt;br /&gt;  The following example associates the libref davdata with the WebDAV&lt;br /&gt;  directory /users/mydir/datadir on the WebDAV server www.webserver.com:&lt;br /&gt;&lt;br /&gt;  libname davdata v9 &quot;https://www.webserver.com/users/mydir/datadir&quot;&lt;br /&gt;          webdav user=&quot;mydir&quot; pw=&quot;12345&quot;;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  A fix for SAS 9.1.3 (9.1 TS1M3) for this issue is available at:&lt;br /&gt;&lt;br /&gt;  &lt;a href=&quot;http://www.sas.com/techsup/download/hotfix/e9_sbcs_prod_list.html#013763&quot;&gt;http://www.sas.com/techsup/download/hotfix/e9_sbcs_prod_list.html#013763&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;  For customers running SAS with Asian Language Support (DBCS), this&lt;br /&gt;  fix should be downloaded from:&lt;br /&gt;&lt;br /&gt;  &lt;a href=&quot;http://www.sas.com/techsup/download/hotfix/e9_dbcs_prod_list.html#013763&quot;&gt;http://www.sas.com/techsup/download/hotfix/e9_dbcs_prod_list.html#013763&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://enakans.blogspot.com/feeds/1703899322519156704/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1835188757937857652/1703899322519156704' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/1703899322519156704'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/1703899322519156704'/><link rel='alternate' type='text/html' href='http://enakans.blogspot.com/2007/06/libname-statement-support-for-webdav.html' title='LIBNAME Statement Support for WebDAV Servers'/><author><name>Anton Subagja</name><uri>http://www.blogger.com/profile/12195114675684409523</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1835188757937857652.post-5340590513477962182</id><published>2007-05-28T21:21:00.000-07:00</published><updated>2007-06-14T23:54:04.994-07:00</updated><title type='text'>FTP With PHP</title><content type='html'>&lt;p _extended=&quot;true&quot;&gt;Just some rough scripts showing uses for PHPs FTP  library.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;One of the biggest ways I have used FTP is a cheat for those  servers which will not give Apache permission to create local directories.  Assuming that the FTP module is install, just FTP to yourself and create the  directories the hard way. Not ideal by any stretch of the imagination, but it is  a work around.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;The below script is a cheat that I used at an old employers  company. The issue was we needed dynamic creation of directories on a webserver  which we had no permissions to other than via FTP ( and the PHP FTP module was  not installed either ). So, I rigged a scheduled script which ran locally to  check which directories needed to be created, which in turn called a script on a  remote server which would FTP the directories back.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;This is by no means the best way of doing things, but,  sometimes you have to be a bit messy. And, incase you are wondering, the bigger  version of these scripts are still in use today!!&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;We check for the existence of the directory prior to calling  the creation script as FTP does use a lot of resource, the less work we do the  better.&lt;br /&gt;&lt;br /&gt;&lt;code _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);&quot; _extended=&quot;true&quot;&gt;This is the local file ( if needed )&lt;/span&gt;&lt;/code&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(255, 128, 0);&quot; _extended=&quot;true&quot;&gt;// This  is the directory we want to create&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$dir  &lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: rgb(221, 0, 0);&quot; _extended=&quot;true&quot;&gt;“newdir”&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;;&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(255, 128, 0);&quot; _extended=&quot;true&quot;&gt;// This  is the URL on the remote server of the&lt;br /&gt;// script that is  going to FTP back to us.&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$url  &lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: rgb(221, 0, 0);&quot; _extended=&quot;true&quot;&gt;“http://ftpenabled.server.com/ftp.php?dir=$dir”&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;;&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(255, 128, 0);&quot; _extended=&quot;true&quot;&gt;// This  just checks if the directory already exists ….&lt;br /&gt;// if it  doesn’t call our remote script to FTP back to&lt;br /&gt;// us and  create it.&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;// Also check “allow_url_fopen” is enabled.&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;if(!&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;file_exists&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(221, 0, 0);&quot; _extended=&quot;true&quot;&gt;“/var/www/html/testdomain/public_html/$dir”&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;))&lt;br /&gt;{&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(255, 128, 0);&quot; _extended=&quot;true&quot;&gt;// Now  open the URL. The remote script can pass data back to&lt;br /&gt;// us  in $var&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$fh  &lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;fopen&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$url&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: rgb(221, 0, 0);&quot; _extended=&quot;true&quot;&gt;“r”&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;);&lt;br /&gt;while(!&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;feof&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$fh&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;))&lt;br /&gt;{&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(255, 128, 0);&quot; _extended=&quot;true&quot;&gt;// Just  to stop it timing out … FTP isn’t fast!&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;set_time_limit&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$var  &lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;fgets&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$fh&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;,  &lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;1024&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;);&lt;br /&gt;print(&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$var&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;);&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;fclose&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$fh&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;?&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;This is the remote file  http://ftpenabled.server.com/ftp.php&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(255, 128, 0);&quot; _extended=&quot;true&quot;&gt;// If  the server where this file is located&lt;br /&gt;// has the FTP portion  of PHP enabled then&lt;br /&gt;// you call just run this function  locally.&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;// Dir is the directory to create&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$dir  &lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$HTTP_GET_VARS&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: rgb(221, 0, 0);&quot; _extended=&quot;true&quot;&gt;“dir”&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;];&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(255, 128, 0);&quot; _extended=&quot;true&quot;&gt;//  These 3 variable you could pass to the&lt;br /&gt;// script within the  URL if you wanted -&lt;br /&gt;// bit insecure though&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$ftp_ip  &lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: rgb(221, 0, 0);&quot; _extended=&quot;true&quot;&gt;“ftp.this.com”&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$ftp_username &lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: rgb(221, 0, 0);&quot; _extended=&quot;true&quot;&gt;“username”&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$ftp_password &lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: rgb(221, 0, 0);&quot; _extended=&quot;true&quot;&gt;“password”&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;;&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;if(&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$ftp&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;ftp_connect&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$ftp_ip&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;))&lt;br /&gt;{&lt;br /&gt;if(&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;ftp_login&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$ftp&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$ftp_username&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$ftp_password&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;))&lt;br /&gt;{&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(255, 128, 0);&quot; _extended=&quot;true&quot;&gt;// Set  to PASV mode&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;ftp_pasv&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;(  &lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$ftp&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;);&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(255, 128, 0);&quot; _extended=&quot;true&quot;&gt;// In  this example set the current directory to&lt;br /&gt;// public_html&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;ftp_chdir&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$ftp&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: rgb(221, 0, 0);&quot; _extended=&quot;true&quot;&gt;“/public_html/”&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;);&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(255, 128, 0);&quot; _extended=&quot;true&quot;&gt;// If  we cannot set our directory to the new one&lt;br /&gt;// then we create  it&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;if(!&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;ftp_chdir&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$ftp&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$dir&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;))&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;ftp_mkdir&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$ftp&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$dir&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;);&lt;br /&gt;echo(&lt;/span&gt;&lt;span style=&quot;color: rgb(221, 0, 0);&quot; _extended=&quot;true&quot;&gt;“Directory $dir created ok”&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;ftp_close&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;$ftp&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 119, 0);&quot; _extended=&quot;true&quot;&gt;);&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p _extended=&quot;true&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 187);&quot; _extended=&quot;true&quot;&gt;?&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://enakans.blogspot.com/feeds/5340590513477962182/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1835188757937857652/5340590513477962182' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/5340590513477962182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/5340590513477962182'/><link rel='alternate' type='text/html' href='http://enakans.blogspot.com/2007/05/ftp-with-php.html' title='FTP With PHP'/><author><name>Anton Subagja</name><uri>http://www.blogger.com/profile/12195114675684409523</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1835188757937857652.post-6308440313227181719</id><published>2007-05-15T21:33:00.000-07:00</published><updated>2007-05-15T21:41:53.723-07:00</updated><title type='text'>Coloring Your Scrollbars with CSS</title><content type='html'>&lt;p&gt;It’s true! You really can color your scrollbars and have a change of scenery from the basic gray or other browser default. It just takes a few snippets of CSS markup, which you’ll learn how to do in this tutorial.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;To see the results, you’ll need to view your page with Internet Explorer 5.5+, too. (Most other browsers use the browser default and do &lt;strong&gt;NOT&lt;/strong&gt; support scrollbar colors - see the &lt;a href=&quot;http://websitetips.com/articles/css/scrollbars/#qa&quot;&gt;Further Information&lt;/a&gt; section below.)&lt;/p&gt; &lt;p&gt;You can also color the scrollbar of a form’s &lt;code&gt;textarea&lt;/code&gt; field, &lt;a href=&quot;http://websitetips.com/articles/css/scrollbars/#forms&quot;&gt;as shown below&lt;/a&gt;. I used a variety of bright colors to show some of the &lt;code&gt;scrollbar&lt;/code&gt; property attribute colors that are possible to change.&lt;/p&gt; &lt;p&gt;If you don’t see a colorful scrollbar above, here are some &lt;a href=&quot;http://websitetips.com/articles/css/scrollbars/scrollshot.shtml&quot; onclick=&quot;window.open(&#39;scrollshot.shtml&#39;,&#39;&#39;,&#39;height=420,width=540,toolbar=no,title=no,scrollbars=yes,menubar=no&#39;); return false;&quot; title=&quot;Click on the link to go to a page of screen shots.&quot;&gt;screen shots&lt;/a&gt;. (A separate popup window will open.)&lt;/p&gt; &lt;p class=&quot;ednote&quot;&gt;&lt;em class=&quot;ed&quot;&gt;Editor note Feburary 2006:&lt;/em&gt; Note that not everyone considers colored scrollbars a good thing, and you should also be sure the colors you choose aren’t a problem for those with color deficiencies or vision impairments. Before altering scrollbar colors, make sure they won’t be a problem to use by anyone and that they will be well received by your visitors! See the following:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.w3.org/Style/Examples/007/scrollbars.html&quot; title=&quot;Web Style Sheets: CSS tips &amp;amp; tricks - Bert Bos, W3C, January 06, 2004.&quot;&gt;Un-colored Scrollbars&lt;/a&gt; (W3C)&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.webreference.com/programming/javascript/jf/column8/&quot; title=&quot;WebReference - February 14, 2005.&quot;&gt;JavaScript and Accessibility. Pt. 1&lt;/a&gt; (WebReference)&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.456bereastreet.com/archive/200508/scrolling_and_scrollbars/&quot;&gt;Scrolling and Scrollbars&lt;/a&gt; (456 Berea Street)&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;This tutorial is geared for those with a knowledge of basic HTML markup, including forms, and a beginning to intermediate level knowledge of CSS.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://enakans.blogspot.com/feeds/6308440313227181719/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1835188757937857652/6308440313227181719' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/6308440313227181719'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/6308440313227181719'/><link rel='alternate' type='text/html' href='http://enakans.blogspot.com/2007/05/coloring-your-scrollbars-with-css.html' title='Coloring Your Scrollbars with CSS'/><author><name>Anton Subagja</name><uri>http://www.blogger.com/profile/12195114675684409523</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1835188757937857652.post-4468599967054678682</id><published>2007-04-13T21:56:00.003-07:00</published><updated>2007-04-13T21:56:53.204-07:00</updated><title type='text'>What is a Domain Name?</title><content type='html'>&lt;div id=&quot;postcontent8&quot; class=&quot;postcontent&quot;&gt;&lt;p&gt;A domain name is basically the name of your website such as &lt;code&gt;google.com&lt;/code&gt; or &lt;code&gt;cbc.ca&lt;/code&gt; or &lt;code&gt;computercops.biz&lt;/code&gt;. These are all domain names which are registered by official registrars with various domain name authorities. These authorities make up part of an international database or “domain name system” overseen by the &lt;em&gt;Internet Corporation for Assigned Names and Numbers&lt;/em&gt; &lt;a href=&quot;http://www.icann.org/&quot; title=&quot;(External link - Opens in a new window.)&quot; target=&quot;_blank&quot;&gt;(ICANN)&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;The domain name that you select basically consists of two parts:&lt;/p&gt; &lt;ul class=&quot;List1&quot; type=&quot;disc&quot;&gt;&lt;li&gt;&lt;strong&gt;Second level domain&lt;/strong&gt; - The actual name of your website, e.g., &lt;code class=&quot;Red&quot;&gt;ironspider&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Top level domain (TLD)&lt;/strong&gt; - The 2 or 3 letter suffix at the end of the domain name, e.g. &lt;code class=&quot;Blue&quot;&gt;.com&lt;/code&gt;, &lt;code class=&quot;Blue&quot;&gt;.org&lt;/code&gt;, &lt;code class=&quot;Red&quot;&gt;.ca&lt;/code&gt;, &lt;code class=&quot;Blue&quot;&gt;.uk&lt;/code&gt;, etcetera.&lt;/li&gt;&lt;/ul&gt;  &lt;h2 class=&quot;Heading2&quot;&gt;Choosing the Right Domain Name&lt;/h2&gt; &lt;p&gt;Second level domain names may not be repeated &lt;em&gt;within&lt;/em&gt; each top-level domain but may be repeated across top level domains. For example, as of this writing, there exists &lt;code&gt;ironspider.ca&lt;/code&gt;, &lt;code&gt;ironspider.net&lt;/code&gt; and &lt;code&gt;ironspider.com&lt;/code&gt;. But within the &lt;code&gt;.ca&lt;/code&gt; top level domain, there is only one &lt;code&gt;ironspider&lt;/code&gt; (yours truly). If you find that the domain name you want is already taken then try changing the top-level domain before changing the second level domain.&lt;/p&gt; &lt;p&gt;As for which second level domain name to choose (the actual name of your website), you could try to work in some keywords related to your niche to help gain higher rankings in seach engines. However be advised that there is much disagreement among the experts as to whether this is actually works.&lt;/p&gt; &lt;p&gt;For example, you may want to choose the domain name blue-widgets.com if your company sells ‘blue widgets’. Personally, I think this has little effect on your rankings and you can prove this by just doing a search in Google for keywords related to your niche and see how many of the top ten results have those keywords in their domain names.&lt;/p&gt; &lt;p&gt;Also I’m a firm believer in using your domain name for branding purposes. I think it’s much better to create highly memorable domain name than a blasé domain name that simply contains keywords related to your business.&lt;/p&gt; &lt;p&gt;For example, which name are you more likely to remember?&lt;/p&gt; &lt;p&gt;&lt;code class=&quot;Navy&quot;&gt;purplemonkeyplaytime.com&lt;/code&gt;   &lt;em&gt;OR&lt;/em&gt;   &lt;code class=&quot;Navy&quot;&gt;best-toys-for-tots.com&lt;/code&gt;&lt;/p&gt; &lt;p&gt;Right?&lt;/p&gt; &lt;p&gt;To register a domain name, it is simply a matter of performing a domain name ‘look up’ to find a name that isn’t already taken (since all domain names must be unique), then finding an official registrar, laying the cash on the barrel and presto, you are the owner of an internet domain name.&lt;/p&gt; &lt;h2 class=&quot;Heading2&quot;&gt;Choosing the Right Registrar&lt;/h2&gt; &lt;p&gt;The cheapest domain name registration (from a reputable provider) is currently hovering around $8 - $9 per year.&lt;/p&gt; &lt;p&gt;Here’s some info on what to look for in a domain name registrar:&lt;/p&gt; &lt;ul class=&quot;List1&quot; type=&quot;disc&quot;&gt;&lt;li&gt;&lt;strong&gt;ICANN-accredited domain name registrar&lt;/strong&gt; — You can change web hosts from one month to the next but when it comes to your domain name, you’re pretty much stuck with it for an entire year. This is something you don’t want to mess around with and you definitely want to avoid petty hassles such as who actually owns your domain name once it’s registered. Using a properly accredited registrar will ensure that you are doing business with a reputable company that has met a required set of standards as set out by the &lt;em&gt;Internet Corporation for Assigned Names and Numbers&lt;/em&gt; (ICANN) which is the official body that oversees domain name registration.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Easy domain name management interface&lt;/strong&gt; — You won’t be accessing this very often so you’ll want to have your domain name managed by a registrar that provides an easy-to-use domain name management interface that speaks &lt;em&gt;plain English&lt;/em&gt;. Some of the cheapest domain name registrars won’t put much thought into this which will ultimately have you wasting a lot of time trying to plow past a bunch of technobabble like ‘CNAME’ and ‘MX Record’ when all you want to do is simply update your contact information. Typically you’ll be accessing your domain name management screens to renew your domain name, update contact information or change your nameservers (switch web hosts).&lt;/li&gt;&lt;li&gt;&lt;strong&gt;24/7 technical support&lt;/strong&gt; — This is self-explanatory. Like web hosting, domain name registration is now a highly competitive business. If your registrar can’t offer you 24/7 tech support then they simply aren’t in the game.&lt;/li&gt;&lt;/ul&gt;  &lt;h2 class=&quot;Heading2&quot;&gt;Using Subdomains&lt;/h2&gt; &lt;p&gt;Third level domain names, a.k.a., &lt;em&gt;host names&lt;/em&gt; or &lt;em&gt;subdomains&lt;/em&gt;, are often used by free web hosts to create multiple free hosting accounts to allow users to have a little piece of the web without actually having to register a ‘real’ (second level) domain name. Subdomains usually look like this:&lt;/p&gt; &lt;p&gt;&lt;code class=&quot;Navy&quot;&gt;username.freewebhostname.com&lt;/code&gt;&lt;/p&gt; &lt;p&gt;If you sign up with a free web host and you don’t have your own domain name then they will assign you a subdomain name of this sort. As mentioned earlier, in this situation, it will be painfully obvious that you’re using a free web hosting service. If you’re serious about your website (and you want others to thinks so too) then you should definitely spend the few bucks a year it takes to have your own domain name.&lt;/p&gt; &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://enakans.blogspot.com/feeds/4468599967054678682/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1835188757937857652/4468599967054678682' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/4468599967054678682'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/4468599967054678682'/><link rel='alternate' type='text/html' href='http://enakans.blogspot.com/2007/04/what-is-domain-name.html' title='What is a Domain Name?'/><author><name>Anton Subagja</name><uri>http://www.blogger.com/profile/12195114675684409523</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1835188757937857652.post-6788389539869207426</id><published>2007-04-13T21:56:00.001-07:00</published><updated>2007-04-13T21:56:28.501-07:00</updated><title type='text'>Wildcard DNS and Sub Domains</title><content type='html'>&lt;div id=&quot;postcontent7&quot; class=&quot;postcontent&quot;&gt;&lt;p&gt;What follows is what I consider to be best practice for my personal sites and a guide for those who wish to do the same. Months ago I &lt;a href=&quot;http://photomatt.net/p430&quot; title=&quot;Reset Links&quot;&gt;dropped the &lt;code&gt;www.&lt;/code&gt; prefix&lt;/a&gt; from my domain in part because I think it’s redundant and also because I wanted to experiment with how Google treated valid HTTP redirect codes. The experiment has been a great success. Google seems to fully respect 301 Permanent Redirects and the change has taken my previously split PageRank has been combined and now I am at 7. There are other factors that have contributed to this, of course, and people still continue to link to my site and posts with a &lt;code&gt;www.&lt;/code&gt; (or worse) in front of it, but overall it just feels so much &lt;em&gt;cleaner&lt;/em&gt; to have one URI for one resource, all the time. I’m sure that’s the wrong way to say that, but the feeling is there nonetheless.&lt;/p&gt; &lt;p&gt;Now for the meat. What’s a good way to do this? Let’s look at our goals:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;No links should break.&lt;/li&gt;&lt;li&gt;Visitors should be redirected using a &lt;em&gt;permanent&lt;/em&gt; redirect, HTTP code 301, meaning that the address bar should update and intelligent user agents may change a stored URI&lt;/li&gt;&lt;li&gt;It should be transparent to the user.&lt;/li&gt;&lt;li&gt;It should also work for mistyped “sub domains” such as &lt;code&gt;ww.&lt;/code&gt; or &lt;code&gt;wwww.&lt;/code&gt; (I still get hits from &lt;a href=&quot;http://www.roguelibrarian.com/diary/267/&quot;&gt;Carrie’s bad link&lt;/a&gt;)&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;So we need a little magic in DNS and in our web server. In my case these are &lt;a href=&quot;http://www.isc.org/products/BIND/&quot;&gt;Bind&lt;/a&gt; and &lt;a href=&quot;http://httpd.apache.org/&quot;&gt;Apache&lt;/a&gt;. I am writing about this because at some point the code I put in to catch any subdomain stopped working and while I reimplemented it I decided to write about what I was doing. This method also works with virtual hosts on shared IPs where my previous method did not.&lt;/p&gt; &lt;p&gt;In Bind you need to set up a wildcard entry to catch anything that a misguided user or bad typist might enter in front of your domain name. Just like when searching or using regular expressions you use an asterisk (or splat) to match any number of any characters the same thing applies in Bind. So at the end of my zone DB file (&lt;code&gt;/var/named/photomatt.net.db&lt;/code&gt;) I added the following line:&lt;/p&gt; &lt;p&gt;&lt;code&gt;*.photomatt.net. 14400 IN A 64.246.62.114&lt;/code&gt;&lt;/p&gt; &lt;p&gt;Note the period after my domain. The IP is my shared IP address. That’s all you need, now restart bind. (For me &lt;code&gt;/etc/init.d/named restart&lt;/code&gt;.)&lt;/p&gt; &lt;p&gt;Now you need to set up Apache to respond to requests on any hostname under photomatt.net. Before I just used the convinence of having a dedicated IP for this site and having the redirect VirtualHost entry occur first in my &lt;code&gt;httpd.conf&lt;/code&gt; file. That works, but I have a better solution now. So we want to tell Apache to respond to any request on any subdomain (that does not already have an existing subdomain entry) and redirect it to photomatt.net. Here’s what I have:&lt;/p&gt; &lt;p&gt;&lt;code&gt;&lt;virtualhost&gt;&lt;br /&gt;DocumentRoot /home/photomat/public_html&lt;br /&gt;BytesLog domlogs/photomatt.net-bytes_log&lt;br /&gt;User photomat&lt;br /&gt;Group photomat&lt;br /&gt;ServerAlias *.photomatt.net&lt;br /&gt;ServerName www.photomatt.net&lt;br /&gt;CustomLog domlogs/photomatt.net combined&lt;br /&gt;RedirectMatch 301 (.*) http://photomatt.net$1&lt;br /&gt;&lt;/virtualhost&gt;&lt;/code&gt;&lt;/p&gt; &lt;p&gt;The two magic lines are the &lt;code&gt;ServerAlias&lt;/code&gt; directive which is self explanitory and the &lt;code&gt;RedirectMatch&lt;/code&gt; line which redirects all requests to photomatt.net in a permanent manner.&lt;/p&gt; &lt;p&gt;There is a catch though. The redirecting &lt;code&gt;VirtualHost&lt;/code&gt; entry must come after any valid subdomain &lt;code&gt;VirtualHost&lt;/code&gt; entries you may have, for example I have one for &lt;code&gt;cvs.photomatt.net&lt;/code&gt; and I had to move that entry up in the &lt;code&gt;httpd.conf&lt;/code&gt; because Apache just moves down that file and uses the first one it comes to that matches, so the wildcard should be last.&lt;/p&gt; &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://enakans.blogspot.com/feeds/6788389539869207426/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1835188757937857652/6788389539869207426' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/6788389539869207426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/6788389539869207426'/><link rel='alternate' type='text/html' href='http://enakans.blogspot.com/2007/04/wildcard-dns-and-sub-domains.html' title='Wildcard DNS and Sub Domains'/><author><name>Anton Subagja</name><uri>http://www.blogger.com/profile/12195114675684409523</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1835188757937857652.post-1395543393530385358</id><published>2007-04-13T21:55:00.001-07:00</published><updated>2007-04-13T21:55:57.388-07:00</updated><title type='text'>Simple Optimization for PHP and MySQL</title><content type='html'>&lt;div id=&quot;postcontent6&quot; class=&quot;postcontent&quot;&gt;&lt;p id=&quot;postcontent8&quot; class=&quot;postcontent&quot;&gt;Here is a list of a few very simple tips for optimizing your php/mysql applications. Keep these in mind while developing.&lt;br /&gt;&lt;strong&gt;MySQL&lt;/strong&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;MySQL is interpreted from right to left so you should put the most significant limiters as far to the right as possible.&lt;/li&gt;&lt;li&gt;Only select fields you need, instead of selecting * (everything).&lt;/li&gt;&lt;li&gt;Don’t put things that changes very rarely in the database, instead put it in a global array in some include file.&lt;/li&gt;&lt;li&gt;Use indexes on the columns in the WHERE clause and on the columns you want to ORDER BY.&lt;/li&gt;&lt;li&gt;Indexes are great if you search the table alot, but it slows down insertion.&lt;/li&gt;&lt;li&gt;Use the EXPLAIN command to analyze your indexes.&lt;/li&gt;&lt;li&gt;If you only want one line as a result from the database you should always use LIMIT 1. This way mysql stops searching when it finds the first line instead of continuing through the whole database, only to find that there weren’t any more lines that matched the query.&lt;/li&gt;&lt;li&gt;If you use $line = mysql_fetch_array($result) you’ll get two ways of accessing the columns, $line[0] and $line[’columnname’]. If you only use the $line[’columnname’] you should use $line = mysql_fetch_assoc($result) instead, then there will not be any $line[int index] array.&lt;/li&gt;&lt;li&gt;Sometimes mysql_free_result() end up wasting more memory than it saves. Check the difference with memory_get_usage().&lt;/li&gt;&lt;li&gt;Don’t ask the database for the same stuff over and over again, save the result.&lt;/li&gt;&lt;li&gt;Use NOT NULL as default value as much as you can, it speeds up execution and saves one bit.&lt;/li&gt;&lt;li&gt;Use datatypes that fits your data, not too large. For example, INT can hold values up to 4294967295 unsigned, which is often unnecessarily big. Use MEDIUMINT or SMALLINT where applicable.&lt;/li&gt;&lt;li&gt;Make use of the default values, only insert values that differs from the default values to speed up the insertion.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;strong&gt;PHP:&lt;/strong&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;Many code blocks might slow down the interpretation a little bit. &lt;pre&gt;&lt;?&lt;br /&gt;  ...&lt;br /&gt;  ...&lt;br /&gt;  ...&lt;br /&gt;?&gt;&lt;/pre&gt; &lt;p&gt;is faster than&lt;/p&gt; &lt;pre&gt;&lt;? ... ?&gt;&lt;br /&gt;&lt;? ... ?&gt;&lt;br /&gt;&lt;? ... ?&gt;&lt;/pre&gt; &lt;/li&gt;&lt;li&gt;Don’t concatenate when you don’t need to. &lt;pre&gt;&quot;SELECT id FROM tabell WHERE id = $_SESSION[id] LIMIT 1&quot;&lt;/pre&gt; &lt;p&gt;is faster than:&lt;/p&gt; &lt;pre&gt;&quot;SELECT id FROM tabell WHERE id = &quot;.$_SESSION[&#39;id&#39;].&quot; LIMIT 1&quot;&lt;/pre&gt; &lt;/li&gt;&lt;li&gt;Surrounding your string by ‘ instead of ” will make things interpret a little faster since php looks for variables inside “…” but not inside ‘…’. Of course you can only do this when you don’t need to have variables in the string.&lt;/li&gt;&lt;li&gt;The previous item makes it all boil down to &lt;pre&gt;&#39;SELECT id FROM tabell WHERE id =&lt;br /&gt;&#39;.$_SESSION[&#39;id&#39;].&#39; LIMIT 1&#39;&lt;/pre&gt; &lt;p&gt;as the fastest way of concatenating querys. &lt;/p&gt;&lt;/li&gt;&lt;li&gt;When echoing strings it’s faster to separate them by comma instead of dot. &lt;pre&gt;echo &quot;echoing &quot;,$variable,&quot; something&quot;;&lt;/pre&gt; &lt;p&gt;Note: This only works with echo, which is a function that can take several strings as arguments. &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;em&gt;echo&lt;/em&gt; is faster than &lt;em&gt;print&lt;/em&gt;.&lt;/li&gt;&lt;li&gt;Set the maxvalue for your for-loops before and not in the loop. &lt;pre&gt;$maxvalue = 100/10;&lt;br /&gt;for($i=0; $i&lt;$maxvalue; $i++){&lt;br /&gt;  // Some code&lt;br /&gt;}&lt;/pre&gt; &lt;p&gt;is faster than:&lt;/p&gt; &lt;pre&gt;for($i=0; $i&lt;100/10; $i++){&lt;br /&gt;  // Some code&lt;br /&gt;}&lt;/pre&gt; &lt;p&gt;because the value is calculated once instead of ten times. &lt;/p&gt;&lt;/li&gt;&lt;li&gt;Unset your variables to free memory, especially large arrays.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;If possible it’s of course always better to generate static html pages every time something is updated or as often as an update might be relevant instead of querying the database every time.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Further reading:&lt;/strong&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/data-size.html&quot; target=&quot;_blank&quot;&gt;Choosing right data type&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/explain.html&quot; target=&quot;_blank&quot;&gt;Optimizing Queries with EXPLAIN&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/tips.html&quot; target=&quot;_blank&quot;&gt;Other Optimization Tips&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://phplens.com/lens/php-book/optimizing-debugging-php.php&quot; target=&quot;_blank&quot;&gt;A HOWTO on Optimizing PHP&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://enakans.blogspot.com/feeds/1395543393530385358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1835188757937857652/1395543393530385358' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/1395543393530385358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/1395543393530385358'/><link rel='alternate' type='text/html' href='http://enakans.blogspot.com/2007/04/simple-optimization-for-php-and-mysql.html' title='Simple Optimization for PHP and MySQL'/><author><name>Anton Subagja</name><uri>http://www.blogger.com/profile/12195114675684409523</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1835188757937857652.post-8887180565653622356</id><published>2007-04-13T21:51:00.000-07:00</published><updated>2007-04-13T21:55:22.805-07:00</updated><title type='text'>10 things if you didn’t know about PHP</title><content type='html'>&lt;div id=&quot;postcontent5&quot; class=&quot;postcontent&quot;&gt;&lt;p id=&quot;postcontent7&quot; class=&quot;postcontent&quot;&gt;PHP is simultaneously the most infuriating and joyful languages I’ve ever worked with. I say “infuriating” primarily because the function names are so inconsistant. Despite the fact that I use it almost everyday, I still have to think to myself “Is it &lt;em&gt;str_pos&lt;/em&gt; or &lt;em&gt;strpos&lt;/em&gt;? &lt;em&gt;str_split&lt;/em&gt; or &lt;em&gt;strsplit&lt;/em&gt;?” On the other hand, occasionally I’ll stumble across a gem that perfectly solves the problem at hand with a single line of code.&lt;/p&gt; &lt;p&gt;Here’s a short list of cool features that might have slipped under your radar as well:&lt;/p&gt; &lt;ol&gt;&lt;li&gt;&lt;strong&gt;Use &lt;em&gt;&lt;a href=&quot;http://us3.php.net/manual/en/function.ip2long.php&quot;&gt;ip2long&lt;/a&gt;()&lt;/em&gt; and &lt;em&gt;&lt;a href=&quot;http://blog.rightbrainnetworks.com/2006/09/18/10-things-you-probably-didnt-know-about-php/&quot;&gt;long2ip&lt;/a&gt;()&lt;/em&gt; to store IP addresses as integers instead of strings in a database.&lt;/strong&gt; This will reduce the storage space by almost a factor of four (15 bytes for char(15) vs. 4 bytes for the integer), make it easier to calculate whether a certain address falls within a range, and speed-up searches and sorts (sometimes by quite a bit).&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Partially validate email addresses by checking that the domain name exists with &lt;em&gt;&lt;a href=&quot;http://us3.php.net/manual/en/function.checkdnsrr.php&quot;&gt;checkdnsrr&lt;/a&gt;()&lt;/em&gt;.&lt;/strong&gt; This built-in function checks to ensure that a specified domain name resolves to an IP address. A simple user-defined function that builds on checkdnsrr() to partially valid email addresses can be found in the &lt;a href=&quot;http://us3.php.net/manual/en/function.checkdnsrr.php#48157&quot;&gt;user comments&lt;/a&gt; section in the PHP docs. This is handy for catching those occasional folks who think their email address is ‘joeuser@wwwphp.net’ instead of ‘joeuser@php.net’.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;If you’re using PHP 5 with MySQL 4.1 or above, consider ditching the &lt;em&gt;mysql_*&lt;/em&gt; functions for the improved &lt;em&gt;&lt;a href=&quot;http://us3.php.net/manual/en/ref.mysqli.php&quot;&gt;mysqli_*&lt;/a&gt;&lt;/em&gt; functions.&lt;/strong&gt; One nice feature is that you can use &lt;a href=&quot;http://us3.php.net/mysqli_stmt_prepare&quot;&gt;prepared statements&lt;/a&gt;, which may speed up queries if you maintain a database-intensive website. &lt;a href=&quot;http://www.johnjawed.com/benchmarks/&quot;&gt;Some benchmarks&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Learn to love the &lt;a href=&quot;http://us3.php.net/language.operators.comparison#language.operators.comparison.ternary&quot;&gt;ternary operator&lt;/a&gt;&lt;/strong&gt;.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;If you get the feeling that you might be reinventing the wheel during a project, check &lt;a href=&quot;http://pear.php.net/&quot;&gt;&lt;em&gt;PEAR&lt;/em&gt;&lt;/a&gt; before you write another line.&lt;/strong&gt; PEAR is a great resource that many PHP developers are aware of, yet many more are not. It’s an online repository containing over 400 reusable snippets that can be dropped right into your PHP application. Unless your project is trully unique, you ought to be able to find a PEAR package that saves at least a little time. (Also see &lt;a href=&quot;http://pecl.php.net/&quot;&gt;PECL&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Automatically print a nicely formatted copy of a page’s source code with &lt;a href=&quot;http://us3.php.net/manual/en/function.highlight-file.php&quot;&gt;highlight_file&lt;/a&gt;().&lt;/strong&gt;This function is handy for when you need to ask for some assistance with a script in a messageboard, IRC, etc. Obviously, some care must be taken not to accidently show your source when it contains DB connection information, passwords, etc.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Prevent potentially sensitive error messages from being shown to users with the &lt;em&gt;&lt;a href=&quot;http://us3.php.net/manual/en/function.error-reporting.php&quot;&gt;error_reporting(0)&lt;/a&gt;&lt;/em&gt; function.&lt;/strong&gt; Ideally error reporting should be completely disabled on a production server from within &lt;em&gt;php.ini&lt;/em&gt;. However if you’re on a shared webhost and you aren’t given your own &lt;em&gt;php.ini&lt;/em&gt;, then your best bet is to add &lt;em&gt;error_reporting(0);&lt;/em&gt; as the first line in each of your scripts (or use it with &lt;a href=&quot;http://us3.php.net/manual/en/function.require-once.php&quot;&gt;require_once()&lt;/a&gt;.) This will prevent potentially sensitive SQL queries and path names from being displayed if things go awry.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Use &lt;em&gt;&lt;a href=&quot;http://us3.php.net/manual/en/function.gzcompress.php&quot;&gt;gzcompress&lt;/a&gt;()&lt;/em&gt; and &lt;em&gt;&lt;a href=&quot;http://us3.php.net/manual/en/function.gzuncompress.php&quot;&gt;gzuncompress&lt;/a&gt;()&lt;/em&gt; to transparently compress/decompress large strings before storing them in a database.&lt;/strong&gt; These built-in functions use the gzip algorithm and can compress plaintext up to 90%. I use these functions almost everytime I read/write to a &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/blob.html&quot;&gt;BLOB&lt;/a&gt; field within PHP. The only exception is when I need full text indexing capabilities.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Return multiple values from a function with “&lt;a href=&quot;http://us3.php.net/manual/en/functions.arguments.php#functions.arguments.by-reference&quot;&gt;by reference&lt;/a&gt;” parameters.&lt;/strong&gt; Like the ternary operator, most PHP developers who come from a more formalized programming background already know this one. However, those who’s background is more HTML than Pascal, probably have wondered at one time “how do I get multiple values back from a function I wrote, even though I can only use one &lt;em&gt;return&lt;/em&gt; value?” The answer is that you precede a variable with “&amp;amp;” and use it “by reference” instead of “by value”.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Fully understand “&lt;a href=&quot;http://us3.php.net/manual/en/security.magicquotes.php&quot;&gt;magic quotes&lt;/a&gt;” and the dangers of &lt;a href=&quot;http://en.wikipedia.org/wiki/SQL_injection&quot;&gt;SQL injection&lt;/a&gt;.&lt;/strong&gt; I’m hoping that most developers reading this are already familiar with SQL injection. However, I list it here because it’s absolutely critical to understand. If you’ve never heard the term before, spend the entire rest of the day googling and reading.&lt;/li&gt;&lt;/ol&gt; &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://enakans.blogspot.com/feeds/8887180565653622356/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1835188757937857652/8887180565653622356' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/8887180565653622356'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/8887180565653622356'/><link rel='alternate' type='text/html' href='http://enakans.blogspot.com/2007/04/10-things-if-you-didnt-know-about-php.html' title='10 things if you didn’t know about PHP'/><author><name>Anton Subagja</name><uri>http://www.blogger.com/profile/12195114675684409523</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1835188757937857652.post-3972239660851563045</id><published>2007-04-13T21:49:00.000-07:00</published><updated>2007-04-13T21:51:14.856-07:00</updated><title type='text'>Cheat Sheet Roundup - Over 30 Cheatsheets for developers</title><content type='html'>Lets face it, unless you have a photographic memory, no developer can remember all the different functions, options, tags, etc. that exist. Documentation can be cumbersome at times, thats why I like cheat sheets. They are quick references that feature the most commonly forgotten things on a specific topic. You can print them out and hang them on your wall, or just keep them handy in your bookmarks for quick reference.&lt;div id=&quot;postcontent4&quot; class=&quot;postcontent&quot;&gt;&lt;p id=&quot;postcontent5&quot; class=&quot;postcontent&quot;&gt; &lt;/p&gt; &lt;p&gt;I have rounded up over 30 cheatsheets that developers might find useful.&lt;/p&gt; &lt;h3&gt;Web Development Cheat Sheets&lt;/h3&gt; &lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.ilovejackdaniels.com/javascript/javascript-cheat-sheet/&quot;&gt;JavaScript&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.ilovejackdaniels.com/css/css-cheat-sheet/&quot;&gt;CSS&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://home.tampabay.rr.com/bmerkey/cheatsheet.htm&quot;&gt;CSS&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.ilovejackdaniels.com/resources/colour-chart/&quot;&gt;Hex Codes&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.psacake.com/web/dy.asp&quot;&gt;HTML&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://cdburnerxp.se/htmlcheatsheet.pdf&quot;&gt;XHTML&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.cookwood.com/html/extras/entities.html&quot;&gt;HTML Entities&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;h3&gt;Databases / SQL Cheat Sheets&lt;/h3&gt; &lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.ilovejackdaniels.com/php/mysql-cheat-sheet/&quot;&gt;MySQL&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://nparikh.freeshell.org/unix/mysql.php&quot;&gt;MySQL&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.technochallenged.com/oracle-8-cheat-sheet.html&quot;&gt;Oracle&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.3gwt.net/demo/SQL_redux.html&quot;&gt;SQL&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.selectorweb.com/sql_sybase.html&quot;&gt;Sybase&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;h3&gt;Language Cheat Sheets&lt;/h3&gt; &lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.petefreitag.com/cheatsheets/coldfusion/&quot;&gt;ColdFusion&lt;/a&gt; - work in progress&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.ilovejackdaniels.com/php/php-cheat-sheet/&quot;&gt;PHP&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.zenspider.com/Languages/Ruby/QuickRef.html#36&quot;&gt;Ruby&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.crazygrrl.com/weav/reference.php3&quot;&gt;Regular Expressions&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.digilife.be/quickreferences/QRC/JSP%20Syntax.pdf&quot;&gt;JSP&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.petefreitag.com/cheatsheets/java/&quot; title=&quot;Java 1.5 Cheatsheet&quot;&gt;Java&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.yukoncollege.yk.ca/%7Ettopper/COMP118/rCheatSheet.html&quot;&gt;Python&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;h3&gt;Version Control Cheat Sheets&lt;/h3&gt; &lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www-bcl.cs.unm.edu/computers/cvs.html&quot;&gt;CVS&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.abbeyworkshop.com/howto/misc/svn01/&quot;&gt;Subversion&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;h3&gt;Other&lt;/h3&gt; &lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.googleguide.com/advanced_operators_reference.html&quot;&gt;Google&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.ss64.com/nt/&quot;&gt;Windows&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.pixelbeat.org/cmdline.html&quot;&gt;Unix&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.rain.org/%7emkummel/unix.html&quot;&gt;Unix&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.sloppycode.net/nix/&quot;&gt;Unix&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.lagmonster.org/docs/vi.html&quot;&gt;Vi&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://bullium.com/support/vim.html&quot;&gt;Vim&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.ilovejackdaniels.com/cheat-sheets/mod_rewrite-cheat-sheet/&quot;&gt;mod_rewrite&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.petefreitag.com/cheatsheets/ascii-codes/&quot;&gt;ASCII Character Codes&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.thejackol.com/htaccess-cheatsheet/&quot;&gt;htaccess&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;h3&gt;Commercially Printed CheatSheets&lt;/h3&gt; &lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.visibone.com/&quot;&gt;Visibone&lt;/a&gt; - javascript, browsers, colors, fonts, html.&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.technochallenged.com/&quot;&gt;TechnoChallenged&lt;/a&gt; - web dev, programming, os, software&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Am I missing any good ones? Feel free to post any others in the comments.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Updates:&lt;/strong&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://juerd.nl/site.plp/perlcheat&quot;&gt;Perl&lt;/a&gt; - thanks Dom.&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.regxlib.com/CheatSheet.htm&quot;&gt;Regex&lt;/a&gt; - thanks bjhanifin&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://search.cpan.org/%7Enwclark/perl-5.8.7/pod/perlcheat.pod&quot;&gt;Perl&lt;/a&gt; - thanks Derek&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.cs.put.poznan.pl/csobaniec/Papers/svn-refcard.pdf&quot;&gt;Subversion&lt;/a&gt; - nice reference card, thanks Andreas&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://people.debian.org/%7Edebacle/refcard/refcard-en-a4.pdf&quot;&gt;Debian&lt;/a&gt; - thanks again Andreas&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.holub.com/goodies/uml/index.html&quot;&gt;UML&lt;/a&gt; - Andreas again, thanks&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.petefreitag.com/cheatsheets/postgresql/&quot; title=&quot;PostgreSQL cheat sheet&quot;&gt;PostgreSQL&lt;/a&gt; - thanks for the suggestion frank.&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.petefreitag.com/cheatsheets/xhtml/&quot; title=&quot;HTML Cheat Sheet&quot;&gt;XHTML / HTML&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;strong&gt;Related Entries&lt;/strong&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.petefreitag.com/item/550.cfm&quot; title=&quot;ColdFusion on the TIOBE index&quot;&gt;ColdFusion on the TIOBE index&lt;/a&gt; - March 18, 2006&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.petefreitag.com/item/460.cfm&quot; title=&quot;Cheat Sheet for PostgreSQL&quot;&gt;Cheat Sheet for PostgreSQL&lt;/a&gt; - September 7, 2005&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.petefreitag.com/item/622.cfm&quot; title=&quot;Calculating Distance in Miles from Latitude and Longitude&quot;&gt;Calculating Distance in Miles from Latitude and Longitude&lt;/a&gt; - January 18, 2007&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.petefreitag.com/item/587.cfm&quot; title=&quot;Uploading Files Like GMail Attachments&quot;&gt;Uploading Files Like GMail Attachments&lt;/a&gt; - October 6, 2006&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.petefreitag.com/item/480.cfm&quot; title=&quot;CheatSheet for Apache&quot;&gt;CheatSheet for Apache&lt;/a&gt; - October 7, 2005&lt;/li&gt;&lt;/ul&gt; &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://enakans.blogspot.com/feeds/3972239660851563045/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1835188757937857652/3972239660851563045' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/3972239660851563045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/3972239660851563045'/><link rel='alternate' type='text/html' href='http://enakans.blogspot.com/2007/04/cheat-sheet-roundup-over-30-cheatsheets.html' title='Cheat Sheet Roundup - Over 30 Cheatsheets for developers'/><author><name>Anton Subagja</name><uri>http://www.blogger.com/profile/12195114675684409523</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1835188757937857652.post-8230999527607884498</id><published>2007-04-13T21:46:00.000-07:00</published><updated>2007-04-13T21:48:36.715-07:00</updated><title type='text'>PNG OVERLAY : USEFUL CSS TECHNIQUE FOR MASKING IMAGE ON YOUR WEBSITE</title><content type='html'>When designing a webpage webdesigner have some idea, something to beautify an image shape so it’s not common and classic style with just box style. But other reason that must be a consideration is if that image is part of dynamic content, that mean every time post a news/dynamic content we must editing the image shape, it’s very wasting time. In this case, I have some problem too :) , so I browse on the net to find solution, and lucky me I found some interesting solution for this :) , thanks to Nathan Smith for the “&lt;a href=&quot;http://sonspring.com/journal/png-overlay&quot;&gt;PNG Overlay&lt;/a&gt;” solution.&lt;div id=&quot;postcontent3&quot; class=&quot;postcontent&quot;&gt; &lt;p id=&quot;postcontent3&quot; class=&quot;postcontent&quot;&gt; &lt;/p&gt;&lt;p id=&quot;postcontent6&quot; class=&quot;postcontent&quot;&gt; &lt;/p&gt; &lt;p&gt;Related article about PNG Overlay and Transparency :&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;http://www.tjkdesign.com/articles/png_overlay_with_no_extra_markup.asp&quot;&gt;PNG overlay using one single Image element&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://solardreamstudios.com/learn/fireworks/simplemasks&quot;&gt;How to create simplemasks &lt;/a&gt;&lt;/p&gt; &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://enakans.blogspot.com/feeds/8230999527607884498/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1835188757937857652/8230999527607884498' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/8230999527607884498'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1835188757937857652/posts/default/8230999527607884498'/><link rel='alternate' type='text/html' href='http://enakans.blogspot.com/2007/04/png-overlay-useful-css-technique-for.html' title='PNG OVERLAY : USEFUL CSS TECHNIQUE FOR MASKING IMAGE ON YOUR WEBSITE'/><author><name>Anton Subagja</name><uri>http://www.blogger.com/profile/12195114675684409523</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry></feed>