Website Hacks with PHP, JS, HTML, CSS

Before you get all excited, this section is NOT about breaking into other people’s computer systems, or for doing anything illegal. It’s about ‘hacking’ the code of your website for the purpose of enhanced appearance or performance.

Hacking, in this sense, refers to altering the code of your website to ‘customize’ your visitor’s experience or to help you with your online marketing efforts.

Let’s say that you have a webpage and you’d like to know the details of visitors to that page. Add some code to your webpage to create a realtime record of every visit to the page. You’ll see the IP address of each visitor, country & city, date & time. An on-going record, updated in realtime is available to you and viewable in your web browser.

Adding such functionality to a webpage is surprisingly easy, if you know how.

Web Browsers

When you visit a webpage with your web browser, the server that houses the webpage sends a bunch of code to your browser. Primarily, the code is HTML (Hyper Text Markup Language).

When it comes to web servers and web browsers, there are 4 primary areas of interest when you look at the actual code that produces a webpage.

HTLM Code – This is the code that tells your web browser what to display. There’s all sort of info here – font style, size and color, images, forms, etc.

PHP Code – PHP is a widely used scripting language that runs on a web server. The main purpose of PHP code is to allow the web server to alter the content of a specific page with certain information. PHP code is executed on the web server, prior to delivering the final PHP produced HTML code to your web browser. PHP allows for web pages to be dynamic, displaying different data to each visitor.

If you have a website based on WordPress, you’ve seen the result of PHP code. When you attempt to login to your admin panel, PHP code examines your username and password to see it they match what’s stored in the WordPress database. If they match, the PHP code sends you to the admin panel. If they don’t match, PHP shows you an error message and you are denied access.

Remember, PHP runs on a web server, not in a browser. If you want to tinker with the PHP code, you’ll need access to the web server.

JavaScript Code – JavaScript is also a scripting language, but instead of running on the web server, JavaScript runs directly in a web browser. JavaScript is embedded within the HTML code that the web browser understands.

JavaScript is good for doing on-page functions. An example is a mortgage calculator. You’ll find these on a lot of real estate websites. You enter a few pieces of information and the calculator will display your monthly payment.

CSS Code – CSS code instructs your web browser how to display certain items. For example, CSS code could direct your web browser to display text using a certain style of font, or what color to use for the background. CSS code can also change the color or size of certain page elements when your mouse hovers over them.

Just search Google and you’ll find lots of resources if you want to learn more details about HTML, PHP, JavaScript and CSS.

Take a look thru the ‘Hacks’ section – You’ll discover lots of ways to improve website performance and appearance!

explore Hacks

You May Also Like