Skip to content

Instantly share code, notes, and snippets.

View walesmd's full-sized avatar

Michael Wales walesmd

View GitHub Profile
application: getting-started
version: 1
runtime: python
api_version: 1
handlers:
- url: /.*
script: main.py
print 'Hello, World!'
<html>
<head>
<title>Search</title>
</head>
<body>
<form method="get" action=".">
<p><input type="text" name="q" />
<input type="submit" value="Search" /></p>
</form>
<html>
<head>
<title>Search</title>
</head>
<body>
{% if errors %}
<ul>
{% for error in errors %}
<li>{{ error }}</li>
{% endfor %}
<?php if (!defined('BASEPATH')) exit('No direct script access allowed.');
class Articles extends Controller {
function Articles() {
parent::Controller();
}
function edit($id = NULL) {
CREATE TABLE IF NOT EXISTS `accounts` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`email` varchar(120) NOT NULL,
`password_hash` varchar(40) NOT NULL,
`salt` varchar(7) NOT NULL,
`last_login` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `accounts` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(20) NOT NULL,
`password_hash` varchar(40) NOT NULL,
`salt` varchar(7) NOT NULL,
`last_login` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
<?php
// create()
// Creates a user
function create() {
if ($this->erkana_auth->create_account('email')) {
redirect('accounts');
}
$this->load->view('accounts/create');
<?php
// index()
// Displays the login screen
function index() {
if ($this->erkana_auth->validate_login('email')) {
redirect('announcements');
}
$this->load->view('accounts/index');
<?php if (!defined('BASEPATH')) exit('No direct script access allowed.');
class Announcements extends Controller {
function Announcements() {
parent::Controller();
}
// index()