Matt Zanchelli

February 8 2012

Syntax Highlighting

I've been working on getting some nice syntax highlighting with custom a custom colour scheme, as I will probably need this in this type of blog. Below, I've made use of this new feature.

I encountered a problem today in PHP while coding my ClouDB project. I made a config.php file containing variables important to establishing a connection to a database to store users' login information. However, I wanted to make sure that if someone were to try and view 'config.php' on the server, it would redirect them to the log in page. However, since I included 'config.php' in 'index.php', there would be an infinite redirect loop. Luckily, PHP caught on quick and stopped itself from loaded the page. So to overcome this problem, I just used a redirect in HTML in the 'config.php' file. But, even that wouldn't work, as it would actually send the user into an infinite loop of page redirects that isn't stopped by PHP. Does anyone know how I could fix this? I don't want to edit anything that would require modification of files outside of the ones I've made. I want this to be able to work on other servers easily.

File: index.php

include "config.php";

File: config.php

<?php

// Configuration options

?>

<html>

<head>

<meta http-equiv="refresh" content="0;url=index.php">

</head>

</html>