Write secured PHP

April 24th, 2015

Image Source:sitepointstatic.com

PHP programming was written to be an easy language to program. Completely opposite to being very security oriented. It was so until the 4.1 version. Undeniably, Php has grown to be popular in the short term. But it also created many, many, very badly written scripts. And it gave a very big number of programmers a mindset which is not inclined to the security aspect of programming. Maybe, the main reason behind it, is the automation of conversion by PHP of inputted data to script variables using or enabling though php.ini setting register globals. In the 4.1 version of PHP, this type of behavior was left enabled but was not recommended to be used. With PHP 4.2, this type of behaviour was disabled by default. It broke thousands and thousands of scripts worldwide. This dilemma led to forcing the coders to write more secure codes. They made scripts break. This was opposed stongly before but somehow they saw that the move was a smart one.

Using Built-in Functions

April 17th, 2015

espresso PHPYou may be excited about your growing PHP prowess, but why make life more difficult than you have to?

One of the great things about PHP, and other programming languages for that matter, is that it comes with built-in functions. While you can always hard code your way through any problem, using built-in functions will shorten your code and cut the time and effort you need to finish any project significantly. This will give you more time on your hands to engage in other productive activities like checking your FOREX investments or going on a date with your partner.

One easy example where in built-in functions will help you shorten your work is the use of array chunk functions. While you may always convert a string into an array by iterating on string characters, you don’t have to do that at all since there are PHP functions designed to specifically do that for you.

So use built-in functions if you want to be a more efficient programmer.

Photo Credit

PHP Development Tools Released

April 10th, 2015

devtoolsThe PHP community has again gotten a boost with the announcement that Eclipse is set to release their much loved PHP Development tools later this month. The developer tools included in the release is set to again make the lives of PHP developers a whole lot easier and has been since they released the last version (1.0) in 2007. The new release features a new and improved dynamic language toolkit that gives PHP more bite compared to its older counterpart. It is also designed to work with Java so any developed projects can easily be imported into the dynamic language toolkit. Better code testing tools allows faster error checking making development faster and testing is a breeze with better functionality making PHP easier to use and deploy. With this, the PHP community is set to get a boost and life would be a little bit easier in the wild that is the internet where all is supposed to work.

Downsides of Computer programming

April 3rd, 2015

Computer programming is known for its immeasurable contribution to the online community and to the world of technologies. Users are highly dependent to such programming because it caters to several usages that appear to be of great benefit. Taking all those benefits and advantages aside, it is as well important for every user to be aware of the disadvantages that go with computer programming. First downside focuses on the increasing forms of viruses. As we all know, programmers are responsible for varying websites, systems, and programs. These are all products of their effort and definitely took much time to finish but due to prevalent viruses, these works at one instant can be infected and destroyed. Another is that computer programming must always be perfect. This pertains to the need of having completely correct codes and executing the procedure perfectly. This is important because a simple mistake or one missing code can lead to system errors and even breakdown.

Cookies – not the one you dunk in milk

March 27th, 2015

If you have been browsing the web foir quite sometime, then you might have come across cookies which allows your browser to remember passwords and other information that may have anything to do with your actions on a particular website. These can be preferences that would allow the browser or webpage on the browser to determine your habits online allowing it to perform the requested operations faster and easier. A cookie is called a client-based information for it is stored on the client computer (yours when you browse the web) and is taken or stored intact along with all the information it contains for a specified amount of time or till you delete your browsing history and cookies. If you have come across tracking cookies, these are information that defines you to a particular web page which is called upon on your next visit. When creating cookies with your page, there are specific parameters (cookies by the way are created using user-made code in PHP) that must be remembered so as not to fill up the hard disks of your client computers as they visit your website page again and again. The function setcookie is used with the following syntax:

setcookie(var1, var2, time)

The var 1 stands for the name of the cookie you are creating, with the var 2 containing the value of the said cookie and the last parameter is the time which specifies the amount of time it takes for the function to kill (terminate/delete) the cookie. A more defined and elaborate explanation of the function can be found on this <a href=”http://www.php.net/manual/en/function.setcookie.php”>page</aq>.

More into the syntax of PHP

March 20th, 2015

As you might have seen, all of the PHP statement ends with �;� which would be somewhat similar to Perl. The valid HTML code that was handed back to the server was :



Who are You?

My name is MacGyver.

More in the coming posts when we dig deeper as we widen our understanding of PHP.

Testing Your PHP Code Online

March 13th, 2015

coderun run-debugYou might be wondering why anyone would want to test their PHP code online when you can very well just run it on your own computer. Well, the fact is that there are instances when you might find yourself without your trusty PC and unable to install anything on the current computer you are using due to limited administrative rights. When this happens, and you need to test a code you wrote, you have at least know that you have the choice of testing your code online.

Some recommended sites for testing PHP code online include the following:

1. writecodeonline.com
2. coderun.com
3. codepad.org
4. ideone.com
5. phpcodechecker.com

You can either type the code directly on the browser or type it in your text editor and copy paste it on any of the sites above. They are free and will check your code for common errors. Best of all, you can surf the internet during idle moments and do just about anything from posting on your Facebook account to checking you financial accounts.

Image via CodeRun

Array Combine

March 6th, 2015

This function combines two arrays where the first array is treated as the key and the second array as the contents of the said table. The syntax goes like this : array_combine(array1,array2), wherein the array1 is the table which contains the keys values, and the array2 is the contents. It should be noted that these two tables or array�s should have equal amounts of contents for it would become problematic if there was an error in the combination process. An example of the process is shown below:

$a1=array('a','b','c','d')
$a2=array2("Mouse","Rat","Rodent","Mice")
print_r(array_combine($a1,$a2))
?>

The output of which would give us a single table :

Array ( [a] => Mouse [b] => Rat [c] => Rodent [d] => Mice )

The function combined the two tables giving a single table that combines the keys and the contents. More in-depth discussion on the different array functions which in future posts would be the backbone of applications we will be building.

How to Deliver Content Fast

February 26th, 2015

It used to be the norm of having all the information collated into one single server for ease of security and maintenance. With the internet and social media’s ever increasing reach, content delivery becomes a real issue and with the advent of cloud computing, loading times is all that matters.

Geographical location plays an important factor when it comes to page load times and content delivery and dispersing your content over a wide swath of geographically strategic locations allows for fast page loads. It also prevents overloading of a single server that can choke and seize up in the event of huge demand.

More Programming Basics

February 19th, 2015

As with all programming languages PHP has different variable types such as numeric, character, string and Boolean types. Boolean variables in PHP always return either true or false, integers are whole numbers, floating points are decimal or scientifically notated and strings are a chain of characters. Sounds familiar, well they are and they are mostly standard across the various programming languages. For a more in-depth discussion on the different data types of PHP go visit the manual page.
We next discuss operators such as the assignment operator which allows you to assign values to variables allowing complex operations to be constructed into more and more functional programs.