<?xml version="1.0" encoding="UTF-8"?><rss version="2.0">
<channel>
<title>PHP</title>
<link>http://www.computersight.com/tags/PHP</link>
<description>New posts about PHP</description>
<item>
<title>How To: Set Up a Linux Based Server Using Ubuntu</title>
<link>http://www.computersight.com/Operating-Systems/Ubuntu/How-To-Set-Up-a-Linux-Based-Server-Using-Ubuntu.389931</link>
<description>
<![CDATA[<p>If you use this tutorial, you will not have to pay someone else for website hosting. However, you will still have to purchase a domain name (.com, .net, .org, or a different Top-Level Domain). You will also have to have your own connection to the internet, with a static IP. This article does NOT cover setting up the port forwarding on your router if you have one, just the set up of the actual server.</p>
<h3>Getting Ready</h3>
<p>First off, you will need a computer that you do not use for anything else, including surfing the Internet. If you do not have one, you can purchase any brand name computer, or, if you prefer, build one your self. You will also need a broadband internet connection, preferably with a high upload speed.</p>
<p>If you do not have a static IP, or if you do not know if you have a static IP, call your Internet provider. Make sure you write down the static IP, as you will need it later.</p>
<p>You will need to download Ubuntu from the Ubuntu website, and burn it to a CD. This is not the same as burning a music or general data CD. You will want to use your burning program's "Burn from image" feature (the image is a .iso image). If your burning program does not have this feature, you can usually find freeware that does. Make DOUBLE sure that&amp;nbsp; you download the SERVER EDITION of Ubuntu.</p>
<h3>Installing Ubuntu</h3>
<p>Insert the CD you burned into your CD-ROM or DVD drive, and boot your computer. Some computers will automatically boot from the CD so you can install. For the computers that do not automatically boot from the CD, there will usually be a screen that comes up saying something along the lines of "Press any key to boot from CD or DVD...". This usually gives you a limited amount of time to press any key. Press any key and it will boot from the CD.</p>
<p>After you have booted from the CD, choose the install option. This is a fairly easy step-by-step process. One of the screens will ask you what type of server you wish to install. Choose HTTP or LAMP server (LAMP stands for "<strong>L</strong>inux, <strong>A</strong>pache, <strong>M</strong>ySQL, <strong>P</strong>HP server"). After the installation is finished, it will ask you to remove the CD or DVD and restart the computer.</p>
<h3>Setting Everything Up</h3>
<p>After you have rebooted your computer, you will notice that the operating system successfully installed, but there is no user interface, just a command prombt-like interface. This is called the "Linux Terminal". Ubuntu Server Edition does not come with a desktop interface installed by default. First, type in your user name and password that you created during installation.</p>
<p>If you are not experienced with the Linux Terminal, you may want to install a desktop evironment. To install the Gnome Desktop environment, type the following into the Terminal:</p>
<blockquote>
<p>$ sudo su</p>
<p>[The password you created durring installation]</p>
<p>$ apt-get install gnome-desktop</p>
</blockquote>
<p>Or, if you perfer the KDE Desktop evironment, type the following:</p>
<blockquote>
<p>$ sudo su</p>
<p>[The password you created during the installation]</p>
<p>$ apt-get install kde-desktop</p>
</blockquote>
<p>Please keep in mind that you do NOT type the $ symbols when typing commands. Those are there to let readers of this article know that it is a new command.</p>
<p>After the desktop environment has finished installing, you server is ready to use. The directory you will put your website in is the '/var/www' directory. This can be changed, but changing it involves editing the Apache configuration files. I do not recommend doing this if you are not familiar with those files. I will do another tutorial next week on how to use WordPress with this type of Ubuntu installation.</p><a href="http://www.pheedo.com/click.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FOperating-Systems%2FUbuntu%2FHow-To-Set-Up-a-Linux-Based-Server-Using-Ubuntu.389931"><img src="http://www.pheedo.com/img.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FOperating-Systems%2FUbuntu%2FHow-To-Set-Up-a-Linux-Based-Server-Using-Ubuntu.389931" border="0"/></a>]]></description>
<pubDate>Wed, 10 Dec 2008 06:22:24 PST</pubDate></item>
<item>
<title>What is PHP? Learn the Basics</title>
<link>http://www.computersight.com/Programming/PHP/What-is-PHP-Learn-the-Basics.329203</link>
<description>
<![CDATA[<p>You might have seen a lot of website having tail ".php". Basically these are PHP websites. You might have been quiet impressed by the site design and dynamic qualities of these websites. You can too create websites like these in a matter of hours. But first you need to know what on earth PHP is.</p>
<p>In the world of the wide web, there are two general types of coding languages: &amp;ldquo;Server side&amp;rdquo; and &amp;ldquo;Client side&amp;rdquo;.</p>
<p>This means that one type is run, or interpreted, on the web server itself, and the other is run in your web browser. PHP is a Server side language. All of the processing is done on the web server itself, and the result is delivered to your web browser as HTML (which, by the way, is a Client side language). Your web server must also have PHP installed in order for it to work! Most web hosting providers have PHP installed, so if you are in doubt, simply ask them.</p>
<p>But testing PHP websites is quite a hectic work. You need to have PHP installed in your system. You also need to install a server like Apache. But good news is both are free and open source. You can download them and install from their respective website. (Packages from other websites may not be reliable).</p>
<p><img src="http://images.stanzapub.com/readers/2008/11/03/0_13.jpg" alt="" /></p>
<p>I am assuming that you have already installed the Apache Server in your system.</p>
<p>Run the MSI installer and follow the instructions provided by the installation wizard. You will be prompted to select the Web Server you wish to configure first, along with any configuration details needed.</p>
<p>You will then be prompted to select which features and extensions you wish to install and enable. By selecting "Will be installed on local hard drive" in the drop-down menu for each item you can trigger whether to install the feature or not</p>
<p><img src="http://images.stanzapub.com/readers/2008/11/03/1_6.jpg" alt="" /></p>
<p>It is not recommended to install all extensions by default. Instead, use the Installation Repair Mode that can be triggered thru the "Add/Remove Programs" control panel to enable or disable extensions and features after installation.</p>
<p>After you install PHP You need to test it. Open the "Note Pad" and write the following code:</p>
<p>phpinfo();</p>
<p>?&amp;gt;</p>
<p>Save this file in "htdocs" of your server as phpinfo.php.</p>
<p>Now open your favorite browser and type: localhost/phpinfo.php</p>
<p>A long page will be displayed with all the PHP description. If the page doesn't comes then check your PHP installation.</p>
<p><img src="http://images.stanzapub.com/readers/2008/11/03/435023_2.jpg" alt="" /></p><a href="http://www.pheedo.com/click.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FPHP%2FWhat-is-PHP-Learn-the-Basics.329203"><img src="http://www.pheedo.com/img.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FPHP%2FWhat-is-PHP-Learn-the-Basics.329203" border="0"/></a>]]></description>
<pubDate>Tue, 04 Nov 2008 04:52:40 PST</pubDate></item>
<item>
<title>Solidworks Tutorial: How to Draw Simple 2D Geometries</title>
<link>http://www.computersight.com/Software/Solidworks-Tutorial-How-to-Draw-Simple-2D-Geometries.250823</link>
<description>
<![CDATA[<p>This is the first article of my Solidworks tutorial. By this article, I aim to teach how to draw some simple geometries by Solidworks. This work is for students, engineers and engineering candidates. After reading this article, one can draw lines, rectangles in Solidworks. I present step by step procedures in these simple drawing.</p>
<p>Above all, we will use sketch command to define a planes. Simply pressing sketch button in Solidwork menu, you can define a plane on which you want to start drawing. Basically, one has three alternatives, front, top, and right respectively. For 2D drawings, one can select any of them. In our tutorial set, I will select top plane as a reference plane. This means, I'll draw on the top surface of imaginary rectangular prism. Think like this for simplicity.</p>
<p><img src="http://images.stanzapub.com/readers/2008/09/11/sol1_1.jpg" alt="" />&amp;nbsp; <br /><br /><img src="http://images.stanzapub.com/readers/2008/09/11/sol2_1.jpg" alt="" /></p>
<h4>How to draw a line</h4>
<p>To draw line, simply click the line figure on the toolbar. Solidworks will present you four alternatives to draw line. They are "as sketched", "horizontal", "vertical" and "angle". Lets we draw a vertical line with a height of 60. Click the "vertical" radio button and&amp;nbsp; and somewhere on the screen and drag the tip of cursor vertically. This will draw a vertical line. To dimension it, click "smart dimension" button and starting point of line. Then drag the tip of cursor to the end point of vertical line. Solidworks will ask you the numerical length of the line. Write 60 into the space. Now, you have a vertical line with a length of 60 mm.</p>
<p><img src="http://images.stanzapub.com/readers/2008/09/11/sol3_1.jpg" alt="" /></p>
<h4>How to draw a rectangle</h4>
<p>To draw rectangle, click the rectangle figure on the toolbar. Then draw a rectangle with any lengths. Then dimension it by using "smart dimension" button. Dimension each side of rectangle. Let's draw a rectangle with a side length of 120 mm and a height of 80 mm.</p>
<p><img src="http://images.stanzapub.com/readers/2008/09/11/sol4_1.jpg" alt="" /></p><a href="http://www.pheedo.com/click.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FSoftware%2FSolidworks-Tutorial-How-to-Draw-Simple-2D-Geometries.250823"><img src="http://www.pheedo.com/img.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FSoftware%2FSolidworks-Tutorial-How-to-Draw-Simple-2D-Geometries.250823" border="0"/></a>]]></description>
<pubDate>Fri, 12 Sep 2008 03:06:40 PST</pubDate></item>
<item>
<title>Lets Learn C : Printing Strings on to the Screen</title>
<link>http://www.computersight.com/Programming/Lets-Learn-C--Printing-Strings-on-to-the-Screen.225265</link>
<description>
<![CDATA[<p>Here is the first article of my tutorial set. I aim to teach you the basics of C. In this first lesson, I am going to teach you how to output a series of strings on to terminal screen of C program.</p>
<p>Virtually every program code has inputs and outputs. Before compiling a source code, programs generally request an input from the user and then output it to the screen after compiling if the program is well designed and there is no error inside it. Usually, as the program becomes more complicated, error possibility increases. A good software expert easily realizes where the code has faults and corrects it. Since our first code will be very small and very simple, we will not face with any error.</p>
<p>Before starting to write code, we initially have a compiler which is going to evaluate our code. I use Dev C for this. There are many other compilers which run on different platforms like Unix, Linux and Windows.</p>
<p>In this project, we will output the names of  the subprograms of Triond on to C terminal screen. This is the simplest algorithm since there is no input in this example. Let's start writing our code step by step.</p>
<p>Step 1: Open the File from the menu bar of C software and save as the blank page Project1. This yields a file with an extension of cpp.</p>
<p>Step 2: Describe the name and aim of the programs. To do so, we use comments. Comments are ignored by the compiler. For commenting, we use some special scripts like double slash  or  slash-asterisk character .</p>
<p>If we use a single line comment, double slash is enough. However, if our comment is placed more than one line, we use double slash for each line or take the commented part between  slash-asterisk and asterisk-slash characters .</p>
<p>Step 3:  C needs library files which define what the input and output functions are and what they do when they are used in a code. Iostream is the library file of input and output function.</p>
<p>Before the name of library files, we use a special character,  preprocessor directive character. Include is used before the name of every library file and such file names are placed mathematical comparison characters.</p>
<p>Step 4:  Every C code uses functions. The default function is main. Main function is the first function compiled by the programs. This function usually calls other functions. Before the name of function, we specify which type of output our code returns. In our program, we think that it returns to integer and use int. After the function name, we use parantheses. In this example, there will be nothing between parantheses but in more complicated programs, there may be parameter names and it's types or definitions. We place our statements between left brace  and  right brace.</p>
<p>Step 5:  To print on to the screen,we use cout function. We simply place our string inside  double quote  characters. Every statement inside the functions ends with a special semicolon character.</p>
<p>Step 6:  To check the validity, we use return function.In this simple example, it returns to 0.</p>
<p><a href="http://clesson1.blogspot.com/" target="_blank">Click here for the code</a></p><a href="http://www.pheedo.com/click.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FLets-Learn-C--Printing-Strings-on-to-the-Screen.225265"><img src="http://www.pheedo.com/img.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FLets-Learn-C--Printing-Strings-on-to-the-Screen.225265" border="0"/></a>]]></description>
<pubDate>Sun, 24 Aug 2008 10:02:41 PST</pubDate></item>
<item>
<title>Mac OS X: A Web Developer's Dream</title>
<link>http://www.computersight.com/Operating-Systems/Mac-OS/Mac-OS-X-A-Web-Developers-Dream.186115</link>
<description>
<![CDATA[<p>Web developers often shy away from Mac OS X, because they believe that it is very unsuitable in terms of web development; this is very untrue, and in this article I will talk about Mac OS X and web development, sorting out truth from fiction.</p>
<h3>Myth #1</h3>
<p>You can't do any real web development on Mac OS X, including server scripts such as PHP.</p>
<h4>The Truth</h4>
<p>You can do the same amount of web development on Mac OS X as you can on any Windows machine; in fact, I have found Mac OS X even easier to set up server scripts. Recently I decided to set up PHP on my Mac at home to find out that Mac OS X Leopard actually comes with Apache2 and PHP5 already installed onto it! All it takes is a few configuration steps to set up PHP5 to work on your computer.</p>
<h3>Myth #2</h3>
<p>It is much harder to set up the use of web development languages on Mac OS X than it is on Windows.</p>
<h4>The Truth</h4>
<p>I have actually found it easier to set up different web development languages on my Mac than on my friends Windows computer. A few days after I set up Apache2, PHP5 and MySQL on my Mac I helped a friend do it on his Windows computer. It took at least 3 more hours to get all of them installed on his computer than on mine, and even longer to get MySQL to work because the default configuration file for MySQL on Windows does not have everything needed for it to work.</p>
<h3>Myth #3</h3>
<p>You might be able to do web development on Mac, but you can't get much further than the things you can do with iWeb.</p>
<h4>The Truth</h4>
<p>You can do the same scripting on a Mac as you can do on a Windows machine. Saying that you are confined to iWeb is like saying you are confined to Frontpage on Windows.</p>
<p>There are many more myths regarding Mac OS X and web development, but I think that this will help some of you realize that Mac OS X is just as good for web development as Windows is. In the end, the scripting of languages is the same on both machines because the languages do not change depending on operating systems; the only difference I can find is setting up those scripting languages, which I have found to be much easier on Mac OS X than on Windows.</p><a href="http://www.pheedo.com/click.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FOperating-Systems%2FMac-OS%2FMac-OS-X-A-Web-Developers-Dream.186115"><img src="http://www.pheedo.com/img.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FOperating-Systems%2FMac-OS%2FMac-OS-X-A-Web-Developers-Dream.186115" border="0"/></a>]]></description>
<pubDate>Mon, 28 Jul 2008 06:16:49 PST</pubDate></item>
<item>
<title>PHP Tutorial: Printing on the Screen</title>
<link>http://www.computersight.com/Programming/PHP/PHP-Tutorial-Printing-on-the-Screen.112786</link>
<description>
<![CDATA[<p>PHP is a script language commonly used by webmasters to design dynamic websites. Unlike HTML which has static content, PHP has dynamic content because of user interaction. Today, most of the qualified websites are designed by PHP or CGI.</p>
 
<p>PHP scripts embedded into the HTML codes. When someone checks the source code of the page, he doesn't get anything about PHP scripts. He only learns the HTML part of coding. This article is an introduction to PHP scripting language. One can find useful information and have enough knowledge after reading my PHP tutorial series. Without delay, I would like to start my script creation step by step.</p>
 
<p>Before starting, you should know that you have to set up PHP installations into your computer. Such installations are PHP itself, Phpmyadmin interface, Mysql database and Apache Server. Without these, your scripts are nothing since they are not compiled by your computer.</p>
 
<h3>Step 1:</h3>
 
<p>To write PHP scripts, we need a place. That place is a simple text editor. You are free to choose your text editor. I prefer  to use Notepad. There are other alternatives like Editplus or Elfima. If your operating system is not Windows but Linux, you can place your code into Vi editor or Pico. I have never tried but I think you can use Dreamveawer, Hotdog or Frontpage.</p>
 
<p>In your text editor, open an new file and save it as &amp;ldquo;myfirst.php&amp;rdquo; or &amp;ldquo;myfirst.html&amp;rdquo; . I choose the name of file as &amp;ldquo;myfirst&amp;rdquo; but you are free to choose anything.</p>
 
<h3>Step 2:</h3>
 
<p>I have told you before that PHP scripts are embedded into HTML codes. So, first of all we will write HTML codes. The basic codes are HTML, TITLE, HEAD and BODY. It can be written by lowercase letters as well. This part is not important.</p>
 
<p><img src="http://images.stanzapub.com/readers/computersight/2008/04/22/149028_0.jpg" alt="" /></p>
 
<p><strong>Step 3: </strong>All PHP scripts start with &amp;ldquo;  &amp;rdquo;. Only the part between two  is compiled by server and evaluated as output.To print characters on the screen, standart output functions of PHP are used. Those are &amp;ldquo; print &amp;rdquo; and &amp;ldquo; echo &amp;rdquo;. In some circumstances, &amp;rdquo; printf &amp;rdquo; is used too.</p>
 
<p>The format of printing:</p>
 <ol> 
<li> print  ( &amp;ldquo; your output &amp;rdquo; ) ;</li>
 
<li> print   &amp;ldquo; your output &amp;rdquo;  ;</li>
 
<li> echo &amp;ldquo; your output &amp;rdquo;  ;</li>
 
<li> echo ( &amp;ldquo; your outpu t&amp;rdquo; ) ; </li>
 </ol> 
<p>If you don't use any white space characters, the strings are written without any separation. For example if you write this code;</p>
 
<ul>
<li>Print ( &amp;ldquo; Word1 &amp;rdquo; ) ;</li>
 
<li>Print ( &amp;ldquo; Word2 &amp;rdquo; ) ;</li>
 
</ul>
<p>It will be outputted as Word1Word2.</p>
 
<p>To remove this fault,white space characters are used. In PHP code part, between print functions, we place &amp;lt; br &amp;gt; code.</p>
 
<p>Example: To be more understandable,I will write a simple PHP script. Output will be the name of my favorite Triond writers.</p>
 
<p><img src="http://images.stanzapub.com/readers/computersight/2008/04/22/149028_1.jpg" alt="" /></p>
 
<p>To see the output,<a href="http://learnphp.awardspace.biz/" target="_blank"> Click here.</a></p><a href="http://www.pheedo.com/click.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FPHP%2FPHP-Tutorial-Printing-on-the-Screen.112786"><img src="http://www.pheedo.com/img.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FPHP%2FPHP-Tutorial-Printing-on-the-Screen.112786" border="0"/></a>]]></description>
<pubDate>Tue, 22 Apr 2008 06:42:32 PST</pubDate></item>
<item>
<title>Shaunsboards Development</title>
<link>http://www.computersight.com/Software/Shaunsboards-Development.109282</link>
<description>
<![CDATA[<p>&amp;ldquo;Becoming interested in PHP while developing one of my <a href="http://www.runescape.com" target="_blank">RuneScape</a> fan sites,&amp;rdquo; says Shaun, the developer of ShaunsBoards, &amp;ldquo;I wanted to provide some safe, secure, and easy to use forum software.&amp;rdquo;</p>
<p>Starting in July of 2007, Shaun ventured out into the world of PHP, on his quest to start ShaunsBoards. &amp;ldquo;It was very difficult at first, having to learn all this new PHP nonsense,&amp;rdquo; says Shaun, the developer of ShaunsBoards.</p>
<p>&amp;ldquo;The first version of ShaunsBoards, I really focused on the core of the ShaunsBoards system, and the entire thing was mostly text-based. It wasn't until the second or third version of ShaunsBoards that I really started to worry about the design.&amp;rdquo;</p>
<p>I have seen the core files of ShaunsBoards. If I can tell you anything, it would be that Shaun has spent a lot time, effort, and pride into this forum software.</p>
<p>When asked about how he feels about competitors such as Invision Power Board, and vBulletin, his reply is: &amp;ldquo;I think they are great interpretations of the way forum software should be, but both are very confusing to manage, and things such as skinning, and modifications become very difficult tasks. With ShaunsBoards, my task is to make things simply...simple. I want to make things easy for someone who has very little computer experience.&amp;rdquo;</p>
<p>Shaun's plans on pricing are to release the first couple of beta stages for free, and then a small fee will be needed to obtain a license to use the software.</p>
<p>No matter what the competitors throw at ShaunsBoards, I think the software will make it big.</p>
<p>Drop by sometime and look at <a href="http://sb.shaunsnetwork.com" target="_blank">ShaunsBoards</a>.<a href="http://sb.shaunsnetwork.com" target="_blank"><br /></a></p><a href="http://www.pheedo.com/click.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FSoftware%2FShaunsboards-Development.109282"><img src="http://www.pheedo.com/img.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FSoftware%2FShaunsboards-Development.109282" border="0"/></a>]]></description>
<pubDate>Mon, 14 Apr 2008 07:02:54 PST</pubDate></item>
<item>
<title>The Basics of PHP</title>
<link>http://www.computersight.com/Programming/PHP/The-Basics-of-PHP.100598</link>
<description>
<![CDATA[<h3>Comments</h3>
<p>Comments are very simple, they are defined using //</p>
<p>For example:<br /> // My Comment</p>
<p>Multi-line comments can easily be defined by using /* and closing with */</p>
<p>For example:<br /> /* My Comment 1<br /> My Comment 2<br /> My Comment 3 */</p>
<h3>Outputting Text</h3>
<p>Output text with PHP is easy.  There are also several ways to output text. The simplest way to output text is to use the echo function.</p>
<p>For example:<br /> echo &amp;ldquo;Example of echo function&amp;rdquo;;</p>
<h3>Variables</h3>
<p>Defining variables in PHP is fairly simple.</p>
<p>For example, a simple variable would look like:<br /> $myvar = &amp;ldquo;My Variable&amp;rdquo;;</p>
<p>To use a variable, simple use the variable name that you defined, for example:<br /> echo $myvar;</p>
<h3>Global Variables</h3>
<p>There are pre-defined global variables, such as $_SERVER.</p>
<p>An example outputting a visitor's IP using $_SERVER:<br /> echo $_SERVER['REMOTE_ADDR']; // This outputs the visitor's IP address.</p>
<h3>Arrays</h3>
<p>Arrays are defined by using the array() function</p>
<p>For example:<br /> $myarray = array(&amp;ldquo;Array1&amp;rdquo;, &amp;ldquo;Array2&amp;rdquo;);</p>
<p>To use an array:<br /> $myarray['Array1'] = &amp;ldquo;My Array&amp;rdquo;;<br /> echo $myarray['Array1'];</p><a href="http://www.pheedo.com/click.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FPHP%2FThe-Basics-of-PHP.100598"><img src="http://www.pheedo.com/img.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FPHP%2FThe-Basics-of-PHP.100598" border="0"/></a>]]></description>
<pubDate>Fri, 28 Mar 2008 02:41:34 PST</pubDate></item>
<item>
<title>PHP: Learn by Doing, Learn Faster by Breaking</title>
<link>http://www.computersight.com/Programming/PHP/PHP-Learn-by-Doing-Learn-Faster-by-Breaking.83164</link>
<description>
<![CDATA[<p>PHP is a vast language.  There are about 10-20 different ways of
 
accomplishing the same exact thing.  A great programmer knows all of
 
these methods, but a great programmer I am not.  But my experience has
 
done me well, and I will pass on my thoughts to you.
 
For the most part, I am self taught when it comes to PHP.</p>
<p>My roots
 
start with Perl, a language that was taught to me by my friend <a href="http://www.racoonfink.com" target="_blank">Ben</a>.  I learned a lot from him, and
 
I developed a strong base for when I dove into the world of PHP.  At the
 
time, however, I had no contacts for other PHP programmers.  And such, I
 
set out about hacking my way through the language.
 
I found that it was best to set goals.  I found something that I wanted
 
to accomplish, and then I researched how I would do it.  Once complete,
 
I would then set about finding a better way to do it.  I ended up with
 
several projects that never amounted to much.  But as I grew, each goal
 
or project grew in complexity.  Eventually, I learned enough to embark
 
on a massive project.  And the <a href="http://www.sourceforge.net/projects/swing-cms" target="_blank">Swing-CMS </a>engine
 
was born.</p>
<p>Albeit, what you see here today wasn't my first attempt.  Originally, I
 
wrote a very simple CMS that I called "Pivot" for my group,
 
href="http://fulcrum.antisoc.net"&amp;gt;Fulcrum.  Being naive, I developed
 
my own template engine that would search and replace tags with PHP
 
scripts.  Ultimately, the system worked, but it was flawed.  Armed with
 
knowledge from "Pivot", I moved on to the first iteration of Swing.  It
 
was a step in the right direction, but it too was flawed and the big
 
problem was once again the template system.</p>
<p>Finally, I developed a pretty solid core for my engine.  And I got here
 
because I really broke a lot of things.  But I didn't have the benefit
 
of having someone like me offering advice.  Sure, you'll still break
 
stuff, but hopefully you won't run into the same problems that I had.
 
Here are some quick tips that I can offer to you while you're learning</p>
<h3>PHP</h3>
 
<ul>
<li>
<h4>Plan Ahead</h4>
<p>You can't anticipate every problem 
 
that may arise, but plan ahead.  Frequently used aspects of your
 
application should be stored in functions or classes so that you can
 
call them from anywhere.</p>
</li>
<li>
<h4>Format Your Code</h4>
<p>&amp;nbsp;Follow standard coding 
 
guidelines.  Take advantage of whitespace for organization, indent
 
content within loops, functions or classes and develop commenting
 
styles.</p>
</li>
<li>
<h4>Use PEAR</h4>
<p>For those of you who aren't aware, <a href="http://pear.php.net" target="_blank">PEAR</a> is a depository of high quality (and widely used) PHP extensions.  Most
 
of your common applications are here.  Want to easily connect to the
 
database and manage your queries?  Several solutions to choose from
 
(PEAR DB is the most common).  Conversions between XML and BBCode, it's
 
there.  This is a great place to start to save yourself time.)</p>
</li>
<li>
<h4>Use PhpDocumentor</h4>
<p>Especially for your larger 
 
applications, it can be hard to keep track of your functions and
 
variables.  PhpDocumentor requires you to comment in a special way, but
 
it's worth it.  From your comments, it will generate HTML documents that
 
will become a wonderful resource.  PhpDocumentor is available at the
 
PEAR website.</p>
</li>
<li>
<h4>Use Smarty</h4>
<p><a href="http://www.smarty.net" target="_blank">Smarty</a>, as I mentioned earlier, is a template system for PHP.  It is very useful in writing web applications 
 
as it helps you keep your code and your HTML templates separate.  It's
 
easy to use and there's no reason to write your own template system.</p>
<p></p>
 <a target="_blank"> </a> </li>
<li>
<h4>Never Work on Production Source</h4>
<p>Even if you don't 
 
have a production installation, it's a good idea to work on a copy of
 
your code.  You never know when something you do can royally mess up a
 
project, and it may be hard to revert back to where you were.  At the
 
very least, work off of a copy.  If at all possible, try using a CVS or
 
a Subversion repository to keep track of your code.  If you're working
 
on an Open Source project, check out <a href="http://sourceforge.net" target="_blank">SourceForge</a></p>
<a target="_blank"></a></li>
<li>
<h4>Experiment</h4>
<p>Don't be afraid to take risks.  If 
 
you're following my advice above, you're working on a copy anyhow, and
 
you can easily revert to an earlier version if you break something
 
serious.</p>
</li>
<li>
<h4>Share Your Code</h4>
<p>There is no better way to learn 
 
than to share your code with others.  Asking "How do I do this?" isn't
 
going to get you nearly as much response as if you were to post your
 
broken code and ask "Where did I mess up?"  But this advice goes beyond
 
learning - this is about respect.  Posting your code shows two things:
 
1) You want to learn a better way to do things and 2) You're willing to
 
