Skip to content

Instantly share code, notes, and snippets.

@remysucre
remysucre / guestbook.cgi
Created January 18, 2024 23:55
Simple CGI script for a guestbook
#!/bin/ksh
# Function to create the SQLite database and table if they don't exist
create_database() {
if [ ! -f guestbook.db ]; then
sqlite3 guestbook.db 'CREATE TABLE entries (id INTEGER PRIMARY KEY AUTOINCREMENT, message TEXT)'
fi
}
# Function to fetch and display guestbook entries
@remysucre
remysucre / gb.cgi
Created January 19, 2024 00:17
CGI script in Python for a guestbook
#!/usr/bin/env python
import cgi
import sqlite3
# Create or connect to the SQLite database
conn = sqlite3.connect('gb.db')
cursor = conn.cursor()
# Create a table to store guestbook entries if it doesn't exist