My Forums

I absolutely hate advertisement bots, and i wish that their inventors would be blessed with a flesh eating virus. I have been fighting a losing battle over the last two years to regain control over my forums, claiming it back from the shitty bots, and i think i have finally figured things out.

Below is the beginnings of a script that you can run on a semi regular basis and keep your PHPBB3 Databases cleaned of ridiculous bullshit landing on your forum. Just remember to log in from time to time to resynchronize your statistics.

Continue reading “My Forums”

Optimize your Tables!

One thing that seems to always irritate me when im trying to organize my backups together is how the file sizes bloat over time. You can, and probably should look into optimizing your tables but for those of you who dont have the time or the will power to care to do it in any other method if you place this function at the top of your automated backup script and simply call it appropriately you will be able to automate the process of optimizing all tables that dont meet your threshold and or maximum free space requirements.

You can just set up a cron job to call your PHP scripts and it should take care of things from there.

$_CONFIG['threshold'] = 0.01;
$_CONFIG['maxfreedata'] = 102400;

function optimizeDatabase($host, $user, $pass, $dbase)
	global $_CONFIG;

	$mysqli = new mysqli($host, $user, $pass, $dbase);

	if (mysqli_connect_errno())
		printf("Connect failed: %sn", mysqli_connect_error());

	if ($result = $mysqli->query('SHOW TABLE STATUS WHERE '.
		'(Data_free / Data_length) > ' . $_CONFIG['threshold'] .
		' AND Data_free > ' . $_CONFIG['maxfreedata']))
		print 'Optimizing Database: ' . $dbase . "n";
		while ($row = $result->fetch_object())
			printf("%-25s %8d %8dn", $row->Name,
				$row->Data_free, $row->Data_length);
			$mysqli->query('OPTIMIZE TABLE ' . $row->Name);


optimizeDatabase('localhost', 'User', 'Password', 'Database');

Atheist Nation Chat System

Its actually an ingenious design that leverages AJAX/Javascript along side PHP. It is literally as complex as what used to be called a shout box, although the shoutboxes of my time were nearly always static and didn’t require you to even touch databases if you so chose. Strictly speaking, my previous post was covering some of the more apparent and obvious issues with the design of the chat system that AN was using; this will be an overview of the design and some direction that we are intending to proceed with the project. I will be including some of the code here for references, but rest assured the table, field and even the queries will be altered in order to protect the integrity of the system.

Continue reading “Atheist Nation Chat System”

Chronicles of Swallowbush – My MySQL

Moving from static to dynamic pages in web applications has two routes: Flat files and databases. Being that I had a C background I was unimpressed by databases, but I was intrigued by them at the same time because I didn’t understand their purpose in applications. I had very little experience with databases and would have to learn them on my own, since it was midterm at school and no one I trusted knew was able to handle PHP well enough to teach me how to make PHP handle databases. I found my way, but did a lot of stupid shit along the road.

Continue reading “Chronicles of Swallowbush – My MySQL”