contribute.  PHP gurus like to help those who will carry on their
 
legacy.</p>
</li>
<li>
<h4>Get Involved</h4>
<p>Sometimes, the best project is one 
 
that's run by someone else.  There are plenty of projects looking for
 
help on SourceForge (like mine).  Just be honest with the project leader
 
about your skills.  They often won't turn down help.  Even if you're
 
mostly beta testing, there's lots to learn from a large project.
 
Besides, it's a good resume builder if you're in the field.</p>
</li>
</ul><a href="http://www.pheedo.com/click.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FPHP%2FPHP-Learn-by-Doing-Learn-Faster-by-Breaking.83164"><img src="http://www.pheedo.com/img.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FPHP%2FPHP-Learn-by-Doing-Learn-Faster-by-Breaking.83164" border="0"/></a>]]></description>
<pubDate>Wed, 13 Feb 2008 04:26:46 PST</pubDate></item>
<item>
<title>Cpanel Automation</title>
<link>http://www.computersight.com/Programming/PHP/Cpanel-Automation.80002</link>
<description>
<![CDATA[																																																<p>Are you running or planning on running a community website? If so how would you like to give every user automatically an email address, a sub domain and a ftp account? You might think that you need a special server in order to do this. But you are wrong. If your Hosting Control Panel is CPanel then you can still do this easily.</p>
 
<p>Before you look at the code and start playing with it you need to remember a few things.</p>
 
<ul>
<li>Never trust the input of your users and always validate their input</li>
<li>Nothing is 100% secure</li>
<li>Always test, test, test, test before releasing new functionality to users</li>
</ul>
<p>In order to set up this automatization you need a few things.</p>
 
<ul>
<li>CPanel username</li>
<li>CPanel password</li>
<li>Your domain</li>
<li>CPanel port</li>
<li>CPanel theme</li>
</ul>
<p>You should know your username and password already. If not you need to contact your hosting company. If you log into your CPanel and look at the address bar in your browser you can easily find out the rest of the information.</p>
 
<p>Sample URL</p>
 <p>http://www.yourdomain.com:2082/frontend/x/index.html www.yourdomain.com = Your domain2082 = CPanel portx = CPanel theme</p> 
<p>With this information you can now use the php class below. It is very easy. It has the following features</p>
 Features
 
 
<p><strong>Emails: </strong></p>
 
<ul>
<li>Create Email addresses </li>
<li>Delete Email addresses</li>
<li>Change Email address Password</li>
<li>Change Quota of Email address in box</li>
</ul>
<p><strong>FTP:</strong></p>
 
<ul>
<li>Create FTP account</li>
<li>Delete FTP account</li>
<li>Change FTP account Quota </li>
<li>Change FTP account Password</li>
</ul>
<p><strong>Subdomain:</strong></p>
 
<ul>
<li>Create Subdomain</li>
<li>Delete Subdomain </li>
<li>Create Redirection for a subdomain</li>
<li>Delete Redirection of a subdomain</li>
</ul>
<h3>PHP Class</h3>
 
<p>Simply copy the code below into a file and call it anything you want ie cpanel.php</p>
 
<p> </p>
 
<p></p>
<pre>class cpanel {
 
 	var $cpanel_username = "user";
 	var $cpanel_password = "pass";
 	var $your_domain = "www.domain.com";
 	var $port = "2082";
 	var $cpanel_theme ='x';
 	var $url = '';
 
 	function cpanel () {
 	 $this->url = "http://".$this->cpanel_username.':'.$this->cpanel_password. '@'.$this->your_domain.':'.$this->port.'/frontend/'.$this-> cpanel_theme;	
 	}
 
 	// email
 	function CreateEmail($user,$domain,$password,$quota) {
         @file($this->url.'/mail/doaddpop.html?email='.$user.'&amp;domain='. $domain.'&amp;password='.$password.'&amp;quota='.$quota);
     }
 
     function DeleteEmail($user,$domain) {
         @file($this->url.'/mail/realdelpop.html?email='.$user.' &amp;domain=' .$domain);
     } 
 
     function UpdateEmailQuota($user,$domain,$quota) {
         @file($this->url.'/mail/doeditquota.html?email='.$user.' &amp;domain= '.$domain.'&amp;quota='.$quota);
     } 
 
     function UpdateEmailPassword($user,$domain,$password) {
 	 @file($this->url.'/mail/dopasswdpop.html?email='.$user.' &amp;domain= '.$domain.'&amp;password='.$password);
 	}
 
 	// ftp
 	function CreateFTP($login,$password,$homedir,$quota) {
         @file($this->url.'/ftp/doaddftp.html?login='.$login.'&amp;password=' .$password.'&amp;homedir='.$homedir.'&amp;quota='.$quota);
     }
 
     function DeleteFTP($login) {
         @file($this->url.'/ftp/realdodelftp.html?login='.$login);
     }
 
     function UpdateFTPQuota($login,$quota) {
 	 @file($this->url.'/ftp/doeditquota.html?acct='.$login.'&amp;quota='. $quota);
 	}
 
     function UpdateFTPPassword($login,$password) {
 	 @file($this->url.'/ftp/dopasswdftp.html?acct='.$login.'&amp;password ='.$password);
 	}
 
 	// subdomains
 	function CreateSubDomain ($domain,$root) {
 	 @file($this->url.'/subdomain/doadddomain.html?domain='.$domain. '&amp;rootdomain='.$root);
 	}
 
 	function DeleteSubDomain ($domain,$root) {
 	 @file($this->url.'/subdomain/dodeldomain.html?domain='.$domain. '_'.$root);
 	}
 
 	function CreateRedirect ($domain,$root,$url) {
 	 @file($this->url.'/subdomain/saveredirect.html?domain='.$domain. '_'.$root.'&amp;url='.urlencode($url));	
 	}
 
 	function DeleteRedirect ($domain,$root) {
 	 @file($this->url.'/subdomain/donoredirect.html?domain='.$domain. '_'.$root);	
 	}
 }
 
 
 ?></pre>
 
<h3>How to use the class</h3>
 
<p>First you must include the class</p>
<p>include('cpanel.php');
 
 Then you must create a new object
 
 $cpanel = new cpanel();</p>
 
<p>Lets go quickly through the different functions</p>
<p>CreateEmail($user,$domain,$password,$quota)
 $user: The username before the @
 $domain: After the @ (without the www.)
 $password: Password for the email account
 $quota: How much space you give the email account (0=unlimited)</p>
 
<p>Example:</p>
<p>$cpanel->CreateEmail('Mark','mydomain.com','password','10');
 
 DeleteEmail($user,$domain)
 $user: The username before the @
 $domain: After the @ (without the www.)</p>
 
<p>Example:</p>
<p>$cpanel->DeleteEmail('Mark','mydomain.com');
 
 UpdateEmailQuota($user,$domain,$quota)
 $user: The username before the @
 $domain: After the @ (without the www.)
 $quota: How much space you give the email account (0=unlimited)</p>
 
<p>Example:</p>
<p>$cpanel->UpdateEmailQuota('Mark','mydomain.com','0');
 
 UpdateEmailPassword($user,$domain,$password)
 $user: The username before the @
 $domain: After the @ (without the www.)
 $password: Password for the email account</p>
 
<p>Example:</p>
<p>$cpanel->UpdateEmailPassword('Mark','mydomain.com','newpassword');
 
 CreateFTP($login,$password,$homedir,$quota)
 $login: This will be the username. Usually it will get the domain name added ie @yourdomain.com
 $password: Password for the email account (always from your rot directory)
 $homedir: Which directory he can access. (!!carefull don't give them access to your root directory.)
 $quota: How much space you give the ftp account (0=unlimited)</p>
 
<p>Example:</p>
<p>$cpanel->CreateFTP('Mark','password','/Mark','100');
 
 DeleteFTP($login)
 $login: This will be the username without the @yourdomain.com</p>
 
<p>Example:</p>
<p>$cpanel->DeleteFTP('Mark');
 
 UpdateFTPQuota($login,$quota)
 $login: This will be the username without the @yourdomain.com
 $quota: How much space you give the ftp account (0=unlimited)</p>
 
<p>Example:</p>
<p>$cpanel->UpdateFTPQuota('Mark','200');
 
 UpdateFTPPassword($login,$password)
 $login: This will be the username without the @yourdomain.com
 $quota: How much space you give the ftp account (0=unlimited)</p>
 
<p>Example:</p>
<p>$cpanel->UpdateFTPPassword('Mark','newpassword');
 
 CreateSubDomain ($domain,$root)
 $domain: the subdomain name i.e. Mark
 $root: the domain i.e. yourdomain.com</p>
 
<p>Example:</p>
<p>$cpanel->CreateSubDomain('Mark','mydomain.com',);
 
 DeleteSubDomain ($domain,$root)
 $domain: the subdomain name i.e. Mark
 $root: the domain i.e. yourdomain.com</p>
 
<p>Example:</p>
<p>$cpanel->DeleteSubDomain('Mark','mydomain.com');
 
 CreateRedirect ($domain,$root,$url)
 $domain: the subdomain name i.e. Mark
 $root: the domain i.e. yourdomain.com
 $url: where you which to redirect the user to i.e. http://www.yournewdomain.com</p>
 
<p>Example:</p>
<p>$cpanel->CreateRedirect('Mark','mydomain.com',
'http://www.mynewdomain.com');
 
 DeleteRedirect ($domain,$root)
 $domain: the subdomain name i.e. Mark
 $root: the domain i.e. yourdomain.com</p>
 
<p>Example:</p>
<p>$cpanel->DeleteRedirect('Mark','mydomain.com');</p>
 
<p>So I hope this will help you and please remember that you need to test loads before you can release this functionality to your users. You need to make sure that it is safe which I can guarantee. Just imagine if something goes wrong and you give one of your users access to your root directory.</p>
 
<p>Enjoy</p>																																										<a href="http://www.pheedo.com/click.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FPHP%2FCpanel-Automation.80002"><img src="http://www.pheedo.com/img.phdo?x=&u=http%3A%2F%2Fwww.computersight.com%2FProgramming%2FPHP%2FCpanel-Automation.80002" border="0"/></a>]]></description>
<pubDate>Mon, 04 Feb 2008 11:03:43 PST</pubDate></item>
</channel>
</rss>
