Skip to content

Instantly share code, notes, and snippets.

<?php
// This file handles the initialization logic.
// It handles session control, connects to the database server and recreates the
// database structure if needed.
//Start a new sesssion for this user if necessary.
if(session_id()=="")
{
session_start();
<?php
//Set up the tables that we will store data in.
//If these tables already exist from a previous installation,
//they will not be changed in any way.
$unused = mysql_query('create table if not exists members (id int not null auto_increment, primary key (id), name text, passwordHash text, email text)')
or die("Unable to install the member table!");
//If the options are messed up you can uncomment the following line to restore
//everything to its default.
<?php
//Start a new sesssion for this user if necessary.
if(session_id()=="")
{
session_start();
header("Cache-control: private");
}
?>
<?php
$_SESSION['loggedIn'] = 1;
if($_SESSION['loggedIn']===1)
{
echo "Logged in!";
}
$_SESSION['loggedIn'] = 0;
<?php
include "logic/logic.initialize.php";
echo "Connected to the database correctly!";
?>
// MyTronBot.java
// Author: Nathan - http://experimentgarden.blogspot.com
import java.util.*;
import java.io.*;
class MyTronBot
{
static String lastDirection = "";
// MyTronBot.cc
// Author: Nathan - http://experimentgarden.blogspot.com
#include "Map.h"
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#define NORTH 1
<form action="index.php" method="post" enctype="application/x-www-form-urlencoded">
<h3>Register</h3>
<b>Name</b> <br />
<input type='text' name='registerUsername' />
<?php
if($name_exists)
{
echo "The name you chose is already taken.";
}
else if($name_needed)
<?php
//The purpose of this file is to check for the submission of data to the server via POST.
//If it finds a specific identifying value it will pass control to child code which will handle
//that specific submission.
//Check for registration.
if(isset($_POST['register']))
{
include "logic/logic.register.php";
}
<?php
//A script for taking the user's login details and adding their registration entry to the
//database.
//Flags for storing information about invalid form data.
$bad_email = false;
$email_exists = false;
$name_exists = false;
$name_needed = false;
$password1_needed = false;