Show PHP Settings with phpinfo and Example PHP $_SERVER Display Page

View PHP Environment Configuration Settings and Superglobals on a Page

PHP is a great computer and web site scripting language and extremely popular. It is used primarily for developing interactive web sites and many use it for day-to-day programming tasks. There are several versions in general use and sometimes the configuration of PHP between servers and machines needs to be compared. The phpinfo() function is a one line solution to show the current live PHP set up. To show PHP settings simply create a one line PHP web file on the server containing <?php phpinfo(); ?> and point the browser at it. HTML tags are NOT required because the phpinfo() function pumps them out.

PHP LogoNote: phpinfo() outputs a lot of useful information, information that hackers find interesting so use it with care. Ideally do not have the phpinfo() page on a public facing web site. On the occasions you do take precautions to reduce information leakage. Put the page in a password protected directory, do not call it phpinfo.php as this is obvious to hackers (use something more obscure and a reminder to delete it when finished, e.g. quick-config-check.php), finally don’t forget to delete it when the PHP settings have been checked.

A PHP script will need access to other settings that PHP provides, often via system wide globals known as the superglobals. The $_SERVER array provides access to the _SERVER superglobal and is shown by phpinfo() in a table. Occasionally it can be worthwhile viewing such values from another PHP file. This can be done in a few lines of code. The following provides some details on showing PHP settings and global values in web pages.

Continue reading

Encrypt Decrypt of a String in C# .NET

C# Encryption and Decryption of a String With a Simple Function Call

Cryptography is a big subject area and extremely important for modern software and programs. If you are writing any type of software you need an understanding of software security and methods to keep data, code and users secure. Encrypting data keeps it secure because it hides its meaning, converting the plaintext (or cleartext) to ciphertext. To see the data again you need to decrypt the ciphertext back to plaintext. A simple example is the encryption of passwords to protect them from use by others.

Encryption and decryption of a password or other strings containing data can be done in many ways. There are many character substitution or transposition methods that pre-date the computing era and can be traced back to classical times. Modern computer based methods use symmetric key and asymmetric key mathematical algorithms. There are lots of well established algorithms from which to choose. However not everyone wants to take a course in cryptography just to be able to encrypt a string to hide some data and decrypt it back again. That’s where this example C# encryption and decryption code comes in handy. This code was tested in Visual Studio 2013.

This C# code has been boiled down to an encryption function that takes a plaintext string and passphrase and returns an encrypted string. There is the reverse function that takes the ciphertext and the passphrase and returns the plaintext. This is a quick and easy method of adding some encryption to a C# project, or any .NET project. The encrypt decrypt C# string functions are in a simple class. An example project shows how simple it is to use them. Continue reading

WebMatrix Rename Site and Changing Virtual Folder Name

Renaming Websites and Folders in WebMatrix

Using a free package it is possible to develop a website on Windows using Microsoft WebMatrix. This program allows you to run a website on your local Windows computer. When a website is created in WebMatrix it will usually have the name EmptySiteX where X is a number. The name is the same as the folder in which the website files are stored. Where does WebMatrix create this folder? This folder is normally in My Web Sites in the logged on user’s Documents folder:

C:\Users\John Doe\Documents\My Web Sites\EmptySite1

(Tip: Using the WebMatrix settings this default location can be changed.)

Changing a website name in WebMatrix is easy. Open the website in WebMatrix with the Home tab selected. Ensure site folder is visible (select Files or the files icon on the left hand panel to see everything that makes up the site). Bring up the context menu (usually right-click) on the top level folder. Select Rename and enter the new name:

WebMatrix Rename Site

A brief status message is displayed at the bottom of WebMatrix. Then to completed the WebMatrix rename site an edit of the IIS Express applicationhost.config file is required. Continue reading

No DB CMS to Improve Web Server Performance

A Simple Flat File CMS Without a Database to Reduce Server Load

This article discusses reducing server load when running a Content Management System (CMS) to drive a website. The most popular CMSs, such as WordPress, Drupal, Joomla and DNN use a database (DB) to hold website content. One way of improving web server performance is to remove the database element. Why a flat file CMS vs database? Using a no DB CMS can reduce the memory footprint and code execution times for a page request. This can improve the performance of a web server under heavy load. A no DB CMS, also known as a flat file CMS, is particularly useful for limited resource web servers such as shared hosting plans or Virtual Private Servers (VPS). Continue reading

PHP on Windows Using WebMatrix Single Click Install

Running PHP to Test Websites on Windows PCs

PHP is a programming language that is popular for for adding powerful features to websites. What does PHP mean? PHP originally stood for Personal Home Page (after its inventor, Rasmus Lerdorf, wanted more features for his personal website), but now it stands for PHP Hypertext Preprocessor (creating a recursive acronym, which programmers like). PHP is easy to set-up and run on a Windows PC using the free Microsoft WebMatrix, an Integrated Development Environment (IDE) for building websites.

With the free WebMatrix package PHP on Windows is a single click install and allows website testing using IIS Express (the version of Microsoft Internet Information Server for Windows clients). This tutorial assumes that WebMatrix is installed and running on your Windows 7 or higher PC. If not see our article Develop a Website on Windows Using Microsoft WebMatrix to set it up and get a basic website going. Continue reading

UK School Level Computer Science Qualifications

GCSE, O-Level and A-Level Computing Subjects

