Perşembe

Arrays by reference

I have been using lots of functions to create and check my variables and arrays lately. Along these lines, I thought I would take some time to share how the concept of "passing values by reference" works.
Basically, if you are anything like me you are always passing functions values and then having that function "return" a value. While there is nothing wrong with this approach, there is often an easier way to work with values in functions. Besides making values "global", you can also pass a function a value by reference.
Here is the standard way most people would work with a value in a function and then collect the functions return value.

MD5, hashes, passwords, salts and more

1) You need to salt your passwords.
"Assume a user's secret key is stolen and he is known to use one of 200,000 English words as his password. The system uses a 32-bit salt (like md5). Because of this salt, the attacker's pre-calculated hashes are of no value. He/she must calculate the hash of each word with each of 2^32 (4,294,967,296) possible salts appended until a match is found. The total number of possible inputs can be obtained by multiplying the number of words in the dictionary with the number of possible salts:
2^{32} \times 200 000 = 8.58993459 \times 10^{14}
To complete a brute-force attack, the attacker must now compute about 800 trillion hashes, instead of only 200,000. Even though the password itself is known to be simple, the secret salt makes breaking the password radically more difficult." - http://en.wikipedia.org/wiki/Salt_(cryptography)

PHP Video Tutorials

After several months work I am proud to announce the Code2Design video system is finally up! Featuring 25 videos on HTML, PHP, AutoCAD, and more! Each video is either 640x480 or 800x600 and is avalible to download for private viewing. (Not everyone has DSL in their home.)
The Two videos I recomend the most are PHP Security and Resizing and Sending Images For Email.
PHP security is probably the most advanced video of it's type in the world. It is about 45min long and covers basic attacks like Globals, Includes, and Super Global arrays like $_SERVER and $_GET. More advanced subjects like SQL injection, CSFR, and XSS are covered later in the video. Each attack is not only discussed - but actually shown in action so you can easily follow along.

Is this where I should start if I have never used the web?

Actually… no one in the world will EVER ask this question, because no one in the world will ever visit this page until they know something about using the Internet, lol. So *smile, relax and lets get started on this fun adventure.

But be cautious - they all have their non-monetary price!

Personally... I started out with Easyphp. It is a snap to install (it's an .exe file) and will get you running fast. It worked great while I was learning PHP and coding small scripts. Then I shopped around and after looking at many different hosting companies like "BlueHost" and "godaddy" I finally chose 1and1.com for a place on the internet to host my first site. Recently I deleted Easyphp as I needed more power for my advanced scripts and took an old computer and installed XP and WAMP on it so that I can build and test my sites on my own personal network and then upload the files to 1and1. So the choice is yours, just remember that if you install a web server, you need to SECURE it BEFORE YOU GO ONLINE! Otherwise someone might use it to gain control of your PC!

What do I need?

This is a big question and mostly depends on how skilled you are with other aspects of the computer. PHP requires the core interpreter and function libraries that you have to get from www.php.net. No, window's does NOT come ready for PHP programming. (Some Linux distributions do however.) This leaves you with four choices when it comes to setting up the PHP language so that you can start programming.
Install and compile the binary distributions for PHP and/or "Apache" web server on your machine. (Advanced) visit php.net for more information.
Install EasyPHP from EasyPHP.org. (Easy, but only features PHP 4 and has some problems with Advanced Programs/scripts.)
Install WAMP (Windows Apache MySQL PHP) or LAMP (Linux Apache MySQL PHP) on your own machine, or better yet, on some OTHER machine on YOUR network. If you are on windows you can visit wampserver.com and download the newest release. (Intermediate)
The way I Recommend: Buy some web space on a server that supports PHP and MySQL. (about $5-10 dollars a month). I highly recommend 1and1.com. They are like the "walmart" of hosting companies. (The largest in the world) they offer hosting for as low as $2.99 a month for 5 Gigabytes of space and 10 MySQL Databases!!! Don't worry they don't skimp on features ether! (Free Domain and ".htaccess" support!)
After all, if you are learning PHP you are going to be using it anyway... so you might as well buy hosting space and a domain now before the name is taken. If you already have a web site your hosting company may already have PHP install on your server. (Call/Email them to be sure.)If you don't want to pay for web space but want to put a site online I recommend that you look into some free hosting options like 100webspace.com or Dot Geek - or just choose the one that fits you from these lists: PHP Free Hosting List and PHP MySQL Free Hosting List.

Anything I should know before I start this course?

Yes - HTML. HTML (Hypertext markup Language) is the simplest formatting language on the web. While PHP, Perl, ASP, and others transfer and process information, HTML makes it look good. For example, think of Microsoft Word. What you type into Word is similar to the function that PHP serves - it supplies the data. But just typing text into MS Word doesn't look very good. That is where the formatting features of Word come in. You can change the size, color, position, and look of the text in your document with the features of MS Word. That is what HTML does.HTML makes the information that you output from PHP look good.So that is why I recommend having a basic knowledge of HTML. If you don't know it already here are some good sites to help you learn this basic language.