Skip to main content

Posts

Showing posts from January, 2016

A Simple Login Class Using PHP and MySQL

Login System is always required for any web application that is dynamic. So, this is what actually happened to me. Every website I created, require some form of login system. So, I usually integrate a login system. The problem is that when I update some security features, I've to re-code for all those website. This unique problem, leads me to the creation of this tutorial inspired by the Hashing Security blog.
The idea here is to separate the login system from the rest of the application. The best way to implement this is to use a Login Class and simply integrate the class to any application you design. In this tutorial, I would like to make the login system as secure as possible, hence I would like to ensure a strong encryption of passwords. Now instead of designing my own encryption technique, I'll use a strong and reliable technique described by Crack Station - a Hashing Security blog. Hence before you start download this PasswordHash.php file from GitHub.

This Tutorial …

CSS - Styling your Website

CSS – Cascading Style Sheets is a style sheet language used for describing the look and formatting of a document written in a markup language. A CSS is a flexible way to style your pages. In this way you can concentrate on styling and forget about the contents. While someone in you team will take care in generating the contents. Again here, there are some requirement to learn CSS. They are not that different from those of HTML. Basic knowledge of using a personal computer (like creating folders and files, copy, cut, paste, edit). A basic text editor. All personal computers comes with a text editor (like Notepad for Windows, TextEdit in Mac, gedit in Linux with GNOME etc). You can also use other more advanced text editor if you have like Adobe Dream Weaver, or if you prefer the free ones just search online. But a very basic one will do. A browser – All modern PC will come with a browser in build (internet explorer for Windows, Safari for Mac). You can also download a third party brow…

A Simple Website Counter Script using PHP

Just the other day, I was asked about how to create a website counter script. Mostly the question is for PHP, so, here, instead of directing you to sophisticated scripts - especially for beginners - we'll show you how to do that in a simple and effective way starting from scratch. To solve this problem, you'll need a place to store your data - visitors no - in some place. Then when someone visit your website, just read the value form the old data and increase by 1 then display the value and replace the value in your storage place. First of all, create a file called count.dat. Open your favorite text editor and create a new PHP class for this purpose and a method to handle the data lets call this file counter.php.
class hitCounter { //Set a File Name public $fileName = "count.dat"; public function getHitCount(){ //Read the previous value of counter from file $counter = intval( trim(file_get_contents($this->fileName)) ); $counter++; //Store the ne…

PHP & MySQL

PHP and MySQL are the core of building dynamic websites. Many always says why learn PHP when you could just use content management system like Drupal, Joomla or a platform like WordPress? But the advantage of learning PHP and MySQL is when you need to do more than just use a framework. You can twist, make changes and create themes - that requires PHP and MySQL skills. So the obvious question is what do you need to learn PHP and MySQL. Well the list is not so big - here it is: Basic knowledge of HTML and CSS. JavaScript knowledge too is another advantage. If you didn't know these, do not worry just browse to our HTML & CSS section to learn.A simple text editor (Notepad in Windows, text editor in Mac etc).A web-server with PHP and MySQL integrated. If you plan to host your pages online consider testing first in your local computer. I'd recommend using XAMPP which is a full package of Web-server, PHP and MySQL and it is easy to install and use. Just download it from Apache …

Begining a Java Script

JavaScript can be used in two different ways - (1) In the same HTML document, or (2) as a separate JavaScript file which can be linked by many HTML document. You'll use the first way if your script is specific only for one HTML document. But if your same script is used in many HTML documents then the second way of use is best.

JavaScript are included in a <script> tag. The beginning and end of a <script> tag can be written as follows:
<script language="JavaScript" type="text/javascript"> . . . </script>All your JavaScript then goes inside the above element. Let's start with this basic example.
now = new Date(); localtime = now.toString(); utctime = now.toGMTString(); document.write("<b>Local time:</b> " + localtime + "<BR>"); document.write("<b>UTC time:</b> " + utctime);The first line of the script creates a new variable now and create a new Date object. Note that every line…

Java Script

JavaScript, also known as ECMAScript (the untrademarked name used for the standard), is a dynamic programming language. It is most commonly used as part of web browsers, whose implementations allow client-side scripts to interact with the user, control the browser, communicate asynchronously, and alter the document content that is displayed. So, what do you need to learn JavaScript, the answer is simple: Basic knowledge of using a personal computer (like creating folders and files, copy, cut, paste, edit).A basic text editor. All personal computers comes with a text editor (like Notepad for Windows, TextEdit in Mac, gedit in Linux with GNOME etc). You can also use other more advanced text editor if you have like Adobe Dream Weaver, or if you prefer the free ones just search online. But a very basic one will do.A browser – All modern PC will come with a browser in build (internet explorer for Windows, Safari for Mac). You can also download a third party browser like Google Chrome or …

The First HTML Document

The First HTML DocumentHTML - short for Hyper Text Markup Language - is a markup language. A markup language uses a set of markup tags. In HTML they are markup using HTML tags. So, basically there is a start tag and an end tag. Each tag will have a structure like this:
<starttag>Your contents goes here</starttag>Your contents will go in between the tags. HTML tags always comes in pairs with few exceptions. Lets take a look at this example and then we'll explain all about the tags.
<!DOCTYPE html> <html> <head> <title>Your Title</title> </head> <body> <h1>Heading 1</h1> <p>This is a paragraph. It can be in <strong>Bold</strong> or <em>emphasis</em>. HTML is cool</p> </body> </html>
Enter the above code in your text editor and save as - say first.html file. Try to identify the tags in the above html document and note them down. Open this file in your browser an…

Learn HTML

HTML - HyperText Markup Language a language of the world wide web. Every information on the world wide web is in HTML. It is a simple markup language that anyone can learn. So, what do you need to learn HTML? The answer is quite simple.
Basic knowledge of using a personal computer (like creating folders and files, copy, cut, paste, edit).A basic text editor. All personal computers comes with a text editor (like Notepad for Windows, TextEdit in Mac, gedit in Linux with GNOME etc). You can also use other more advanced text editor if you have like Adobe Dream Weaver, or if you prefer the free ones just search online. But a very basic one will do.A browser - All modern PC will come with a browser in build (internet explorer for Windows, Safari for Mac). You can also download a third party browser like Google Chrome or Mozilla Firefox. The browser is like a channel to browse the net, or to see your HTML pages comes to life.So, the above three are the only requirement to kick-start you to …