Listed here are Computing and Computer Science school level qualifications available in the UK.  The GCSE and O-Level exams are commonly taken at the end of Year 11 (pupils reach the age of sixteen during that year). The A-Level is commonly taken at the end of Year 13 ( pupils reach the age of eighteen during that year). Some colleges offer these qualifications to mature students. Some schools allow pupils to take examinations earlier.

This list deals with computer science qualifications, learning how computers work from the inside and how to program them. The list does not cover ICT, learning how to use computers as a tool in everyday life and the workplace.





What is .NET?

Windows Developers Usually Use Microsoft .NET When Writing Programs

If you are new to writing software for Windows personal computers (PCs) it is not long before you come across Microsoft .NET (pronounced “dot net”). What is .NET? The simplest answer is to say that .NET is used to build and run programs on a computer. (For the complete beginner who knows nothing about computer programs read our article What is Computer Programming?) In this post we attempt to provide a brief explanation to .NET in they way of an introduction. Microsoft .NET is an important Windows technology to ease the development of computer programs.

.NET Provides a Framework to Help Write Complex Programs

Steel Building FrameworkWhenever you see a building, such as an office block or skyscraper, being constructed you will notice that a steel frame is used to provide the basic structure. On to this frame is fixed walls, windows, floors, ceilings and everything else that makes up a building. The framework is made of steel beams, rivets and welds. Everything that is attached to it is made from common building materials and components. It is the architects and builders that determine the final look of the building using standard components.

A similar thing occurs when computer programs are written, the software developer (a.k.a. computer programmer) decides the final functionality and look of a program but will use an existing set of components to help achieve the end requirement.

Microsoft .NET Libraries and Runtime Engine

Microsoft .NET is a computer framework that contains hundreds of useful components. The components are gathered together into libraries to organize them into categories. Libraries that contain components to draw on the screen, read input, talk to the Internet, etc. This allows the programmer to concentrate on producing the functionality of the software and not have to work on the code that controls the hardware. Modern software programs are written with a tool called an Integrated Development Environment (IDE). An IDE allows the programmer to write the code in an editor, run the code to test it and use a debugger to fix any errors found during testing. Many IDEs come with a set of common existing components to use, such as text boxes, buttons and image containers.

Visual Studio IDE

An Intergrated Development Environment

With the .NET framework and an IDE it only takes a few lines of code to get a simple program working. The speed of software development using .NET makes it a very useful framework for developers writing Windows programs. Continue reading

Free Resources, Copyright and Licenses

Grabbing Internet Resources is Easy, But Should They Be Used?

Tools Hammer and SpannerAt Eye we produce documentation and software. In doing so we often use tools and materials that have been developed by others. Some of those tools and materials are free. Free stuff is great, it reduces your costs and the altruistic people who give it away do not want to be encumbered with chasing payments, they enjoy the creative process itself and want to share and show off their output. Their reward is the goodness that flows from people using and appreciating their creations, and maybe some publicity. Sharing is also infectious, we give back by publishing articles and resources on this website (and OK maybe get a little publicity).

Man carrying a bag of money There is so much available on the Internet and it is so easy to move digital resources around that a culture has emerged that assumes everything on the Internet is free, or should be free. Now that would be wonderful if true. However people and companies still need to pay their bills and thus some need rewarding for the time an effort they put into their creations, be it products, services, music, art, writings, film or software. They have the right to sell their work and not give it away. Everyone should respect those rights, it is fundamental to the way economies work, without payment for creations there would be no flow of money which would result in stagnant markets and poverty for many more than at the moment.

Copyright Allows Those Who Create to Earn Make a Living

Public Domain Copyright SymbolIt is easy enough to grab digital creations from the Internet, even creations that should be purchased are readily available for no payment if you know where to look. However, just because if can be done it does not mean it should be. If you walked into a book store and picked up a book, and walked out without paying you would be committing a crime. If you download an e-book that should be paid for without paying you are doing the same type of crime. This applies to many types of digital creations not just books, as soon as something original is created it becomes protected by law, the law of copyright, and applies to many types of media: books, music, films, television shows, videos, pictures, cartoons, audio recordings, software and writings (such as blogs) in general. Continue reading

Back to the Future for Computers

The return of the “bicycle for our minds”.

Sinclair Research ZX Spectrum 48K

Sinclair Research ZX Spectrum

What happened to the computer? If you are old enough to remember the 1980’s you may recall the explosion of home computers that occured, some of the most popular being:

  • Sinclair Research’s ZX80, ZX81 and Spectrum.
  • Commodore Business Machines VIC-20, Commodore 64 and Amiga.
  • Atari’s 400, 800 and ST.
  • Acorn Computers BBC Micro, Electron and Archimedes
  • Apple IIe
A Simple Basic Program on an Atari Screen

A Simple Basic Program

Unlike the video games consoles (such as the Atari 2600) not only could these systems be used to play games they could also be programmed, usually in Beginner’s All-purpose Symbolic Instruction Code (BASIC). These easy to use computers provided many with the education needed to forge successful careers and build successful businesses in the new Information Technology industry that emerged in the 1990’s as the Internet sprang into life. What was great about these computers was the immediacy, intimacy, responsiveness and quick boot time. It was only seconds from turning the power on to starting to type a computer program. A computer program that could easily access the raw hardware of the computer. Unlike the typical computers purchased on the high street today, which are over engineered, power hungry, bloated and slow booting devices. So despite a quarter of a century of technological advances how did we end up with expensive devices that kids cannot easily program. Continue reading