New Website

I've made a new website, as lynx.io is dead. You can find it here: http://macr.ae/—it's similar in format to lynx.io, but has better articles, and they're all written by me.

Loading

lynx.io is loading, it shouldn't take long. If JavaScript is disabled, please enable it - the site will work better with it enabled.

 

No articles

:-(

Colors in CSS

Colors are a vital part of CSS, allowing the user to change the color of text and borders, and the background colors of elements such as text and divs - a fairly major part of design. In this article, I will explain the different syntaxes available - the obvious two are string colours (such as "red" and "black"), and Hex colours (such as #ef0000), and I will also cover RGB and HSL colours, both of which are possible in CSS. Read more

PHP AJAX Best Practices

As the use of AJAX becomes more and more popular, it becomes increasingly important that when responding to AJAX requests in PHP, there are some best practices that you should stick to in order to make dealing with the response at the other end a lot easier. In this article, I will cover the more important best practices, and explain how they are relevant and how you can do them. Read more

Array Looping in JavaScript

In JavaScript 1.6, two new array methods were introduced for looping through arrays. They are the `.map` and `.forEach` functions, and this article will explain what they do and how they work. As they were only added fairly recently, certain browsers - such as Internet Explorer 8 and earlier - don't support this feature. For this reason, I'll also be discussing how you can add the function or work around them. Read more

CSS Preprocessors

CSS preprocessors such as LESS and Sass extend CSS, adding additional features such as variables, nesting and mixings to the language, making it a lot easier to write and maintain. In this articl, I will be exploring the advantages and disadvantages of using a preprocessor and some features that the meain two preprocessors offer. Read more

Using Socket.io with NodeJS

Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Socket.IO aims to make realtime apps possible in every browser and mobile device, blurring the differences between the different transport mechanisms. It's care-free realtime 100% in JavaScript. In this tutorial, I will show you how to use them together to make real-time web applications. Read more

Photoshop Guide (Part One)

This is the first in a series of articles that will be covering the various concepts you need to understand in order to use Photoshop, the tools that you have at your disposal and how to use them. To understand this post, you are expected to know or have previously read about image types: raster and vector. Read more

Currying in JavaScript

Currying is a technique for transforming a function which accepts multiple parameters into multiple functions that accept a lower number of arguments. In this article, I will explain how you can curry functions in JavaScript, and I will also explain how to curry by length and uncurry functions. Read more

lynx.io opened

I'm happy to announce that after a few weeks of work, lynx.io is finally open. It has a better design, is on a different server, and is far faster than the old site. It also features a lot more client-side logic, as opposed to the old website where everything was server-side. Read more

Security: SQL Injections

SQL injection is a common, although becoming less so, type of vulnerability that is occasionally found in websites that use SQL (Server Query Language) to access data at the server-side. If the code used to query the database doesn't correctly escape the data passed to it, it may be vulnerable. This article will explain the vulnerability, and then explain how to secure your code against it. Read more

Security: Cross-Site Scripting (XSS)

Cross-site scripting is a type of vulnerability that affects a surprisingly large number of websites, allowing an attacker to inject HTML into the website. Usually, this would be an iframe or a script, both of which can be dangerous. This article will explore the vulnerability and how you can secure your site against it. Read more

Rumour Debunked: Single quotes vs double quotes in PHP

There is a popular rumour that while writing PHP, you should use double quotes wherever possible. This used to be true - before PHP 5.1 was released, there was a significant difference in speed between double and single quotes, and it was definitely a good idea to use single quotes wherever possible. PHP 5.1 included some optimisations to the opcode parser which improved the double quotes parsing time, and since then, using double quotes hasn't been an issue. Read more

IO: Accepting command line input in PHP

While writing an application, you may sometimes feel the need to create a script that can communicate with the user through the command line – perhaps you don't feel the need to write an entire web GUI for your install script, or you just want to experiment. Read more

How version control can benefit you and your project

You may have heard of version control (sometimes called revision control or source control), or you may have even used it briefly before, but never actually used it as part of a project. Some examples of version control systems are Git (my personal favourite), SVN and Mercurial. In this article I will explain how the use of one of these version control systems can benefit your project. Read more

Utilising the MVC architecture

The Model-View-Controller (MVC) architecture is an architecture most commonly used to separate what is known as "domain logic" - the code that powers the backend - from the user interface - what the user sees. This makes your code clearer, easier to work with, and has the advantage that you can very easily had multiple people working on the same project without conflicts, and without the need for a version control software such as Git or SVN. Read more

Integrating phpBB sessions into your site

Instead of having two logins to your site, it would be far easier and more efficient to use phpBB's sessions systems. It would also be easier for your users and more secure. You will also be able to use stuff like the permissions system and the templates system if you wish. In this article, I will explain how you can integrate the phpBB session into your website. Read more

Why I use IE6

I've taken some time out from coding to write about one of my favourite pieces of software: Internet Explorer 6! This ancient piece of software is still going strong; over the years, it has repeatedly proven itself to be the best browser available. I mean, it's been around since 2001 - it's proven technology! Read more

An introduction to the lynx-framework

I'm currently writing a framework, called (suitably) the lynx-framework. Written in PHP, it is designed to be a framework for social networks. It will include plugins that are perfect for social networks, such as authentication, a news feed, profiles, messages, etc. Any part can be enabled or disabled, making it extremely easy to build any sort of social network. Read more

Optimising your website for mobile devices

Mobile phones are being used to access the Internet with increasing frequency, and as more people buy better phones and mobile Internet gets cheaper, we will find our websites being hit by a greater number of mobile devices. Only one problem: your huge, image heavy design on your forums or blog takes several minutes to load due to slow network speeds, and even then, it uses more resources than the phone has and goes off the screen. Solution? Get a mobile website. Read more

Updates

Two weeks ago, on the 1st of January '11 at 01:01:01, lynxphp opened. As lynxphp has been more successful than I first hoped, I've made a few changes. Read more

What software should I use for my website?

That is one question which I often hear asked more than once a day, along with "What's the best CMS" and "What's the best forum software?". The answer for all three is the same (they are, after all, basically the same question); it depends on what you need. What's good for me might not be good for you, and what's good for a professional web developer will usually not be good for a 14 year old with no development experience. Read more

Using mod_rewrite to create friendlier URLs

mod_rewrite is an Apache module used for rewriting a URL at the server level, making the URL a lot friendlier. For example, if a user goes to example.com/article/421 they will in fact be shown example.com/article.php?id=421, but they still think they're accessing /article/421. This is a different to redirect, as a redirect completely changes the page the user is on, telling them that they're on article.php, but mod_rewrite does not - this makes the URL look a lot friendlier, while not requiring millions of pages. Read more

Running PHP applications from the command line

I've always found it useful to be able to run PHP applications from the command line: not only does it allow me to quickly view the output of my code from the command line - where I do the majority of my developing - but it also allows me to make proper command line applications from within PHP. Okay, quite a lot of stuff is not possible, but it's still fun. This applies to Unix only, I believe. Read more

PHP array functions

There are a huge amount of functions to deal with arrays in PHP, but I will be going through just a few of the most useful or interesting ones. If you would like me to add a function or two to this list, just tell me and I'll do my best. Read more

Preventing and dealing with spam in phpBB

A couple days ago, the amount of spam being posted to my phpBB forum increased dramatically. I turned to the phpBB.com community forums and made my thread, and it looks like it's happening to many other people using the Q&A CAPTCHA. The Q&A CAPTCHA was added to phpBB in 3.0.6, and it allowed the board administrator to specify a question that the user had to answer on sign-up. In this article, I will explain how you can attempt to prevent them from damaging your board or hacking into your users' accounts. Read more

The five best modifications for phpBB

Modifications are a way of customising your phpBB board. They can do anything, from adding a new feature, to changing an already existing feature, to completely removing a feature! "Modifications" is often shortened to "MODs". In this article I will be explaining what I think the best modifications for phpBB are and why. Read more

The If Shortcut: The Ternary Operator

The ternary operator is a shortcut comparison operator that replaces an if-else statement in a PHP script. If you use a lot of if-else statements in your scripts, using the ternary operator can shorten your code hugely. The ternary operator is very simple to use, but it does tend to confuse new PHP programmers. Read more

What are regular expressions?

Regular expressions are a way for programs to search for a particular pattern in a string. For example, they can be used to find strings starting with "www.", or to see if some user input is a valid email. Regular expressions are incredibly useful for validating user input and also for the mod_rewrite function of the Apache server. Read more

Preventing DDoS

Following the recent (largely successful) attacks by Anonymous Operation on more than a few websites including Paypal, Mastercard and Visa, a few people asked me if they were at risk of being attacked and how they could prevent it. In this article, I will explain various ways of stopping DDoS, and whether they actually work or not. Read more

Ultimate Guide to .htaccess

The .htaccess file is a text file that contains Apache directives. Any directives you place in it will apply to the directory that contains the htaccess and also any directories below it. htaccess is extremely powerful, and has many functions. Some of the main functions include custom error pages, password protection of directories and files, rewriting of URLs, and more, and in this article I will explain how to use htaccess. Read more

Sleeping in PHP

I've seen a few people asking how they can sleep or pause their PHP script, so in this article I am going to do two things - I am going to explain how you can sleep your script in PHP, and I am also going to ask this question: Why would you want to? Read more

PHP Data Objects (PDO) - The Basics

PHP Data Objects (PDO) is an extension for PHP that provides the developer with yet another way to access databases using SQL in PHP. This is the first half of a two-part tutorial. In this part, I will explain how to connect to, select rows from, and insert data into a database; in the next part, I will cover some more advanced stuff. Read more

Hello world!

Welcome to lynxphp! I’m Callum Macrae, administrator of lynxphp and a PHP developer. I’ve been around for a while, but I’ve never actually contributed anything to the developer community, so I thought I would start this website to share my knowledge (and to help myself learn new stuff)! Read more

Markdown Cheat Sheet

# This is an <h1> tag
## This an <h2> tag
###### This is an <h6> tag

Inline markup: _this text is italic_, **this is bold**, and `code()`.

[Link text](link URL "Optional title")
[Google](http://google.com/ "Google!")

![Alt text](image URL)

![This is a fish](images/fish.jpg)

1. Ordered list item 1
2. Ordered list item 2

* Unordered list item 1
* Unordered list item 2
* Item 2a
* Item 2b

And some code:

// Code is indented by one tab
echo 'Hello world!';

Horizontal rules are done using four or more hyphens:

----

> This is a blockquote

This is an <h1> tag

This an <h2> tag

This is an <h6> tag

Inline markup: this text is italic, this is bold, and code().

Link text Google

This is a fish

  1. Ordered list item 1
  2. Ordered list item 2
  • Unordered list item 1
  • Unordered list item 2
    • Item 2a
    • Item 2b

And some code:

// Code is indented by one tab
echo 'Hello world!';

Horizontal rules are done using four or more hyphens:


This is a blockquote

Toggle MarkDown / HTML (t), full reference or close this