Initial commit: Next.js rewrite of Super Bowl Squares app
Full rewrite of the legacy PHP/MySQL app using Next.js 14, PostgreSQL, Prisma, NextAuth, Tailwind CSS, and WebSocket-based live chat/grid updates. Deployed via Docker Compose with a custom Node.js server for WebSocket support. Fix chat display names by passing userId from the NextAuth session over WebSocket instead of attempting to read the HttpOnly session cookie (which is inaccessible to JavaScript). Server now looks up the user's first name from the database using the userId. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(npm install:*)",
|
||||
"Bash(npx next build:*)",
|
||||
"Bash(git init:*)",
|
||||
"Bash(git add:*)",
|
||||
"Bash(git rm:*)",
|
||||
"Bash(docker-compose up:*)",
|
||||
"Bash(docker compose:*)",
|
||||
"Bash(docker version:*)",
|
||||
"Bash(sudo apt-get update:*)",
|
||||
"Bash(chmod:*)",
|
||||
"Bash(dpkg:*)",
|
||||
"Bash(docker:*)",
|
||||
"Bash(curl:*)",
|
||||
"Bash(ss:*)",
|
||||
"Bash(echo:*)",
|
||||
"Bash(iptables:*)",
|
||||
"Bash(npx tsc:*)",
|
||||
"Bash(npx prisma generate:*)",
|
||||
"Bash(timeout 3 node:*)"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
node_modules
|
||||
.next
|
||||
.git
|
||||
legacy
|
||||
*.md
|
||||
.env
|
||||
.env.local
|
||||
@@ -0,0 +1,11 @@
|
||||
# PostgreSQL
|
||||
POSTGRES_USER=superbowl
|
||||
POSTGRES_PASSWORD=superbowl
|
||||
POSTGRES_DB=superbowl
|
||||
|
||||
# Database connection (app container talks to "db" service)
|
||||
DATABASE_URL="postgresql://superbowl:superbowl@db:5432/superbowl?schema=public"
|
||||
|
||||
# NextAuth
|
||||
NEXTAUTH_SECRET="change-me-to-a-random-secret"
|
||||
NEXTAUTH_URL="http://localhost:3000"
|
||||
@@ -0,0 +1,34 @@
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# next.js
|
||||
/.next/
|
||||
/out/
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# local env files
|
||||
.env
|
||||
.env*.local
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
||||
@@ -0,0 +1,198 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Project Overview
|
||||
|
||||
Super Bowl Squares — a web application that runs a 10x10 grid-based betting game for the Super Bowl. Players purchase squares, random numbers (0-9) are assigned to each row/column for AFC and NFC teams, and winners are determined by the last digit of each team's score at the end of each quarter.
|
||||
|
||||
This is a rewrite of a legacy PHP/MySQL application (preserved in `legacy/` for reference). The legacy app has significant security issues (SQL injection, plaintext passwords, no CSRF protection) and uses early-2000s HTML patterns.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- **Framework**: Next.js 14 (App Router) with TypeScript
|
||||
- **Database**: PostgreSQL 16 via Prisma ORM
|
||||
- **Auth**: NextAuth.js with JWT strategy and credentials provider
|
||||
- **Styling**: Tailwind CSS with custom theme (dark mode, `primary`/`accent` color scales, glow shadows)
|
||||
- **Real-time**: WebSocket server (ws) for live chat, mounted at `/ws/chat`
|
||||
- **Deployment**: Docker Compose (app + postgres)
|
||||
|
||||
## Development Commands
|
||||
|
||||
```bash
|
||||
# Start everything (build + run with Docker Compose)
|
||||
docker compose up --build -d
|
||||
|
||||
# View logs
|
||||
docker compose logs app --tail 50
|
||||
docker compose logs app -f # follow
|
||||
|
||||
# Rebuild after code changes
|
||||
docker compose up --build -d
|
||||
|
||||
# Stop
|
||||
docker compose down
|
||||
|
||||
# Database operations (run from host with node_modules present)
|
||||
npx prisma db push # sync schema to DB
|
||||
npx prisma generate # regenerate client after schema changes
|
||||
npx tsx prisma/seed.ts # seed default data
|
||||
npm run db:migrate # deploy prisma migrations (production)
|
||||
npm run db:generate # regenerate Prisma client (alias)
|
||||
|
||||
# Dev server (requires local postgres with DATABASE_URL pointing to it)
|
||||
npm run dev # runs tsx server.ts -> server.js
|
||||
```
|
||||
|
||||
**Note**: The app runs inside Docker where `DATABASE_URL` points to the `db` service. For local dev outside Docker, update `DATABASE_URL` to `postgresql://superbowl:superbowl@localhost:5432/superbowl`.
|
||||
|
||||
## Environment Variables
|
||||
|
||||
Required variables (see `.env.example`):
|
||||
- `DATABASE_URL` — PostgreSQL connection string
|
||||
- `POSTGRES_USER`, `POSTGRES_PASSWORD`, `POSTGRES_DB` — Database credentials
|
||||
- `NEXTAUTH_SECRET` — Random secret for JWT signing (generate with `openssl rand -base64 32`)
|
||||
- `NEXTAUTH_URL` — Full URL where app is deployed (e.g., `http://localhost:3000`)
|
||||
|
||||
## Architecture
|
||||
|
||||
### Custom Server (`server.js`)
|
||||
|
||||
Next.js runs behind a custom HTTP server that also handles WebSocket upgrades. This is required for the live chat and real-time grid update features. The server has two boot modes:
|
||||
|
||||
- **Dev mode** (`NODE_ENV !== 'production'`): Uses the standard `next()` API with `app.prepare()`, creates its own HTTP server, and adds WebSocket upgrade handling on `/ws/chat`.
|
||||
- **Production standalone mode**: Monkey-patches `http.createServer` to intercept the HTTP server that Next.js's `startServer()` creates, injecting WebSocket upgrade handling for `/ws/chat` before Next.js registers its own upgrade handler. Reads the embedded `nextConfig` from `server.standalone.js` (saved during Docker build) and sets `__NEXT_PRIVATE_STANDALONE_CONFIG` env var so Next.js skips webpack loading.
|
||||
|
||||
The server also runs:
|
||||
- Chat message broadcasting with blacklist filtering and JWT token decoding for user identity
|
||||
- `squares:changed` → `squares:refresh` broadcast for real-time grid updates
|
||||
- Payment reminder scheduler (15-minute interval) that checks unconfirmed squares approaching grace period deadline
|
||||
|
||||
`server.ts` is just a dev shim that requires `server.js`.
|
||||
|
||||
**Critical Dockerfile detail**: The standalone build output includes its own `server.js`. The Dockerfile saves it as `server.standalone.js` then copies our custom `server.js` over it. Extra node_modules not included in standalone output (`ws`, `nodemailer`, `next-auth`, `jose`, `@panva`, `uuid`, `@babel`, `preact`, `oauth`, `openid-client`, `cookie`) are explicitly copied in the Dockerfile.
|
||||
|
||||
### Authentication Flow
|
||||
|
||||
- `src/lib/auth.ts` — NextAuth config with credentials provider (email/password, bcrypt)
|
||||
- `src/middleware.ts` — Route protection: public routes (`/`, `/login`, `/register`, `/signup`, `/setup`, `/api/auth`, `/api/setup`), admin routes require ADMIN or VIEWER role, `/my-squares` requires any authenticated user
|
||||
- `src/types/index.ts` — Augments NextAuth session/JWT types with `role` and `id`
|
||||
- JWT tokens carry `role` (ADMIN/VIEWER/PLAYER) and `id` fields
|
||||
|
||||
### Database Pattern
|
||||
|
||||
- Prisma schema at `prisma/schema.prisma`
|
||||
- Singleton pattern: `GameSettings`, `Score`, and `EmailSettings` use `id: "singleton"` — there's always exactly one row
|
||||
- `prisma/seed.ts` — Seeds 100 squares (positions "00"-"99"), default settings, default score row, email settings, and 8 email templates (welcome, square_confirmation, square_confirmed, square_released, payment_reminder, numbers_assigned, game_results, custom). Uses upserts so it's idempotent. Email templates use `update: {}` to preserve manual edits (only creates, never overwrites).
|
||||
- Shared Prisma client at `src/lib/prisma.ts` (global singleton to avoid connection exhaustion in dev)
|
||||
|
||||
### Page Structure
|
||||
|
||||
- `/` — Main page: 10x10 grid + chat window. Redirects to `/setup` if no admin exists.
|
||||
- `/setup` — First-run admin account creation
|
||||
- `/login`, `/register` — Auth pages
|
||||
- `/signup?squares=01,02,...` — Square purchase form (guest or authenticated)
|
||||
- `/my-squares` — Player's own squares (requires auth)
|
||||
- `/admin/*` — Admin panel with sidebar nav (`layout.tsx` is a client component with role-based nav filtering)
|
||||
|
||||
Admin sub-pages: dashboard, squares, numbers, scores, balance, settings, users, email, chat, backup. Viewers are restricted from settings, users, and backup.
|
||||
|
||||
### API Routes (`src/app/api/`)
|
||||
|
||||
All API routes use `getServerSession(authOptions)` for auth checks. Pattern: GET for reads, POST for creates, PUT for full updates, PATCH for partial updates.
|
||||
|
||||
Key routes:
|
||||
- `squares/` — GET (list all), POST (purchase), PATCH (admin: confirm/release/reserve/bulk-reserve/edit)
|
||||
- `settings/` — GET (public), PUT (admin-only, handles payment methods separately)
|
||||
- `numbers/` — POST generates random 0-9 shuffles for NFC/AFC axes
|
||||
- `scores/` — PUT updates quarter scores and determines winners
|
||||
- `backup/` — Export/import game data
|
||||
- `upload/` — Image upload for team/SB logos
|
||||
|
||||
### Component Patterns
|
||||
|
||||
- Server components fetch data directly via Prisma (e.g., `page.tsx` for `/`)
|
||||
- Client components use `'use client'` and fetch via API routes
|
||||
- `src/components/Providers.tsx` wraps app with `SessionProvider` + `WebSocketProvider` + `ToastProvider`
|
||||
- Grid components: `SquareGrid` (10x10 table with real-time WS refresh), `SquareCell` (individual cell), `GridHeader` (team logos/matchup banner/event info)
|
||||
- `src/lib/ws.tsx` — React Context `WebSocketProvider` shares a single WebSocket connection app-wide. Exports `useWebSocket()` hook returning `{ messages, connected, sendMessage, deleteMessage, squaresVersion, notifySquaresChanged }`. The `squaresVersion` counter increments on `squares:refresh` events; components watch it to re-fetch grid data.
|
||||
|
||||
### Styling Conventions
|
||||
|
||||
- Dark theme throughout: `bg-gray-950` base, `bg-gray-900` cards
|
||||
- Custom Tailwind classes in `globals.css`: `.btn-primary`, `.btn-secondary`, `.btn-danger`, `.btn-success`, `.input-field`, `.card`, `.card-elevated`
|
||||
- Custom color scales: `primary` (blue), `accent` (purple), `success`, `warning`, `danger`
|
||||
- Custom glow shadows: `shadow-glow-sm`, `shadow-glow`, `shadow-glow-lg`, `shadow-glow-green`, `shadow-glow-amber`
|
||||
|
||||
### Docker Setup
|
||||
|
||||
- `Dockerfile` — Multi-stage build: builder (npm install, next build, compile seed script) -> runner (standalone output, prisma CLI for runtime migrations). The runner stage saves the original standalone `server.js` as `server.standalone.js` then copies our custom `server.js` over it, and copies extra node_modules not included in standalone output.
|
||||
- `docker-entrypoint.sh` — Runs `prisma db push`, seeds DB, then starts `node server.js`
|
||||
- `docker-compose.yml` — Two services: `app` (port 3000) and `db` (postgres:16-alpine, port 5432, healthcheck)
|
||||
|
||||
### Next.js Configuration
|
||||
|
||||
`next.config.js` settings:
|
||||
- `output: 'standalone'` — Minimal production build with embedded dependencies for Docker
|
||||
- `serverComponentsExternalPackages: ['nodemailer']` — Prevents bundling nodemailer (requires native modules)
|
||||
- `images: { unoptimized: true }` — Disables Next.js image optimization for simpler Docker deployment
|
||||
|
||||
### Real-time Updates
|
||||
|
||||
Two real-time channels share a single WebSocket connection per client:
|
||||
- **Chat**: Messages are stored in DB and broadcast to all connected clients
|
||||
- **Grid refresh**: When squares change (purchase, admin action), the acting client sends `{type: 'squares:changed'}` via WS. The server broadcasts `{type: 'squares:refresh'}` to all clients. Clients increment `squaresVersion` which triggers a re-fetch of `/api/squares`.
|
||||
|
||||
### Path Alias
|
||||
|
||||
`@/*` maps to `./src/*` (configured in `tsconfig.json`). Use `@/lib/prisma`, `@/components/ui/Button`, etc.
|
||||
|
||||
## Game Logic
|
||||
|
||||
- 100 squares in a 10x10 grid, positions "00" through "99" (row digit + column digit)
|
||||
- Row = NFC team axis, Column = AFC team axis
|
||||
- Numbers (0-9) are randomly shuffled independently for each axis; can only be generated when all 100 squares are claimed
|
||||
- Winners: last digit of each team's quarter score maps to the grid number → intersecting square wins
|
||||
- Four quarters: Q1 (first), Q2 (half), Q3 (third), Final — each with configurable payout percentage
|
||||
- Max 10 squares per purchase submission
|
||||
- Squares can be guest-purchased (name+email) or purchased by authenticated players
|
||||
|
||||
## Feature Requirements
|
||||
|
||||
### Role-Based Access (3 roles)
|
||||
|
||||
**Admin** (full control): manage all accounts, game settings (bet amount, teams, logos, payouts, payment methods, rules), generate numbers, edit squares, edit scores, email system, backup/restore, chat moderation
|
||||
|
||||
**Viewer** (limited admin — for co-commissioners): view balance sheet, edit squares, update scores, send emails, moderate chat
|
||||
|
||||
**Player** (authenticated participant): view own squares, purchase squares, live chat, change own name/password
|
||||
|
||||
### Email System
|
||||
- Templates with `{{placeholder}}` variables (stored in DB, seeded with defaults)
|
||||
- Configurable SMTP/SSL transport via `EmailSettings`
|
||||
- `src/lib/email.ts` — `sendEmail()`, `renderTemplate()`, `getTransporter()` core functions
|
||||
- `src/lib/autoEmail.ts` — Fire-and-forget automated emails triggered by game events:
|
||||
- `sendWelcomeEmail` — on user registration (from `POST /api/users`)
|
||||
- `sendPurchaseConfirmationEmail` — on square purchase (from `POST /api/squares`)
|
||||
- `sendSquareConfirmedEmail` / `sendSquareReleasedEmail` — on admin confirm/release (from `PATCH /api/squares`)
|
||||
- `sendNumbersAssignedEmails` — to all participants when numbers generated (from `POST /api/numbers`)
|
||||
- `sendGameResultsEmails` — to all participants when final score entered (from `PUT /api/scores`)
|
||||
- `checkPaymentReminders` — scheduled in server.js every 15 minutes, sends reminders 2 hours before grace period deadline
|
||||
- Admin Send tab (`POST /api/email`) populates all template variables per-recipient from DB (squares, amount, payment info, winners)
|
||||
- Available template variables: `{{name}}`, `{{email}}`, `{{squares}}`, `{{amountDue}}`, `{{commissioner}}`, `{{eventName}}`, `{{gameUrl}}`, `{{graceHours}}`, `{{paymentInstructions}}`, `{{paymentMethods}}`, `{{winners}}`, `{{rulesText}}`
|
||||
|
||||
### Live Chat
|
||||
- WebSocket-based, embedded on front page (YouTube/Twitch live-chat style)
|
||||
- Blacklist-based word filtering
|
||||
- Admin/viewer can delete messages
|
||||
|
||||
### Backup/Restore
|
||||
- Config-only or full (config + square/game data) export/import
|
||||
|
||||
## Testing
|
||||
|
||||
No testing framework is currently configured. To add tests, consider installing Jest or Vitest with React Testing Library.
|
||||
|
||||
## Assets
|
||||
|
||||
Team logos in `public/images/`: `afc-{team}.png` and `nfc-{team}.png` for all 32 NFL teams, plus conference logos, generic placeholders, Super Bowl event logos, and background images.
|
||||
@@ -0,0 +1,72 @@
|
||||
FROM node:20-alpine AS base
|
||||
|
||||
# --- Builder ---
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json* ./
|
||||
COPY prisma ./prisma/
|
||||
RUN npm install
|
||||
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# Compile seed script to JS so the runner doesn't need tsx
|
||||
RUN npx tsx --compile prisma/seed.ts > /dev/null 2>&1 || true
|
||||
RUN test -f prisma/seed.js || npx esbuild prisma/seed.ts --bundle --platform=node --outfile=prisma/seed.js --external:@prisma/client 2>/dev/null || true
|
||||
|
||||
# --- Runner ---
|
||||
FROM base AS runner
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
RUN addgroup --system --gid 1001 nodejs
|
||||
RUN adduser --system --uid 1001 nextjs
|
||||
|
||||
# Install prisma CLI for db push at runtime
|
||||
RUN npm install -g prisma@6
|
||||
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/prisma ./prisma
|
||||
COPY --from=builder /app/docker-entrypoint.sh ./docker-entrypoint.sh
|
||||
|
||||
# Copy standalone output (includes node_modules with @prisma/client)
|
||||
COPY --from=builder /app/.next/standalone ./
|
||||
COPY --from=builder /app/.next/static ./.next/static
|
||||
|
||||
# Save the original standalone server.js (contains embedded nextConfig)
|
||||
# then override with our custom server that adds WebSocket support
|
||||
RUN cp /app/server.js /app/server.standalone.js
|
||||
COPY --from=builder /app/server.js ./server.js
|
||||
|
||||
# Copy modules needed by custom server (not included in standalone output)
|
||||
COPY --from=builder /app/node_modules/ws ./node_modules/ws
|
||||
COPY --from=builder /app/node_modules/nodemailer ./node_modules/nodemailer
|
||||
# next-auth/jwt for WebSocket chat user identification
|
||||
COPY --from=builder /app/node_modules/next-auth ./node_modules/next-auth
|
||||
COPY --from=builder /app/node_modules/jose ./node_modules/jose
|
||||
COPY --from=builder /app/node_modules/@panva ./node_modules/@panva
|
||||
COPY --from=builder /app/node_modules/uuid ./node_modules/uuid
|
||||
COPY --from=builder /app/node_modules/@babel ./node_modules/@babel
|
||||
COPY --from=builder /app/node_modules/preact ./node_modules/preact
|
||||
COPY --from=builder /app/node_modules/preact-render-to-string ./node_modules/preact-render-to-string
|
||||
COPY --from=builder /app/node_modules/oauth ./node_modules/oauth
|
||||
COPY --from=builder /app/node_modules/openid-client ./node_modules/openid-client
|
||||
COPY --from=builder /app/node_modules/cookie ./node_modules/cookie
|
||||
|
||||
# Seed script
|
||||
COPY --from=builder /app/prisma/seed.js ./prisma/seed.js
|
||||
|
||||
# Fix Windows line endings and make executable
|
||||
RUN sed -i 's/\r$//' ./docker-entrypoint.sh && chmod +x ./docker-entrypoint.sh
|
||||
RUN chown -R nextjs:nodejs /app
|
||||
|
||||
USER nextjs
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENV PORT=3000
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
|
||||
ENTRYPOINT ["./docker-entrypoint.sh"]
|
||||
@@ -0,0 +1,27 @@
|
||||
services:
|
||||
app:
|
||||
build: .
|
||||
network_mode: host
|
||||
env_file: .env
|
||||
environment:
|
||||
- DATABASE_URL=postgresql://superbowl:superbowl@127.0.0.1:5432/superbowl?schema=public
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
|
||||
db:
|
||||
image: postgres:16-alpine
|
||||
network_mode: host
|
||||
env_file: .env
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U superbowl"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
echo "Running Prisma migrations..."
|
||||
npx prisma db push --skip-generate
|
||||
|
||||
echo "Seeding database..."
|
||||
node prisma/seed.js || echo "Seed skipped (may already exist)"
|
||||
|
||||
echo "Starting server..."
|
||||
exec node server.js
|
||||
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 9.6 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 9.3 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 165 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 9.5 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 9.3 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 157 KiB |
|
After Width: | Height: | Size: 48 KiB |
@@ -0,0 +1,181 @@
|
||||
<?php
|
||||
session_start();
|
||||
@ob_start();
|
||||
|
||||
if (!isset($_SESSION['VNSB'])) {
|
||||
header("Location: adminlogin.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once('config.php');
|
||||
$confirmation = $_POST['Confirmation'];
|
||||
$SQUARE = $_POST['square'];
|
||||
$CONFIRM = $_POST['confirm'];
|
||||
$RELEASE = $_POST['release'];
|
||||
$NOTES = $_POST['body'];
|
||||
|
||||
require "header.inc";
|
||||
$sb_URL = $record['sb_URL'];
|
||||
|
||||
// To send HTML mail, the Content-type header must be set
|
||||
$headers = 'MIME-Version: 1.0' . "\r\n";
|
||||
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
|
||||
|
||||
// Additional headers
|
||||
$headers .= "From: $commissioner <$ADMIN_EMAIL>" . "\r\n";
|
||||
$headers .= 'Bcc: $commissioner <$ADMIN_EMAIL>' . "\r\n";
|
||||
|
||||
function notify_admin($mailto, $mailmessage, $mail_headers) {
|
||||
mail($mailto, "Super Bowl Squares", $mailmessage, $mail_headers);
|
||||
}
|
||||
?>
|
||||
|
||||
<h3>ADMINISTRATOR APPROVAL</h3>
|
||||
|
||||
<?php
|
||||
if (!isset($confirmation)) {
|
||||
?>
|
||||
<table width="50%" cellpadding="5" style="font-family: verdana, arial; border: #FFCC99 1px solid">
|
||||
<tr>
|
||||
<td height="28" colspan="3" align="center" style="font-size: 11px">
|
||||
<strong>Confirm user selected square when payment is verified, or release the square if allowed time for payment has expired.</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="" align="center" valign="top">
|
||||
<form name="approval" action="admin.php" method="post" enctype="multipart/form-data">
|
||||
<table width="100%" border="0" style="font-family: verdana, arial; font-size: 11px">
|
||||
<tr>
|
||||
<td><b>Square</b></td>
|
||||
<td>
|
||||
<select name="square[]" id="square" size="11" multiple>
|
||||
<?php
|
||||
$query = "SELECT * FROM VNSB_squares WHERE NAME!='AVAILABLE' AND NAME!='' AND CONFIRM='0' ORDER BY NAME, SQUARE";
|
||||
$result = mysqli_query($conn, $query);
|
||||
if (!$result) {
|
||||
echo mysqli_error();
|
||||
exit;
|
||||
}
|
||||
while ($record = mysqli_fetch_assoc($result)) {
|
||||
echo "<option value='" . $record['SQUARE'] . "'>" . $record["NAME"] . " - " . $record["SQUARE"] . "</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Confirm</b></td>
|
||||
<td><input type="checkbox" name="confirm" value="1"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Release</b></td>
|
||||
<td><input type="checkbox" name="release" value="1"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Notes to User</b></td>
|
||||
<td><textarea name="body" rows="3" cols="50" wrap="virtual" style="font-family: verdana, arial; font-size: 10px"></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><br/><p><input type="submit" value="Confirmation" name="Confirmation"></p></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
<table width="50%" border="0" cellspacing="0" cellpadding="0" style="font-family: verdana, arial; font-size: 12px">
|
||||
<tr>
|
||||
<td width="16%"><a href="<?=$sb_URL?>" title="Home">Home</a></td>
|
||||
<td width="16%" align="center"><a href="admin.php" title="Administrator">Admin</a></td>
|
||||
<td width="16%" align="center"><a href="report.php" title="Balance Sheet">Balance Sheet</a></td>
|
||||
<td width="16%" align="center"><a href="randomnumber.php" title="Number Generator">Number Generator</a></td>
|
||||
<td width="16%" align="center"><a href="scores.php" title="Enter scores">Scores</a></td>
|
||||
<td width="16%" align="center"><a href="adminlogout.php" title="Admin logout">Logout</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
<?php
|
||||
} else {
|
||||
if (count((is_countable($SQUARE) ? $SQUARE : [])) > 0) {
|
||||
$input = "";
|
||||
$whereclause = "(";
|
||||
|
||||
for ($e = 0; $e < count($SQUARE); $e++) {
|
||||
$whereclause .= "SQUARE = '" . trim($SQUARE[$e]) . "' OR ";
|
||||
$square_list = $square_list . ", " . $SQUARE[$e];
|
||||
}
|
||||
|
||||
$whereclause = substr_replace($whereclause, "", -3); // strip off ' OR'
|
||||
$whereclause = $whereclause . ")";
|
||||
|
||||
$square_list = substr_replace($square_list, "", 0, 2);
|
||||
|
||||
$query = "SELECT * FROM VNSB_squares WHERE $whereclause";
|
||||
$result = mysqli_query($conn, $query);
|
||||
if (!$result) {
|
||||
echo mysqli_error();
|
||||
exit;
|
||||
}
|
||||
|
||||
$USER_EMAIL_LIST = '';
|
||||
while ($record = mysqli_fetch_assoc($result)) {
|
||||
$USER_EMAIL = $record["EMAIL"];
|
||||
$pos = strpos($USER_EMAIL_LIST, $USER_EMAIL);
|
||||
if ($pos === false) {
|
||||
$USER_EMAIL_LIST = $USER_EMAIL_LIST . ", " . $USER_EMAIL;
|
||||
}
|
||||
}
|
||||
$USER_EMAIL_LIST = substr_replace($USER_EMAIL_LIST, "", 0, 2);
|
||||
|
||||
$bodyMessage = "\r\nNOTIFICATION:<br />\r\n";
|
||||
if ($CONFIRM == 1 && $RELEASE != 1) {
|
||||
$query = "UPDATE VNSB_squares SET CONFIRM='1' WHERE $whereclause";
|
||||
$bodyMessage .= "Your square $square_list is now confirmed.\r\n\n";
|
||||
} else if ($RELEASE == 1 && $CONFIRM != 1) {
|
||||
$query = "UPDATE VNSB_squares SET NAME='AVAILABLE', EMAIL='', NOTES='', DATE='', CONFIRM='0' WHERE $whereclause";
|
||||
$bodyMessage .= "Your square $square_list selection is now released due to non payment.\r\n";
|
||||
$bodyMessage .= "<br />If this is an error, please contact the commissioner or re-select your square/squares. <br />\r\n\n";
|
||||
} else if (($CONFIRM != 1 && $RELEASE != 1) || ($RELEASE == 1 && $CONFIRM == 1)) {
|
||||
echo "<p>Must select ONLY one 'Confirm' or 'Release' !!!</p>";
|
||||
echo "<p><a href='javascript:onClick=history.go(-1);'>Back</a></p>";
|
||||
exit;
|
||||
}
|
||||
|
||||
$result = mysqli_query($conn, $query);
|
||||
if (!$result) {
|
||||
echo mysqli_error();
|
||||
} else {
|
||||
$bodyMessage .= "<br />Reason given:<br />\r\n";
|
||||
$bodyMessage .= $NOTES . "\r\n\n";
|
||||
$bodyMessage .= "<br /><br />Good Luck and enjoy the game!\r\n";
|
||||
$bodyMessage .= "<br />- $commissioner\r\n";
|
||||
$bodyMessage .= "<br /><a href=" . $sb_URL . ">$sb_URL</a>\r\n";
|
||||
|
||||
notify_admin($USER_EMAIL_LIST, $bodyMessage, $headers);
|
||||
echo "<p>Square(s) <b>" . $square_list . "</b> updated successfully</p>";
|
||||
echo "<p>Emailed to: " . $USER_EMAIL_LIST . "</p>";
|
||||
echo "
|
||||
<p>
|
||||
<table width=\"50%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"font-family: verdana, arial; font-size: 12px\">
|
||||
<tr>
|
||||
<td width=\"16%\"><a href=\"<?=$sb_URL?\" title=\"Home\">Home</a></td>
|
||||
<td width=\"16%\" align=\"center\"><a href=\"admin.php\" title=\"Administrator\">Admin</a></td>
|
||||
<td width=\"16%\" align=\"center\"><a href=\"report.php\" title=\"Balance Sheet\">Balance Sheet</a></td>
|
||||
<td width=\"16%\" align=\"center\"><a href=\"randomnumber.php\" title=\"Number Generator\">Number Generator</a></td>
|
||||
<td width=\"16%\" align=\"center\"><a href=\"scores.php\" title=\"Enter scores\">Scores</a></td>
|
||||
<td width=\"16%\" align=\"center\"><a href=\"adminlogout.php\" title=\"Admin logout\">Logout</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>";
|
||||
unset($confirmation, $SQUARE, $CONFIRM, $RELEASE, $NOTES, $ADM_EMAIL, $ADM_PASSWORD);
|
||||
}
|
||||
} else {
|
||||
echo "<p>Must select at least one Square to Confirm or Release' !!!</p>";
|
||||
echo "<p><a href='javascript:onClick=history.go(-1);'>Back</a></p>";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
require "footer.inc";
|
||||
?>
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
@ob_start();
|
||||
session_start();
|
||||
?>
|
||||
|
||||
<!--
|
||||
www.vnlisting.com
|
||||
Online Super Bowl Squares Script
|
||||
Please read the "Readme.txt for license agreement, installation and usage instructions
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>ADMIN - Login</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<center>
|
||||
<?php
|
||||
$email=$_POST['AdminEmail'];
|
||||
$pass=$_POST['AdminPass'];
|
||||
|
||||
// check to see if details have been passed to the script by the form
|
||||
if ($email && $pass) {
|
||||
if ($_SESSION['VNSB']) {
|
||||
echo $email.", you are already logged in.<br/><br/>";
|
||||
echo "<a href='admin.php'>Admin</a><br/><br/><a href='adminlogout.php'>Log out.</a>";
|
||||
exit;
|
||||
}
|
||||
// check input variables against database
|
||||
include "config.php";
|
||||
$sql = "SELECT Admin_email, Admin_pwd FROM VNSB_settings";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
// in case of an error, throw up an error message and exit
|
||||
if (!$result) {
|
||||
echo "Sorry, there is a problem with accessing your database!!!";
|
||||
exit;
|
||||
} else {
|
||||
$record = mysqli_fetch_assoc($result);
|
||||
if ($email==$record['Admin_email'] AND $pass==$record['Admin_pwd']) {
|
||||
$_SESSION['VNSB']=$record['Admin_email'];
|
||||
mysqli_close($conn);
|
||||
header ("Location: admin.php");
|
||||
} else {
|
||||
echo "<center><h1>Invalid login</h1><p><a href=\"adminlogin.php\">Admin login</a></p></center>";
|
||||
mysqli_close($conn);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<br />
|
||||
<br>
|
||||
<h2>Admin login</h2>
|
||||
|
||||
<form method="post" action="adminlogin.php">
|
||||
<p> Email: <input name="AdminEmail" type="text" size="30"></p>
|
||||
<p> Password: <input name="AdminPass" type="password" size="30"></p>
|
||||
<p> <input type="submit" value="Login"></p>
|
||||
</form>
|
||||
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
session_start();
|
||||
?>
|
||||
|
||||
<HTML>
|
||||
<head>
|
||||
<title>ADMIN - Logout</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
</head>
|
||||
|
||||
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
|
||||
<center>
|
||||
|
||||
<H2>Logout</H2>
|
||||
<?php
|
||||
// if the user is logged in, log them out
|
||||
if ($_SESSION['VNSB']) {
|
||||
unset($_SESSION['VNSB']);
|
||||
echo "You are now logged out.";
|
||||
echo "<br><br><em>Don't forget to close your brower when you are done!!!</em>";
|
||||
|
||||
// if the user isnt logged in, let them know that
|
||||
} else {
|
||||
echo "You haven't even logged in yet.";
|
||||
}
|
||||
?>
|
||||
|
||||
<p><a href="<?php echo $_SERVER['REQUEST_SCHEME']."://".$_SERVER['HTTP_HOST'].trim($_SERVER['PHP_SELF'], "adminlogout.php");?>">Home</a></p>
|
||||
<p><a href="admin.php">Admin</a></p>
|
||||
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,19 @@
|
||||
<!--
|
||||
www.vnlisting.com
|
||||
Online Super Bowl Squares Script
|
||||
Please read the "Readme.txt for license agreement, installtion and usage instructions
|
||||
-->
|
||||
|
||||
<?php
|
||||
|
||||
//make changes accordingly to your database
|
||||
$hostname = "localhost";
|
||||
$database = "u595523489_btdosuperbowl";
|
||||
$username = "u595523489_supusr";
|
||||
$password = "g9Ml#s|1V";
|
||||
$conn = mysqli_connect($hostname, $username, $password, $database);
|
||||
if (!$conn) {
|
||||
die("Connection failed: ".mysqli_connect_error());
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,99 @@
|
||||
<!--
|
||||
www.vnlisting.com
|
||||
Online Super Bowl Squares Script
|
||||
Please read the "Readme.txt for license agreement, installation and usage instructions
|
||||
Version: 4.1 1/9/2012
|
||||
-->
|
||||
|
||||
<?php
|
||||
@ob_start();
|
||||
session_start();
|
||||
|
||||
if (!$_SESSION['VNSB']) {
|
||||
?>
|
||||
<meta http-equiv="Refresh"content="0;url=adminlogin.php">
|
||||
<?php
|
||||
} else {
|
||||
|
||||
require_once('config.php');
|
||||
$sendemails = $_POST['sendemails'];
|
||||
|
||||
require "header.inc";
|
||||
$sb_URL = $record['sb_URL'];
|
||||
|
||||
$LINKS = "
|
||||
<p>
|
||||
<table width=\"50%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"font-family: verdana, arial; font-size: 12px\">
|
||||
<tr>
|
||||
<td width=\"33%\"><a href=\"$sb_URL\" title=\"Home\">Home</a></td>
|
||||
<td width=\"34%\" align=\"center\"><a href=\"admin.php\" title=\"Administrator\">Admin</a></td>
|
||||
<td width=\"34%\" align=\"center\"><a href=\"./report.php\" title=\"Balance Sheet\">Balance Sheet</a></td>
|
||||
<td width=\"33%\" align=\"right\"><a href=\"adminlogout.php\" title=\"Admin logout\">Logout</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
";
|
||||
|
||||
function notify_admin ($mailto, $mailmessage, $mail_headers)
|
||||
{
|
||||
mail("$mailto", "Super Bowl Squares", "$mailmessage", "$mail_headers");
|
||||
}
|
||||
?>
|
||||
|
||||
<h3>Send Email to ALL</h3>
|
||||
<?php
|
||||
if (!isset($sendemails)) { ?>
|
||||
<table width="50%" cellpadding="5" style="font-family: verdana, arial; border: #FFCC99 1px solid">
|
||||
<tr>
|
||||
<td height="28" colspan="3" align="center" style="font-size: 11px">
|
||||
<strong>Click the button below to send an email to everyone and let them know the numbers have been picked and assigned for them to view and print as needed.</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="" align="center" valign="top">
|
||||
<form name="approval" action="emailall.php" method="post">
|
||||
<table width="100%" border="0" style="font-family: verdana, arial; font-size: 11px">
|
||||
<tr>
|
||||
<td> </a></td>
|
||||
<td align="center"><br/><p><input type="submit" value="Send Emails" name="sendemails"></p></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
echo $LINKS;
|
||||
|
||||
} else {
|
||||
echo "<p>Emails send to:</p>";
|
||||
$bodyMessage = "\r\nNOTIFICATION\r\n";
|
||||
$bodyMessage .= "All squares have been selected and all numbers have been picked and assigned.\r\n";
|
||||
$bodyMessage .= "You can view and print your own sheet at $sb_URL.\r\n\n";
|
||||
$bodyMessage .= "Good Luck and enjoy the game.\r\n\n";
|
||||
$bodyMessage .= "$commissioner\r\n";
|
||||
$headers = "From: $commissioner <$ADMIN_EMAIL>\r\n";
|
||||
$sql="SELECT * FROM VNSB_squares ORDER BY EMAIL";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if (!$result) {
|
||||
echo mysqli_error();
|
||||
exit;
|
||||
}
|
||||
while ($record = mysqli_fetch_assoc($result)) {
|
||||
if ($USER_EMAIL != $record["EMAIL"]) {
|
||||
$USER_NAME = $record["NAME"];
|
||||
$USER_EMAIL = $record["EMAIL"];
|
||||
notify_admin($USER_EMAIL,$bodyMessage,$headers);
|
||||
echo "<p><b>".$USER_NAME."</b>: ".$USER_EMAIL."</p>";
|
||||
}
|
||||
}
|
||||
|
||||
echo $LINKS;
|
||||
unset($sendemails);
|
||||
$headers = "From: $commissioner <$ADMIN_EMAIL>\r\n";
|
||||
notify_admin($ADMIN_EMAIL,$bodyMessage,$headers);
|
||||
} ?>
|
||||
<?php require "footer.inc";
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,19 @@
|
||||
<!--
|
||||
www.vnlisting.com
|
||||
Online Super Bowl Squares Script
|
||||
Please read the "Readme.txt for license agreement, installation and usage instructions
|
||||
-->
|
||||
|
||||
<!-- You may not and shall not make any changes to this file -->
|
||||
<p>
|
||||
<table width="95%" style="font-family: verdana, arial; font-size: 9px">
|
||||
<tr>
|
||||
<td>Copyright © <?=date("Y")?> <a href="http://www.vnlisting.com/" title="VNLISTING" target="_parent">VNLISTING</a> modified by <a href="http://www.djsplice.com" title="DJSPLICE.COM" target="_parent">djsplice.com</a></td>
|
||||
<td align="right">SB Squares v.<?=$VERSION?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
</center>
|
||||
<?php mysqli_close($conn); ?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,340 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
.
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
.
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
.
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
.
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
.
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
@@ -0,0 +1,52 @@
|
||||
<!--
|
||||
www.vnlisting.com
|
||||
Online Super Bowl Squares Script
|
||||
Please read the "Readme.txt for license agreement, installation and usage instructions
|
||||
-->
|
||||
|
||||
<?php
|
||||
$query="SELECT * FROM VNSB_settings";
|
||||
$result = mysqli_query($conn, $query);
|
||||
if ($record = mysqli_fetch_assoc($result)) {
|
||||
$SB_TITLE = $record['sb_title'];
|
||||
$SB_URL = $record['sb_URL'];
|
||||
$commissioner = $record['commissioner'];
|
||||
$SB_EVENT = $record['sb_event'];
|
||||
$SB_DATE = $record['sb_date'];
|
||||
$SB_TIME = $record['sb_time'];
|
||||
$SB_LOGO = $record['sb_logo'];
|
||||
$NFC_TEAM = $record['NFC_team'];
|
||||
$NFC_LOGO = $record['NFC_logo'];
|
||||
$AFC_TEAM = $record['AFC_team'];
|
||||
$AFC_LOGO = $record['AFC_logo'];
|
||||
$VERSION = $record['Version'];
|
||||
$ADMIN_EMAIL = $record['Admin_email'];
|
||||
$ADMIN_PASSWORD = $record['Admin_pwd'];
|
||||
//$ADMIN_VERIFY = $record['Admin_verify'];
|
||||
} else {
|
||||
//echo mysql_error();
|
||||
echo "<br/>Sorry, Technical problem occurred... Can't read from database.<br><br> Please notify this site admin</a>";
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title><?=$SB_TITLE?> <?=$SB_EVENT?> Squares v4</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="keywords" content="superbowl squares, super bowl, nfl squares online"/>
|
||||
<meta name="description" content="NFL Super Bowl Squares Online."/>
|
||||
<meta name="robots" content="index,nofollow"/>
|
||||
</head>
|
||||
<img src='images/FootballField_Low.jpg' style='position:fixed;top:0px;left:0px;width:100%;height:100%;z-index:-1;'>
|
||||
<body bgcolor="" link="#0033CC" vlink="#0033CC" alink="#CC0000" leftmargin="0" topmargin="10" marginwidth="0" marginheight="0">
|
||||
<!--body bgcolor="#99CCFF" link="#0033CC" vlink="#0033CC" alink="#CC0000" leftmargin="0" topmargin="10" marginwidth="0" marginheight="0"-->
|
||||
<center>
|
||||
<p>
|
||||
<table width="95%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td align="center" width="33%"><img src="images/<?=$SB_LOGO?>" border="0" title="<?=$SB_EVENT?> Squares"></td>
|
||||
<td align="center" width="34%"><h2><font color="#009900"><br><?=$SB_TITLE?><br><?=$SB_EVENT?> Squares<br><?=$SB_DATE?><br><?=$SB_TIME?></font></h3></td>
|
||||
<td align="center" width="33%"><img src="images/<?=$AFC_LOGO?>" border="0" title="<?=$AFC_TEAM?>"> <b><font size="+2">vs</font></b> <img src="images/<?=$NFC_LOGO?>" border="0" title="<?=$NFC_TEAM?>"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br/>
|
||||
@@ -0,0 +1,186 @@
|
||||
<?php
|
||||
require_once('config.php');
|
||||
$NFC = array();
|
||||
$AFC = array();
|
||||
$cnt = 0;
|
||||
for ($i=1; $i<=10; $i++) {
|
||||
$NFC[$i]="";
|
||||
$AFC[$i]="";
|
||||
}
|
||||
$sql="SELECT * FROM VNSB_numbers";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
#$result = mysql_query($query);
|
||||
if (!$result) {
|
||||
echo mysqli_error($conn);
|
||||
exit;
|
||||
}
|
||||
|
||||
while ($record = mysqli_fetch_assoc($result)) {
|
||||
$cnt++;
|
||||
$NFC[$cnt]=$record['NFC'];
|
||||
$AFC[$cnt]=$record['AFC'];
|
||||
}
|
||||
|
||||
$sql="SELECT * FROM VNSB_settings";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
#$result = mysql_query($query);
|
||||
if ($record = mysqli_fetch_assoc($result)) {
|
||||
$BET = $record['Bet'];
|
||||
$sb_title = $record['sb_title'];
|
||||
$PayPal = $record['PayPal'];
|
||||
$Venmo = $record['Venmo'];
|
||||
$CashApp = $record['CashApp'];
|
||||
$Zelle = $record['Zelle'];
|
||||
$WIN_FIRST = $record['Win_first'];
|
||||
$WIN_SECOND = $record['Win_second'];
|
||||
$WIN_THIRD = $record['Win_third'];
|
||||
$WIN_FINAL = $record['Win_final'];
|
||||
$WIN_FINAL = $record['Win_final'];
|
||||
$DONATION_FINAL = $record['Donation_Final'];
|
||||
$FIRST = (100 * (int)$BET ) * ((int)$WIN_FIRST/100);
|
||||
$SECOND = (100 * (int)$BET ) * ((int)$WIN_SECOND/100);
|
||||
$THIRD = (100 * (int)$BET ) * ((int)$WIN_THIRD/100);
|
||||
$FINAL = (100 * (int)$BET ) * ((int)$WIN_FINAL/100);
|
||||
$DONATION = (100 * (int)$BET ) * ((int)$DONATION_FINAL/100);
|
||||
} else {
|
||||
echo mysqli_error($conn);
|
||||
exit;
|
||||
}
|
||||
$sql="SELECT * FROM VNSB_scores ORDER BY ID DESC LIMIT 1";
|
||||
$result = mysqli_query($conn, $sql);
|
||||
if (!$result) {
|
||||
echo mysqli_error();
|
||||
exit;
|
||||
}
|
||||
|
||||
$scores = mysqli_fetch_assoc($result);
|
||||
$NFC_FIRST=$scores['NFC_FIRST'];
|
||||
$AFC_FIRST=$scores['AFC_FIRST'];
|
||||
$NFC_HALF=$scores['NFC_HALF'];
|
||||
$AFC_HALF=$scores['AFC_HALF'];
|
||||
$NFC_THIRD=$scores['NFC_THIRD'];
|
||||
$AFC_THIRD=$scores['AFC_THIRD'];
|
||||
$NFC_FINAL=$scores['NFC_FINAL'];
|
||||
$AFC_FINAL=$scores['AFC_FINAL'];
|
||||
//count of remaining squares
|
||||
$result=mysqli_query($conn,"SELECT COUNT(*) as 'total' FROM VNSB_squares WHERE CONFIRM='0'");
|
||||
$data=mysqli_fetch_assoc($result);
|
||||
|
||||
require "header.inc"; ?>
|
||||
<!--<p align="center">This is the live demo. Use real email to see the script at work.</p>-->
|
||||
<table width="95%" border="1" cellspacing="1" cellpadding="5" style="font-family: Verdana,Ariel; font-size: 10px; color:#0066CC;">
|
||||
<tr>
|
||||
<td align="center" style="border-top: none; border-left: none;"><img src="images/NFL-logo.gif" title="National Football League" border="0" /></td>
|
||||
<?php
|
||||
for ($i=1; $i<=10; $i++) {
|
||||
echo "<td align=\"center\" style=\"font-size:12px; color:#232B85; font-weight:bold\">".$NFC_TEAM."<br>".$NFC[$i]."</td>";
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<form name="sqSelect" method="post" action="signup.php">
|
||||
|
||||
<?php
|
||||
$sql="SELECT * FROM VNSB_squares ORDER BY SQUARE";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
#$result = mysql_query($query);
|
||||
if (!$result) {
|
||||
echo mysqli_error($conn);
|
||||
exit;
|
||||
}
|
||||
$cnt_row = 0;
|
||||
$i=0;
|
||||
$closed=1;
|
||||
while ($record = mysqli_fetch_assoc($result)) {
|
||||
if ($cnt_row==0) {$i++; echo"<td align=\"center\" style=\"font-size:12px; color:#DB2824; font-weight:bold\">".$AFC_TEAM."<br/>".$AFC[$i]."</td>";}
|
||||
if ($record['NAME'] == "AVAILABLE") {
|
||||
$closed=0;
|
||||
echo "<td align=\"center\" width='10%' title='only $".$BET."'>".$record['SQUARE']." ".$record['NAME']."<br/>";
|
||||
echo "<input name=\"sqNum_".$record['SQUARE']."\" type=\"checkbox\" value=\"".$record['SQUARE']."\"></input>";
|
||||
//<a href=\"signup.php?square=".$record['SQUARE']."\">".stripslashes($record['NAME'])."<br/>".$record['SQUARE']."</a>
|
||||
echo "</td>";
|
||||
} else if ($record['NAME']!="AVAILABLE" && $record['CONFIRM']==1) {
|
||||
echo "<td width='10%' bgcolor='#99ff66' align='center' title=\"".$record['NOTES']."\"><strong>".stripslashes($record['NAME'])."</strong><br/>Confirmed</td>";
|
||||
} else {
|
||||
echo "<td width='10%' bgcolor='#ff9966' align='center' title=\"".$record['NOTES']."\"><strong>".stripslashes($record['NAME'])."</strong><br/>Pending</td>";
|
||||
}
|
||||
|
||||
$cnt_row++;
|
||||
if ($cnt_row==10) {
|
||||
$cnt_row=0;
|
||||
echo "</tr><tr>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
if ( !$closed ) {
|
||||
?>
|
||||
<p style="font-family: Verdana,Ariel; font-size: 10px; color:#0066CC; font-weight:bold">
|
||||
<p>Only <a style="font-family: Verdana,Ariel; font-size: 12px; color:#FF0000; font-weight:bold"><?php echo $data['total'];?></a> squares left!</p>
|
||||
<p>Check all your desired squares and click Submit to enter your information</p><br />
|
||||
<input type="submit" name="sqSelect_Submit" value="Submit" title="Submit your selection"></input>
|
||||
</p>
|
||||
<?php } ?>
|
||||
</form>
|
||||
<br/>
|
||||
<table width="95%" cellspacing="5" cellpadding="5" style="font-family: Verdana,Ariel; font-size: 12px; border: #009900 1px solid">
|
||||
<tr>
|
||||
<td align="left" width="46%" valign="top">
|
||||
<p><strong>The Rules:</strong></p>
|
||||
<ul>
|
||||
<li><strong>$<?=$BET?></strong> Per square</li>
|
||||
<li>You can buy as many squares as you want</li>
|
||||
<li>Your square(s) is/are not guaranteed until your payment is verified</li>
|
||||
<li>Numbers will be randomly draw and assigned after all squares are taken</li>
|
||||
<li>When confirmed, your square(s) will be changed to <span style="color: #009900;"><strong>GREEN</strong></span></li>
|
||||
<li>Please make payment via the following:
|
||||
<ul>
|
||||
<li><b>Cash</b></li>
|
||||
<li><b>Zelle:</b> <?=$Zelle?></li>
|
||||
<li><b>PayPal:</b> <?=$PayPal?> (Use 'Friends and Family')</li>
|
||||
<li><b>Venmo:</b> <?=$Venmo?></li>
|
||||
<li><b>CashApp:</b> <?=$CashApp?></li>
|
||||
</td>
|
||||
<td align="center" width="27%" valign="top">
|
||||
<table width="100%" style="font-family: Verdana,Ariel; font-size: 12px; border: #009900 1px solid">
|
||||
<tr>
|
||||
<td colspan="3" align="center"><strong>The Payout:</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="60%">
|
||||
<li>End of first quarter:</li>
|
||||
<li>End of second quarter:</li>
|
||||
<li>End of third quarter:</li>
|
||||
<li>Final Score:</li>
|
||||
<!-- <li>Donation:</li> -->
|
||||
</td>
|
||||
<td width="20%">
|
||||
<dt><strong><font color="#232B85"><?=$NFC_FIRST?></font> <font color="#DB2824"><?=$AFC_FIRST?></font></strong></dt>
|
||||
<dt><strong><font color="#232B85"><?=$NFC_HALF?></font> <font color="#DB2824"><?=$AFC_HALF?></font></strong></dt>
|
||||
<dt><strong><font color="#232B85"><?=$NFC_THIRD?></font> <font color="#DB2824"><?=$AFC_THIRD?></font></strong></dt>
|
||||
<dt><strong><font color="#232B85"><?=$NFC_FINAL?></font> <font color="#DB2824"><?=$AFC_FINAL?></font></strong></dt>
|
||||
</td>
|
||||
<td width="10%">
|
||||
<dt><?=$WIN_FIRST?>%</dt>
|
||||
<dt><?=$WIN_SECOND?>%</dt>
|
||||
<dt><?=$WIN_THIRD?>%</dt>
|
||||
<dt><?=$WIN_FINAL?>%</dt>
|
||||
<!-- <dt><?=$DONATION_FINAL?>%</dt> -->
|
||||
</td>
|
||||
<td width="10%" align="right" style="font-weight: 600px">
|
||||
<dt><strong>$<?=$FIRST?></strong></dt>
|
||||
<dt><strong>$<?=$SECOND?></strong></dt>
|
||||
<dt><strong>$<?=$THIRD?></strong></dt>
|
||||
<dt><strong>$<?=$FINAL?></strong></dt>
|
||||
<!-- <dt><strong>$<?=$DONATION?></strong></dt> -->
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<?php require "footer.inc"; ?>
|
||||
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
@ob_start();
|
||||
session_start();
|
||||
if (!$_SESSION['VNSB']) {
|
||||
?>
|
||||
<meta http-equiv="Refresh"content="0;url=adminlogin.php">
|
||||
<?php
|
||||
} else {
|
||||
|
||||
require_once('config.php');
|
||||
$RANDOM = $_REQUEST['randomnumber'];
|
||||
|
||||
require "header.inc";
|
||||
$sb_URL = $record['sb_URL'];
|
||||
|
||||
$LINKS = "
|
||||
<p>
|
||||
<table width=\"50%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"font-family: verdana, arial; font-size: 12px\">
|
||||
<tr>
|
||||
<td width=\"20%\" align=\"center\"><a href=\"$sb_URL\" title=\"Home\">Home</a></td>
|
||||
<td width=\"20%\" align=\"center\"><a href=\"./admin.php\" title=\"Administrator\">Admin</a></td>
|
||||
<td width=\"20%\" align=\"center\"><a href=\"report.php\" title=\"Admin logout\">Balance Sheet</a></td>
|
||||
<td width=\"20%\" align=\"center\"><a href=\"randomnumber.php\" title=\"Admin logout\">Number Generator</a></td>
|
||||
<td width=\"20%\" align=\"center\"><a href=\"scores.php\" title=\"Admin logout\">Scores</a></td>
|
||||
<td width=\"20%\" align=\"center\"><a href=\"adminlogout.php\" title=\"Admin logout\">Logout</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
";
|
||||
|
||||
echo "
|
||||
<h1>Numbers Assignment</h1>
|
||||
<p>To be fair, numbers selection is not allowed until all squares are purchased/selected.</p>
|
||||
<p>Numbers are only allowed to be entered once, either by randomly generated or manually entered.</p>
|
||||
<br/>
|
||||
";
|
||||
|
||||
// makesure all squares are selected
|
||||
$sql="SELECT * FROM VNSB_squares WHERE `NAME`='AVAILABLE'";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if ($record = mysqli_fetch_assoc($result)) {
|
||||
echo "<br><h2 style=\"color: #ff0000\">Squares are still available!!!</h2><br>";
|
||||
echo $LINKS;
|
||||
require "footer.inc";
|
||||
exit();
|
||||
}
|
||||
|
||||
// stop if numbers existed
|
||||
$sql="SELECT * FROM VNSB_numbers";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if ($record = mysqli_fetch_assoc($result)) {
|
||||
echo "<br><h2 style=\"color: #ff0000\">Numbers already exist!!!</h2><br>";
|
||||
echo $LINKS;
|
||||
require "footer.inc";
|
||||
exit();
|
||||
}
|
||||
|
||||
if (isset($RANDOM)) {
|
||||
//unset($RANDOM); // for testing
|
||||
$NFC = array();
|
||||
$AFC = array();
|
||||
echo "<p><b>Notify everyone via <a href=\"emailall.php\" title=\"Let them know nubmers are picked\">emails</a></b></p>";
|
||||
echo "<h3>RANDOMLY GENERATED NUMBERS</h3>";
|
||||
|
||||
for ($i=1; $i<=10; $i++) {
|
||||
while (1) {
|
||||
$duplicate = 0;
|
||||
$num=rand(0,9);
|
||||
for ($x=1; $x<$i; $x++) {
|
||||
if ($NFC[$x]==$num) { $duplicate = 1; }
|
||||
}
|
||||
|
||||
if ($duplicate==0) {
|
||||
$NFC[$i]=$num;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ($i=1; $i<=10; $i++) {
|
||||
while (1) {
|
||||
$duplicate = 0;
|
||||
$num=rand(0,9);
|
||||
for ($x=1; $x<$i; $x++) {
|
||||
if ($AFC[$x]==$num) { $duplicate = 1; }
|
||||
}
|
||||
|
||||
if ($duplicate==0) {
|
||||
$AFC[$i]=$num;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//show table for review
|
||||
echo "<table width=\"95%\" border=\"1\" cellspacing=\"1\" cellpadding=\"5\" style=\"font-family: Verdana,Ariel; font-size: 10px\">
|
||||
<tr>
|
||||
<td style=\"border-top: none; border-left: none\"> </td>";
|
||||
|
||||
for ($i=1; $i<=10; $i++) {
|
||||
echo "<td align=\"center\">".$NFC_TEAM." <font size=\"3\" color=\"blue\"><strong>".$NFC[$i]."</strong></font></td>";
|
||||
}
|
||||
echo "
|
||||
</tr>
|
||||
<tr>";
|
||||
|
||||
$sql="SELECT * FROM VNSB_squares ORDER BY SQUARE";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if (!$result) {
|
||||
echo mysqli_error();
|
||||
exit;
|
||||
}
|
||||
$cnt_row = 0;
|
||||
$i=0;
|
||||
while ($record = mysqli_fetch_assoc($result)) {
|
||||
if ($cnt_row==0) {$i++; echo"<td align='center'> $AFC_TEAM<br/><font size='3' color=\"red\"><strong>".$AFC[$i]."</strong></font> </td>";}
|
||||
if ($record['NAME'] == "AVAILABLE") {
|
||||
echo "<td width='10%' title='only $".$BET."'><a href=\"signup.php?square=".$record['SQUARE']."\">".stripslashes($record['NAME'])."<br/>".$record['SQUARE']."</a></td>";
|
||||
} else if ($record['NAME']!="AVAILABLE" && $record['CONFIRM']==1) {
|
||||
echo "<td width='10%' bgcolor='#99ff66' align='center' title=\"".$record['NOTES']."\"><strong>".stripslashes($record['NAME'])."</strong><br/>Confirmed</td>";
|
||||
} else {
|
||||
echo "<td width='10%' bgcolor='#ff9966' align='center' title=\"".$record['NOTES']."\"><strong>".stripslashes($record['NAME'])."</strong><br/>Pending</td>";
|
||||
}
|
||||
|
||||
$cnt_row++;
|
||||
if ($cnt_row==10) {
|
||||
$cnt_row=0;
|
||||
echo "</tr><tr>";
|
||||
}
|
||||
}
|
||||
echo "</table>";
|
||||
} else {
|
||||
?>
|
||||
|
||||
<form action="" method="post">
|
||||
<input type="submit" name="randomnumber" value="Random" title="Auto select numbers randomly"></input>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
// save to database
|
||||
if (isset($RANDOM)) {
|
||||
for ($n=1; $n<=10; $n++) {
|
||||
$sql="INSERT INTO VNSB_numbers (NFC, AFC) VALUES ('".$NFC[$n]."','".$AFC[$n]."')";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if (!$result) {
|
||||
echo mysqli_error();
|
||||
echo "<p>PROBLEM WRITING NUMBERS INTO DATABASE!</p>";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo $LINKS;
|
||||
require "footer.inc";
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
@ob_start();
|
||||
session_start();
|
||||
if (!$_SESSION['VNSB']) {
|
||||
?>
|
||||
<meta http-equiv="Refresh"content="0;url=adminlogin.php">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!--
|
||||
www.vnlisting.com
|
||||
Online Super Bowl Squares Script
|
||||
Please read the "Readme.txt for license agreement, installation and usage instructions
|
||||
Version: 4.3 1/29/2019
|
||||
-->
|
||||
|
||||
<?php
|
||||
require_once('config.php');
|
||||
|
||||
require "header.inc";
|
||||
|
||||
$square = $_POST['square'];
|
||||
//$name = $_POST['name'];
|
||||
$email = $_POST['email'];
|
||||
$notes = $_POST['body'];
|
||||
$comments = $_POST['notes'];
|
||||
$date = date("Y-m-d h:i:s");
|
||||
$confirm = $_POST['confirmation'];
|
||||
|
||||
|
||||
$sql = "SELECT main.name,main.notes as comments,main.email, bet * (count( unpaid.confirm ) + count( paid.confirm )) AS 'Total', bet * (count( paid.confirm )) AS 'Paid'
|
||||
FROM VNSB_settings, VNSB_squares main
|
||||
LEFT OUTER JOIN VNSB_squares unpaid ON unpaid.square = main.square AND unpaid.confirm =0
|
||||
LEFT OUTER JOIN VNSB_squares paid ON paid.square = main.square AND paid.confirm =1
|
||||
WHERE main.name <> 'AVAILABLE'
|
||||
GROUP BY main.email, comments
|
||||
ORDER BY main.email";
|
||||
|
||||
|
||||
$result = mysqli_query($conn,$sql);
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
//echo mysql_error();
|
||||
echo "<BR>Sorry, Technical problem occurred... Can't read from database.";
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<TABLE border=0 cellpadding=5>
|
||||
<?
|
||||
|
||||
$cnt_row = 0;
|
||||
|
||||
while ($record = mysqli_fetch_assoc($result))
|
||||
{
|
||||
if(($cnt_row % 2) == 0)
|
||||
{
|
||||
$color = "#DDDDDD";
|
||||
}
|
||||
else
|
||||
{
|
||||
$color = "#CCCCCC";
|
||||
}
|
||||
|
||||
if ($cnt_row==0)
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<td valign="top" align="center" bgcolor="#CCCCCC"><b><u>NAME</u></b></td>
|
||||
<td valign="top" align="center" bgcolor="#CCCCCC"><b><u>EMAIL</u></b></td>
|
||||
<td valign="top" align="center" bgcolor="#CCCCCC"><b><u>TOTAL DUE</u></b></td>
|
||||
<td valign="top" align="center" bgcolor="#CCCCCC"><b><u>TOTAL PAID</u></b></td>
|
||||
<td valign="top" align="center" bgcolor="#CCCCCC"><b><u>BALANCE</u></b></td>
|
||||
<td valign="top" align="center" bgcolor="#CCCCCC"><b><u>COMMENTS</u></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" bgcolor="#DDDDDD"><?=$record['name']?></td>
|
||||
<td valign="top" bgcolor="#DDDDDD"><?=$record['email']?></dt>
|
||||
<td valign="top" bgcolor="#DDDDDD">$<?=$record['Total']?>.00</td>
|
||||
<td valign="top" bgcolor="#DDDDDD">$<?=$record['Paid']?>.00</td>
|
||||
<td valign="top" bgcolor="#DDDDDD"><b>$<?=$record['Total']-$record['Paid']?>.00</b></td>
|
||||
<td valign="top" bgcolor="#DDDDDD"><b><?=$record['comments']?></b></td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<td valign="top" bgcolor=<?=$color?>><?=$record['name']?></td>
|
||||
<td valign="top" bgcolor=<?=$color?>><?=$record['email']?></td>
|
||||
<td valign="top" bgcolor=<?=$color?>>$<?=$record['Total']?>.00</td>
|
||||
<td valign="top" bgcolor=<?=$color?>>$<?=$record['Paid']?>.00</td>
|
||||
<td valign="top" bgcolor=<?=$color?>><b>$<?=$record['Total']-$record['Paid']?>.00</b></td>
|
||||
<td valign="top" bgcolor="#DDDDDD"><b><?=$record['comments']?></b></td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
$cnt_row++;
|
||||
}
|
||||
|
||||
?>
|
||||
</TABLE>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<table width="50%" border="0" cellspacing="0" cellpadding="0" style="font-family: verdana, arial; font-size: 12px">
|
||||
<tr>
|
||||
<td width="16%"><a href="<?=$sb_URL?>" title="Home">Home</a></td>
|
||||
<td width="16%" align="center"><a href="admin.php" title="Administrator">Admin</a></td>
|
||||
<td width="16%" align="center"><a href="report.php" title="Balance Sheet">Balance Sheet</a></td>
|
||||
<td width="16%" align="center"><a href="randomnumber.php" title="Number Generator">Number Generator</a></td>
|
||||
<td width="16%" align="center"><a href="scores.php" title="Enter scores">Scores</a></td>
|
||||
<td width="16%" align="center"><a href="adminlogout.php" title="Admin logout">Logout</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php require "footer.inc"; ?>
|
||||
@@ -0,0 +1,222 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 2.8.0.1
|
||||
-- http://www.phpmyadmin.net
|
||||
--
|
||||
-- Updated by: djsplice
|
||||
-- Date: 1-25-2024
|
||||
--
|
||||
-- Host: custsql-pow13
|
||||
-- Generation Time: Dec 13, 2013 at 12:59 AM
|
||||
-- Server version: 5.5.32
|
||||
-- PHP Version: 4.4.9
|
||||
--
|
||||
-- Database: `superbowl`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `VNSB_numbers`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `VNSB_numbers`;
|
||||
CREATE TABLE IF NOT EXISTS `VNSB_numbers` (
|
||||
`NFC` tinyint(2) DEFAULT NULL,
|
||||
`AFC` tinyint(2) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Randomly picked numbers';
|
||||
|
||||
--
|
||||
-- Dumping data for table `VNSB_numbers`
|
||||
--
|
||||
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `VNSB_scores`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `VNSB_scores`;
|
||||
CREATE TABLE IF NOT EXISTS `VNSB_scores` (
|
||||
`ID` tinyint(2) NOT NULL,
|
||||
`NFC_FIRST` tinyint(2) DEFAULT NULL,
|
||||
`AFC_FIRST` tinyint(2) DEFAULT NULL,
|
||||
`NFC_HALF` tinyint(2) DEFAULT NULL,
|
||||
`AFC_HALF` tinyint(2) DEFAULT NULL,
|
||||
`NFC_THIRD` tinyint(2) DEFAULT NULL,
|
||||
`AFC_THIRD` tinyint(2) DEFAULT NULL,
|
||||
`NFC_FINAL` tinyint(2) DEFAULT NULL,
|
||||
`AFC_FINAL` tinyint(2) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
--
|
||||
-- Dumping data for table `VNSB_scores`
|
||||
--
|
||||
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `VNSB_settings`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `VNSB_settings`;
|
||||
CREATE TABLE IF NOT EXISTS `VNSB_settings` (
|
||||
`sb_title` varchar(26) NOT NULL COMMENT 'Title of Superbowl Squares',
|
||||
`commissioner` varchar(26) NULL COMMENT 'Name of commissioner (ie. Event Commissioner',
|
||||
`sb_event` varchar(26) NULL COMMENT 'Name of Event (ie. Superbowl LII)',
|
||||
`sb_date` varchar(30) NOT NULL DEFAULT '' COMMENT 'Date of Event/Game',
|
||||
`sb_time` varchar(8) NULL COMMENT 'Time of Event/Game',
|
||||
`sb_logo` varchar(30) DEFAULT NULL COMMENT 'Official logo of event',
|
||||
`NFC_team` varchar(30) DEFAULT NULL COMMENT 'NFC team name',
|
||||
`NFC_logo` varchar(30) DEFAULT NULL COMMENT 'NFC team logo',
|
||||
`AFC_team` varchar(30) DEFAULT NULL COMMENT 'AFC team name',
|
||||
`AFC_logo` varchar(30) DEFAULT NULL COMMENT 'AFC team logo',
|
||||
`Bet` varchar(5) NOT NULL DEFAULT '5.00' COMMENT 'Dollar amount per square',
|
||||
`Win_first` tinyint(2) NOT NULL DEFAULT '20' COMMENT 'Percent that goes to winner of 1st quarter',
|
||||
`Win_second` tinyint(2) NOT NULL DEFAULT '25' COMMENT 'Percent that goes to winner of 2nd quarter',
|
||||
`Win_third` tinyint(2) NOT NULL DEFAULT '20' COMMENT 'Percent that goes to winner of 3rd quarter',
|
||||
`Win_final` tinyint(2) NOT NULL DEFAULT '35' COMMENT 'Percent that goes to winner of final score',
|
||||
`Donation_Final` tinyint(2) NOT NULL DEFAULT '0' COMMENT 'Percent that will go to the charity/donation. This can be 0',
|
||||
`Version` char(3) NOT NULL DEFAULT '',
|
||||
`Admin_email` varchar(30) NOT NULL DEFAULT 'admin@email.com' COMMENT 'Admin login email',
|
||||
`Admin_pwd` varchar(8) NOT NULL DEFAULT 'password' COMMENT 'Admin login password',
|
||||
`Grace` int(11) DEFAULT NULL COMMENT 'Grace period for payment in hours',
|
||||
`Venmo` varchar(20) DEFAULT NULL COMMENT 'Venmo address. Start with ''@''',
|
||||
`PayPal` varchar(50) DEFAULT NULL COMMENT 'PayPal link or email address',
|
||||
`CashApp` varchar(50) DEFAULT NULL COMMENT 'CashApp address. Start with ''$''',
|
||||
`Zelle` varchar(50) DEFAULT NULL COMMENT 'Zelle contact address (phone or email)',
|
||||
PRIMARY KEY (`sb_date`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Setting for VN SuperBowl Squares';
|
||||
|
||||
--
|
||||
-- Dumping data for table `VNSB_settings`
|
||||
--
|
||||
|
||||
INSERT INTO `VNSB_settings` VALUES ('Host Name', 'Commissioner Name', 'Superbowl LVIII', 'Sunday February 11, 2024', '3:30 PM', 'superbowlnumber.png', 'NFC Team', 'nfc-generic.png', 'AFC Team', 'afc-generic.png', '5.00', 20, 25, 20, 35, 0, '5.1', 'admin@yourdomain.com', 'password', 24, '@venmo', 'paypal@email.com', '$cashapp', 'zelle@email.com');
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `VNSB_squares`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `VNSB_squares`;
|
||||
CREATE TABLE IF NOT EXISTS `VNSB_squares` (
|
||||
`SQUARE` varchar(15) NOT NULL DEFAULT '',
|
||||
`NAME` varchar(30) NOT NULL DEFAULT 'AVAILABLE',
|
||||
`EMAIL` varchar(45) DEFAULT NULL,
|
||||
`NOTES` text,
|
||||
`DATE` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`CONFIRM` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`FIRST` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`HALF` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`THIRD` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`FINAL` tinyint(1) NOT NULL DEFAULT '0',
|
||||
UNIQUE KEY `SQUARE` (`SQUARE`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Super Bowl Squares';
|
||||
|
||||
--
|
||||
-- Dumping data for table `VNSB_squares`
|
||||
--
|
||||
|
||||
INSERT INTO `VNSB_squares` VALUES ('00', 'AVAILABLE', NULL, NULL, '2013-01-14 01:56:43', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('01', 'AVAILABLE', NULL, NULL, '2013-01-15 12:10:16', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('02', 'AVAILABLE', NULL, NULL, '2013-01-09 11:53:47', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('03', 'AVAILABLE', NULL, NULL, '2013-01-15 08:41:10', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('04', 'AVAILABLE', NULL, NULL, '2013-01-14 01:52:22', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('05', 'AVAILABLE', NULL, NULL, '2013-01-08 12:45:49', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('06', 'AVAILABLE', NULL, NULL, '2013-01-21 12:38:27', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('07', 'AVAILABLE', NULL, NULL, '2013-01-18 02:49:41', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('08', 'AVAILABLE', NULL, NULL, '2013-01-14 01:23:21', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('09', 'AVAILABLE', NULL, NULL, '2013-01-14 02:30:08', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('10', 'AVAILABLE', NULL, NULL, '2013-01-08 12:58:53', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('11', 'AVAILABLE', NULL, NULL, '2013-01-08 04:34:09', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('12', 'AVAILABLE', NULL, NULL, '2013-01-08 03:53:14', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('13', 'AVAILABLE', NULL, NULL, '2013-01-14 04:26:08', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('14', 'AVAILABLE', NULL, NULL, '2013-01-20 10:03:29', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('15', 'AVAILABLE', NULL, NULL, '2013-01-13 02:31:36', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('16', 'AVAILABLE', NULL, NULL, '2013-01-14 02:18:40', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('17', 'AVAILABLE', NULL, NULL, '2013-01-14 01:36:04', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('18', 'AVAILABLE', NULL, NULL, '2013-01-14 08:48:40', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('19', 'AVAILABLE', NULL, NULL, '2013-01-20 07:02:59', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('20', 'AVAILABLE', NULL, NULL, '2013-01-15 08:41:10', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('21', 'AVAILABLE', NULL, NULL, '2013-01-08 12:45:49', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('22', 'AVAILABLE', NULL, NULL, '2013-01-09 11:53:47', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('23', 'AVAILABLE', NULL, NULL, '2013-01-08 03:53:33', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('24', 'AVAILABLE', NULL, NULL, '2013-01-08 12:58:53', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('25', 'AVAILABLE', NULL, NULL, '2013-01-20 10:03:50', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('26', 'AVAILABLE', NULL, NULL, '2013-01-16 07:36:01', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('27', 'AVAILABLE', NULL, NULL, '2013-01-08 12:45:49', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('28', 'AVAILABLE', NULL, NULL, '2013-01-18 03:16:41', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('29', 'AVAILABLE', NULL, NULL, '2013-01-20 08:44:30', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('30', 'AVAILABLE', NULL, NULL, '2013-01-22 02:21:03', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('31', 'AVAILABLE', NULL, NULL, '2013-01-22 02:21:03', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('32', 'AVAILABLE', NULL, NULL, '2013-01-13 02:31:36', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('33', 'AVAILABLE', NULL, NULL, '2013-01-08 04:34:09', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('34', 'AVAILABLE', NULL, NULL, '2013-01-15 12:10:16', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('35', 'AVAILABLE', NULL, NULL, '2013-01-14 02:30:08', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('36', 'AVAILABLE', NULL, NULL, '2013-01-20 10:04:10', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('37', 'AVAILABLE', NULL, NULL, '2013-01-15 12:25:05', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('38', 'AVAILABLE', NULL, NULL, '2013-01-20 10:46:57', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('39', 'AVAILABLE', NULL, NULL, '2013-01-14 04:04:01', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('40', 'AVAILABLE', NULL, NULL, '2013-01-14 01:52:22', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('41', 'AVAILABLE', NULL, NULL, '2013-01-15 08:41:10', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('42', 'AVAILABLE', NULL, NULL, '2013-01-14 02:18:40', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('43', 'AVAILABLE', NULL, NULL, '2013-01-14 02:30:08', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('44', 'AVAILABLE', NULL, NULL, '2013-01-11 07:25:05', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('45', 'AVAILABLE', NULL, NULL, '2013-01-14 01:36:40', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('46', 'AVAILABLE', NULL, NULL, '2013-01-08 02:11:23', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('47', 'AVAILABLE', NULL, NULL, '2013-01-14 01:56:43', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('48', 'AVAILABLE', NULL, NULL, '2013-01-14 04:26:08', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('49', 'AVAILABLE', NULL, NULL, '2013-01-14 01:52:22', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('50', 'AVAILABLE', NULL, NULL, '2013-01-20 07:02:59', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('51', 'AVAILABLE', NULL, NULL, '2013-01-20 08:32:44', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('52', 'AVAILABLE', NULL, NULL, '2013-01-15 12:10:16', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('53', 'AVAILABLE', NULL, NULL, '2013-01-15 10:03:13', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('54', 'AVAILABLE', NULL, NULL, '2013-01-14 01:36:40', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('55', 'AVAILABLE', NULL, NULL, '2013-01-11 07:25:05', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('56', 'AVAILABLE', NULL, NULL, '2013-01-15 12:10:16', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('57', 'AVAILABLE', NULL, NULL, '2013-01-21 12:39:03', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('58', 'AVAILABLE', NULL, NULL, '2013-01-21 09:11:27', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('59', 'AVAILABLE', NULL, NULL, '2013-01-18 03:16:41', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('60', 'AVAILABLE', NULL, NULL, '2013-01-14 02:30:08', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('61', 'AVAILABLE', NULL, NULL, '2013-01-22 02:21:03', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('62', 'AVAILABLE', NULL, NULL, '2013-01-08 12:58:53', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('63', 'AVAILABLE', NULL, NULL, '2013-01-14 01:36:40', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('64', 'AVAILABLE', NULL, NULL, '2013-01-14 04:08:24', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('65', 'AVAILABLE', NULL, NULL, '2013-01-15 10:03:13', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('66', 'AVAILABLE', NULL, NULL, '2013-01-08 03:53:58', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('67', 'AVAILABLE', NULL, NULL, '2013-01-15 08:41:10', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('68', 'AVAILABLE', NULL, NULL, '2013-01-08 12:58:53', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('69', 'AVAILABLE', NULL, NULL, '2013-01-18 02:49:41', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('70', 'AVAILABLE', NULL, NULL, '2013-01-15 12:25:05', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('71', 'AVAILABLE', NULL, NULL, '2013-01-21 12:37:39', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('72', 'AVAILABLE', NULL, NULL, '2013-01-14 01:36:40', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('73', 'AVAILABLE', NULL, NULL, '2013-01-08 02:11:23', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('74', 'AVAILABLE', NULL, NULL, '2013-01-16 07:36:01', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('75', 'AVAILABLE', NULL, NULL, '2013-01-14 04:04:01', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('76', 'AVAILABLE', NULL, NULL, '2013-01-18 03:16:41', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('77', 'AVAILABLE', NULL, NULL, '2013-01-08 03:54:15', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('78', 'AVAILABLE', NULL, NULL, '2013-01-20 10:46:57', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('79', 'AVAILABLE', NULL, NULL, '2013-01-08 07:00:57', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('80', 'AVAILABLE', NULL, NULL, '2013-01-14 01:23:21', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('81', 'AVAILABLE', NULL, NULL, '2013-01-14 04:26:08', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('82', 'AVAILABLE', NULL, NULL, '2013-01-21 12:36:55', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('83', 'AVAILABLE', NULL, NULL, '2013-01-18 03:16:41', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('84', 'AVAILABLE', NULL, NULL, '2013-01-20 08:32:44', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('85', 'AVAILABLE', NULL, NULL, '2013-01-20 08:44:30', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('86', 'AVAILABLE', NULL, NULL, '2013-01-18 02:49:41', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('87', 'AVAILABLE', NULL, NULL, '2013-01-20 07:02:59', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('88', 'AVAILABLE', NULL, NULL, '2013-01-08 03:54:33', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('89', 'AVAILABLE', NULL, NULL, '2013-01-15 12:10:16', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('90', 'AVAILABLE', NULL, NULL, '2013-01-09 11:53:47', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('91', 'AVAILABLE', NULL, NULL, '2013-01-14 08:48:40', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('92', 'AVAILABLE', NULL, NULL, '2013-01-14 04:04:01', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('93', 'AVAILABLE', NULL, NULL, '2013-01-20 07:02:59', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('94', 'AVAILABLE', NULL, NULL, '2013-01-14 01:52:22', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('95', 'AVAILABLE', NULL, NULL, '2013-01-14 01:36:04', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('96', 'AVAILABLE', NULL, NULL, '2013-01-14 04:26:08', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('97', 'AVAILABLE', NULL, NULL, '2013-01-15 08:41:10', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('98', 'AVAILABLE', NULL, NULL, '2013-01-15 12:10:16', 0, 0, 0, 0, 0);
|
||||
INSERT INTO `VNSB_squares` VALUES ('99', 'AVAILABLE', NULL, NULL, '2013-01-14 02:30:08', 0, 0, 0, 0, 0);
|
||||
@@ -0,0 +1,254 @@
|
||||
<?php
|
||||
// Start session at the very beginning
|
||||
session_start();
|
||||
|
||||
// Check if the session variable exists
|
||||
if (!isset($_SESSION['VNSB']) || empty($_SESSION['VNSB'])) {
|
||||
// Redirect to login page
|
||||
header("Location: adminlogin.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
// Function to send email notifications
|
||||
function email_notify($mailto) {
|
||||
global $ADMIN_EMAIL, $SB_DATE;
|
||||
|
||||
$mail_headers = "From: $ADMIN_EMAIL\r\n";
|
||||
$mail_subject = "Super Bowl Squares :: You are the winner";
|
||||
$mailmessage = "\r\nCongratulations\r\n";
|
||||
$mailmessage .= "You are the lucky winner for our Super Bowl Squares for $SB_DATE \r\n\n";
|
||||
$mailmessage .= "Contact us to collect your winning.\r\n";
|
||||
$mailmessage .= "The Commissioner\r\n";
|
||||
|
||||
mail($mailto, $mail_subject, $mailmessage, $mail_headers);
|
||||
}
|
||||
|
||||
// Include configuration and header files
|
||||
require_once 'config.php';
|
||||
require 'header.inc';
|
||||
|
||||
// Initialize arrays
|
||||
$NFC = [];
|
||||
$AFC = [];
|
||||
$NAME = [];
|
||||
$EMAIL = [];
|
||||
|
||||
// Process form data
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['addscores'])) {
|
||||
$NFC_1 = $_POST['NFC_1'] ?? '';
|
||||
$NFC_2 = $_POST['NFC_2'] ?? '';
|
||||
$NFC_3 = $_POST['NFC_3'] ?? '';
|
||||
$NFC_4 = $_POST['NFC_4'] ?? '';
|
||||
$AFC_1 = $_POST['AFC_1'] ?? '';
|
||||
$AFC_2 = $_POST['AFC_2'] ?? '';
|
||||
$AFC_3 = $_POST['AFC_3'] ?? '';
|
||||
$AFC_4 = $_POST['AFC_4'] ?? '';
|
||||
|
||||
// Insert scores into the database
|
||||
$sql = "INSERT INTO `VNSB_scores` VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
$stmt = mysqli_prepare($conn, $sql);
|
||||
mysqli_stmt_bind_param($stmt, 'ssssssss', $NFC_1, $AFC_1, $NFC_2, $AFC_2, $NFC_3, $AFC_3, $NFC_4, $AFC_4);
|
||||
if (!mysqli_stmt_execute($stmt)) {
|
||||
echo "<p>Sorry, a technical problem occurred. Scores were not added.</p>" . mysqli_error($conn);
|
||||
}
|
||||
mysqli_stmt_close($stmt);
|
||||
}
|
||||
|
||||
// Fetch the latest scores
|
||||
$sql = "SELECT * FROM `VNSB_scores` ORDER BY ID DESC LIMIT 1";
|
||||
$result = mysqli_query($conn, $sql);
|
||||
if (!$result) {
|
||||
die("ERROR: Unable to read record from 'VNSB_scores'!<br>" . mysqli_error($conn));
|
||||
}
|
||||
|
||||
$scores = mysqli_fetch_assoc($result);
|
||||
$NFC_FIRST = $scores['NFC_FIRST'] ?? '';
|
||||
$AFC_FIRST = $scores['AFC_FIRST'] ?? '';
|
||||
$NFC_HALF = $scores['NFC_HALF'] ?? '';
|
||||
$AFC_HALF = $scores['AFC_HALF'] ?? '';
|
||||
$NFC_THIRD = $scores['NFC_THIRD'] ?? '';
|
||||
$AFC_THIRD = $scores['AFC_THIRD'] ?? '';
|
||||
$NFC_FINAL = $scores['NFC_FINAL'] ?? '';
|
||||
$AFC_FINAL = $scores['AFC_FINAL'] ?? '';
|
||||
|
||||
$ADD_SCORES = ($NFC_FINAL === NULL || $AFC_FINAL === NULL) ? 1 : 0;
|
||||
|
||||
// Fetch assigned numbers
|
||||
$sql = "SELECT * FROM VNSB_numbers";
|
||||
$result = mysqli_query($conn, $sql);
|
||||
if (!$result) {
|
||||
die("ERROR: Unable to read records from 'VNSB_numbers'!<br>" . mysqli_error($conn));
|
||||
}
|
||||
|
||||
$cnt = 0;
|
||||
while ($record = mysqli_fetch_assoc($result)) {
|
||||
$cnt++;
|
||||
$NFC[$cnt] = $record['NFC'];
|
||||
$AFC[$cnt] = $record['AFC'];
|
||||
}
|
||||
|
||||
// Fetch names for each square
|
||||
$sql = "SELECT * FROM VNSB_squares";
|
||||
$result = mysqli_query($conn, $sql);
|
||||
if (!$result) {
|
||||
die("ERROR: Unable to read records from 'VNSB_squares'!<br>" . mysqli_error($conn));
|
||||
}
|
||||
|
||||
while ($record = mysqli_fetch_assoc($result)) {
|
||||
$NAME[$record['SQUARE']] = $record['NAME'];
|
||||
$EMAIL[$record['SQUARE']] = $record['EMAIL'];
|
||||
}
|
||||
|
||||
// Display the form for adding scores
|
||||
if ($ADD_SCORES) {
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<table width="" cellpadding="0" cellspacing="10" style="font-family: Verdana,Ariel; font-size: 12px">
|
||||
<tr>
|
||||
<td align="center" colspan="5" style="font-weight:bold;">QUARTERLY SCORES</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" valign="bottom" style="color:#232b85; font-weight:bold"><?= htmlspecialchars($NFC_TEAM) ?></td>
|
||||
<td align="center" style="font-weight:bold;">First<br>
|
||||
<input type="text" name="NFC_1" size="5" maxlength="2" value="<?= htmlspecialchars($NFC_FIRST) ?>">
|
||||
</td>
|
||||
<td align="center" style="font-weight:bold;">Half<br>
|
||||
<input type="text" name="NFC_2" size="5" maxlength="2" value="<?= htmlspecialchars($NFC_HALF) ?>">
|
||||
</td>
|
||||
<td align="center" style="font-weight:bold;">Third<br>
|
||||
<input type="text" name="NFC_3" size="5" maxlength="2" value="<?= htmlspecialchars($NFC_THIRD) ?>">
|
||||
</td>
|
||||
<td align="center" style="font-weight:bold;">Final<br>
|
||||
<input type="text" name="NFC_4" size="5" maxlength="2" value="<?= htmlspecialchars($NFC_FINAL) ?>">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" style="color:#db2824; font-weight:bold"><?= htmlspecialchars($AFC_TEAM) ?></td>
|
||||
<td style="font-weight:bold;"><input type="text" name="AFC_1" size="5" maxlength="2" value="<?= htmlspecialchars($AFC_FIRST) ?>"></td>
|
||||
<td style="font-weight:bold;"><input type="text" name="AFC_2" size="5" maxlength="2" value="<?= htmlspecialchars($AFC_HALF) ?>"></td>
|
||||
<td style="font-weight:bold;"><input type="text" name="AFC_3" size="5" maxlength="2" value="<?= htmlspecialchars($AFC_THIRD) ?>"></td>
|
||||
<td style="font-weight:bold;"><input type="text" name="AFC_4" size="5" maxlength="2" value="<?= htmlspecialchars($AFC_FINAL) ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" colspan="5">
|
||||
<input type="submit" name="addscores" value="Submit">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
// Fetch settings
|
||||
$sql = "SELECT * FROM VNSB_settings";
|
||||
$result = mysqli_query($conn, $sql);
|
||||
if ($record = mysqli_fetch_assoc($result)) {
|
||||
$BET = $record['Bet'];
|
||||
$WIN_FIRST = $record['Win_first'];
|
||||
$WIN_SECOND = $record['Win_second'];
|
||||
$WIN_THIRD = $record['Win_third'];
|
||||
$WIN_FINAL = $record['Win_final'];
|
||||
$FIRST = (100 * (int)$BET) * ((int)$WIN_FIRST / 100);
|
||||
$SECOND = (100 * (int)$BET) * ((int)$WIN_SECOND / 100);
|
||||
$THIRD = (100 * (int)$BET) * ((int)$WIN_THIRD / 100);
|
||||
$FINAL = (100 * (int)$BET) * ((int)$WIN_FINAL / 100);
|
||||
} else {
|
||||
echo mysqli_error($conn);
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Display payout table -->
|
||||
<table width="50%" style="font-family: Verdana,Ariel; font-size: 12px; border: #009900 1px solid">
|
||||
<tr>
|
||||
<td colspan="4" align="center"><strong>The Payout:</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<li>End of first quarter: </li>
|
||||
<li>End of second quarter: </li>
|
||||
<li>End of third quarter: </li>
|
||||
<li>Final Score: </li>
|
||||
</td>
|
||||
<td>
|
||||
<dt><strong><font color="#232B85"><?= htmlspecialchars($NFC_FIRST) ?></font> <font color="#DB2824"><?= htmlspecialchars($AFC_FIRST) ?></font></strong></dt>
|
||||
<dt><strong><font color="#232B85"><?= htmlspecialchars($NFC_HALF) ?></font> <font color="#DB2824"><?= htmlspecialchars($AFC_HALF) ?></font></strong></dt>
|
||||
<dt><strong><font color="#232B85"><?= htmlspecialchars($NFC_THIRD) ?></font> <font color="#DB2824"><?= htmlspecialchars($AFC_THIRD) ?></font></strong></dt>
|
||||
<dt><strong><font color="#232B85"><?= htmlspecialchars($NFC_FINAL) ?></font> <font color="#DB2824"><?= htmlspecialchars($AFC_FINAL) ?></font></strong></dt>
|
||||
</td>
|
||||
<td>
|
||||
<dt><?= htmlspecialchars($WIN_FIRST) ?>%</dt>
|
||||
<dt><?= htmlspecialchars($WIN_SECOND) ?>%</dt>
|
||||
<dt><?= htmlspecialchars($WIN_THIRD) ?>%</dt>
|
||||
<dt><?= htmlspecialchars($WIN_FINAL) ?>%</dt>
|
||||
</td>
|
||||
<td width="15%" align="right" style="font-weight: 600px">
|
||||
<dt><strong>$<?= htmlspecialchars($FIRST) ?></strong></dt>
|
||||
<dt><strong>$<?= htmlspecialchars($SECOND) ?></strong></dt>
|
||||
<dt><strong>$<?= htmlspecialchars($THIRD) ?></strong></dt>
|
||||
<dt><strong>$<?= htmlspecialchars($FINAL) ?></strong></dt>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- Notify winners -->
|
||||
<p>
|
||||
<a href="<?= htmlspecialchars($_SERVER['REQUEST_URI']) ?>?m=yes">Email Winners</a>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
// Notify winners logic
|
||||
if (isset($_GET['m']) && $_GET['m'] === 'yes') {
|
||||
$cnt = 0;
|
||||
for ($y = 1; $y <= 10; $y++) {
|
||||
for ($x = 1; $x <= 10; $x++) {
|
||||
$square = ($cnt < 10) ? "0$cnt" : $cnt;
|
||||
if (($NFC[$x] == substr($NFC_FIRST, -1)) && ($AFC[$y] == substr($AFC_FIRST, -1)) && ($NFC_FIRST && $AFC_FIRST)) {
|
||||
echo "<p>1st Quarter Winner ($NFC[$x],$AFC[$y]) Square #$square (" . htmlspecialchars($NAME[$square]) . ")</p>";
|
||||
mysqli_query($conn, "UPDATE VNSB_squares SET FIRST='1' WHERE SQUARE='$square' LIMIT 1");
|
||||
if ($_GET['m'] === 'yes') {
|
||||
email_notify($EMAIL[$square]);
|
||||
}
|
||||
}
|
||||
if (($NFC[$x] == substr($NFC_HALF, -1)) && ($AFC[$y] == substr($AFC_HALF, -1)) && ($NFC_HALF && $AFC_HALF)) {
|
||||
echo "<p>Halftime Winner ($NFC[$x],$AFC[$y]) Square #$square (" . htmlspecialchars($NAME[$square]) . ")</p>";
|
||||
mysqli_query($conn, "UPDATE VNSB_squares SET HALF='1' WHERE SQUARE='$square' LIMIT 1");
|
||||
if ($_GET['m'] === 'yes') {
|
||||
email_notify($EMAIL[$square]);
|
||||
}
|
||||
}
|
||||
if (($NFC[$x] == substr($NFC_THIRD, -1)) && ($AFC[$y] == substr($AFC_THIRD, -1)) && ($NFC_THIRD && $AFC_THIRD)) {
|
||||
echo "<p>3rd Quarter Winner ($NFC[$x],$AFC[$y]) Square #$square (" . htmlspecialchars($NAME[$square]) . ")</p>";
|
||||
mysqli_query($conn, "UPDATE VNSB_squares SET THIRD='1' WHERE SQUARE='$square' LIMIT 1");
|
||||
if ($_GET['m'] === 'yes') {
|
||||
email_notify($EMAIL[$square]);
|
||||
}
|
||||
}
|
||||
if (($NFC[$x] == substr($NFC_FINAL, -1)) && ($AFC[$y] == substr($AFC_FINAL, -1)) && ($NFC_FINAL && $AFC_FINAL)) {
|
||||
echo "<p>Final Winner ($NFC[$x],$AFC[$y]) Square #$square (" . htmlspecialchars($NAME[$square]) . ")</p>";
|
||||
mysqli_query($conn, "UPDATE VNSB_squares SET FINAL='1' WHERE SQUARE='$square' LIMIT 1");
|
||||
if ($_GET['m'] === 'yes') {
|
||||
email_notify($EMAIL[$square]);
|
||||
}
|
||||
}
|
||||
$cnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Footer links -->
|
||||
<p><br><br>
|
||||
<table width="50%" border="0" cellspacing="0" cellpadding="0" style="font-family: verdana, arial; font-size: 12px">
|
||||
<tr>
|
||||
<td width="16%"><a href="<?= htmlspecialchars($superbowlURL) ?>" title="Home">Home</a></td>
|
||||
<td width="16%" align="center"><a href="admin.php" title="Administrator">Admin</a></td>
|
||||
<td width="16%" align="center"><a href="report.php" title="Balance Sheet">Balance Sheet</a></td>
|
||||
<td width="16%" align="center"><a href="randomnumber.php" title="Number Generator">Number Generator</a></td>
|
||||
<td width="16%" align="center"><a href="scores.php" title="Enter scores">Scores</a></td>
|
||||
<td width="16%" align="center"><a href="adminlogout.php" title="Admin logout">Logout</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<?php require "footer.inc"; ?>
|
||||
@@ -0,0 +1,67 @@
|
||||
<!--
|
||||
www.vnlisting.com
|
||||
Online Super Bowl Squares Script
|
||||
Please read the "Readme.txt for license agreement, installation and usage instructions
|
||||
-->
|
||||
|
||||
<?php
|
||||
require_once('config.php');
|
||||
require "header.inc";
|
||||
|
||||
$sb_URL = $record['sb_URL'];
|
||||
$commissioner = $record['commissioner'];
|
||||
$Admin_email = $record['Admin_email'];
|
||||
$Grace = $record['Grace'];
|
||||
?>
|
||||
|
||||
<h3>SQUARE SELECTION</h3>
|
||||
<table width="50%" cellpadding="5" style="font-family: verdana, arial; border: #FFCC99 1px solid">
|
||||
<tr>
|
||||
<td width="" align="center" valign="top" style="font-size: 11px">
|
||||
<h2><strong>You are signing up for square(s): <font color="#ff0000">
|
||||
<form name="signup" action="thankyou.php" method="post">
|
||||
<?php
|
||||
if ( isset($_REQUEST['sqSelect_Submit']) ) {
|
||||
$SQ=0;
|
||||
$SQcount = 100;
|
||||
for ($i=0;$i<$SQcount;$i++) {
|
||||
if ($i<10) { $SQarray[$i] = $_POST["sqNum_0$i"]; }
|
||||
else { $SQarray[$i] = $_POST["sqNum_$i"]; }
|
||||
if ( isset($SQarray[$i]) ) {
|
||||
$SQ++;
|
||||
echo $SQarray[$i]." ";
|
||||
echo ('<input type="hidden" name="square_'.$SQ.'" value="'.$SQarray[$i].'">');
|
||||
echo ('<input type="hidden" name="sqTotal" value="'.$SQ.'">');
|
||||
if ( $SQ == 10 ) { echo "<p>Maximum of 10 Squares per selection</p>"; break; } // limit to 10
|
||||
}
|
||||
}
|
||||
|
||||
if ( $SQ==0 ) {
|
||||
echo "<p style=\"font-size:12px; color:#000000\">You must select at least one square to continue!</p>";
|
||||
echo "<p><a href=\"".$sb_URL."\" title=\"Online Superbowl Squares\">Home</a></p>";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?>
|
||||
</font></strong></h2>
|
||||
<!--<h2><strong>You are signing up for square(s): <font color="#ff0000"><?=$square_select?></font></strong></h2>-->
|
||||
<!--<form name="signup" action="thankyou.php" method="post">-->
|
||||
<p><b>Full Name</b> <br/><input type=text name="realname" size="30" value=""></p>
|
||||
<p><b>Email</b><br/><input type=text name="email" size="30" maxlength="45" value=""></p>
|
||||
<p><b>Note to the Commissioner:</b><br/>
|
||||
<textarea name="body" rows="1" cols="60" wrap="virtual" style="font-family: verdana, arial; font-size: 10px"></textarea>
|
||||
</p>
|
||||
<p>You have <?=$Grace?> hours to make your payment or your square may be released.<br/>
|
||||
Please make payment to <?=$commissioner?> via the defined methods in the Rules section or contact <?=$Admin_email?><br/>
|
||||
<input type="submit" value="Submit"></p>
|
||||
|
||||
<!--<input type="hidden" name="square" value="<?=$square_select?>">-->
|
||||
<input type="hidden" name="confirmation" value="0"></input>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p style="font-family: verdana, arial; font-size: 12px">
|
||||
<a href="<?=$sb_URL?>" title="Online Superbowl Squares">Home</a>
|
||||
</p>
|
||||
<?php require "footer.inc"; ?>
|
||||
@@ -0,0 +1,142 @@
|
||||
<!--
|
||||
www.vnlisting.com
|
||||
Online Super Bowl Squares Script
|
||||
Please read the "Readme.txt for license agreement, installation and usage instructions
|
||||
-->
|
||||
|
||||
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
require_once('config.php');
|
||||
require "header.inc";
|
||||
|
||||
//$square = $_POST['square'];
|
||||
$sqTotal = $_POST["sqTotal"];
|
||||
for ($i=1;$i<=$sqTotal;$i++) {
|
||||
$sqSelect[$i] = $_POST["square_$i"];
|
||||
//echo $sqSelect[$i];
|
||||
}
|
||||
|
||||
$name = $_POST['realname'];
|
||||
$email = $_POST['email'];
|
||||
$Bet = $record['Bet'];
|
||||
$notes = $_POST['body'];
|
||||
$date = date("Y-m-d h:i:s");
|
||||
$confirm = $_POST['confirmation'];
|
||||
$sb_URL = $record['sb_URL'];
|
||||
$commissioner = $record['commissioner'];
|
||||
$Grace = $record['Grace'];
|
||||
$Zelle = $record['Zelle'];
|
||||
$PayPal = $record['PayPal'];
|
||||
$Venmo = $record['Venmo'];
|
||||
$CashApp = $record['CashApp'];
|
||||
|
||||
for ($i=1;$i<=$sqTotal;$i++) {
|
||||
$sql="SELECT * FROM VNSB_squares WHERE SQUARE='".$sqSelect[$i]."'";
|
||||
$result = mysqli_query($conn,$sql);
|
||||
if (!$result) {
|
||||
//echo mysql_error();
|
||||
echo "\n\n\t***** Invalid square selected *****\n\n";
|
||||
echo "<a href='javascript:onClick=history.go(-2);'>Back</a>";
|
||||
exit;
|
||||
} else {
|
||||
$record = mysqli_fetch_assoc($result);
|
||||
}
|
||||
}
|
||||
//continue only if the square is available
|
||||
if ($record['DATE'] == "0000-00-00 00:00:00") {
|
||||
|
||||
|
||||
//check for required fields
|
||||
for ($i=1;$i<=$sqTotal;$i++) {
|
||||
if (($sqSelect[$i] >= 00 OR $sqSelect[$i] < 100) AND $name != '' AND $email != '') {
|
||||
|
||||
$sql="UPDATE VNSB_squares SET NAME='".$name."', EMAIL='".$email."', NOTES='".$notes."', DATE='".$date."', CONFIRM='".$confirm."' WHERE SQUARE='".$sqSelect[$i]."' LIMIT 1";
|
||||
$result = mysqli_query($conn, $sql);
|
||||
if (!$result) {
|
||||
echo mysqli_error();
|
||||
echo "<BR>Sorry, Technical problem occurred... your selection was not added.<br><br> Email this problem to <a href=\"mailto:".$ADMIN_EMAIL."\">".$ADMIN_EMAIL."</a>";
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
echo "<p align='center'><br/><font color='#ff0000', size='3'>Required fields are missing!</font><br/><br/><a href='javascript:onClick=history.go(-1);'>Back</a></p>";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//email
|
||||
$headers = "From: $commissioner <$ADMIN_EMAIL>\r\nBcc: $commissioner <$ADMIN_EMAIL>\r\n";
|
||||
function notify_admin ($mailto, $mailmessage, $mail_headers)
|
||||
{
|
||||
mail("$mailto", "Super Bowl Squares", "$mailmessage", "$mail_headers");
|
||||
}
|
||||
|
||||
$selectedSQUARES="";
|
||||
for ($i=1;$i<=$sqTotal;$i++) { $selectedSQUARES .= $sqSelect[$i]." "; }
|
||||
?>
|
||||
|
||||
<table width="60%" cellspacing="0" cellpadding="0" style="border: #FFCC99 1px solid; font-family:verdana, arial; font-size:12px; font-color:#0033cc">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<p><font size="4" color="#ffcc00"><h2>GOOD LUCK</h2></font></p>
|
||||
<p>Your request has been recieved and an email was sent to your email address given <b>(Please check your junk/spam folder)</b>.</p>
|
||||
<p>The square(s) <strong><font color="#ff0000"><?=$selectedSQUARES?></font></strong> is (are) temporary reserved in your name "<font color="#ff0000"><?=$name?></font>", pending confirmation.</p>
|
||||
<p>Please make payment via one of the methods below as soon as possible as to not lose your square!</p>
|
||||
<td align="center">
|
||||
<tr>
|
||||
<td>
|
||||
<br></br>
|
||||
<p><strong>Remember the Rules:</strong></p>
|
||||
<ul>
|
||||
<li><strong><font color="#ff0000">$<?=$Bet?></font></strong> Per square </li>
|
||||
<li>You can buy as many squares as you want</li>
|
||||
<li><strong>Your square(s) is/are not guaranteed until your payment is verified within <?=$Grace?>hours</strong></li>
|
||||
<li>Numbers will be randomly drawn and assigned after all squares are taken</li>
|
||||
<li>When confirmed, your square(s) will be changed to <span style="color: #009900;"><strong>GREEN</strong></span></li>
|
||||
<li>Please make payment via the following:
|
||||
<ul>
|
||||
<li><b>Cash</b></li>
|
||||
<li><b>Zelle:</b> <?=$Zelle?></li>
|
||||
<li><b>PayPal:</b> <?=$PayPal?> (Use 'Friends and Family')</li>
|
||||
<li><b>Venmo:</b> <?=$Venmo?></li>
|
||||
<li><b>CashApp:</b> <?=$CashApp?></li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>Good Luck and enjoy the game!</p>
|
||||
<p>- <?=$commissioner?></p>
|
||||
<!-- <p>You may make your payment thru Paypal if you preferred. <br/>There will be an additional $1 for each payment up to $20 to cover the charges by Paypal.</p> -->
|
||||
<br/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p style="font-family: verdana, arial; font-size: 12px">
|
||||
<a href="<?=$sb_URL?>" title="Online Superbowl Squares">Home</a>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
$bodyMessage = "\nREMINDER:\r\n";
|
||||
$bodyMessage .= "Square(s) $selectedSQUARES is(are) temporary reserved in your name \"$name\", pending confirmation.\r\n";
|
||||
$bodyMessage .= "IF YOUR PAYMENT CAN NOT BE VERIFIED WITHIN \"$Grace\" HOURS, YOU MAY LOSE YOUR SQUARE(S).\r\n\n";
|
||||
$bodyMessage .= "Good Luck and enjoy the game!\r\n";
|
||||
$bodyMessage .= "- $commissioner\r\n\n";
|
||||
$bodyMessage .= "$sb_URL\r\n\n";
|
||||
//$bodyMessage .= "You may make your payment thru Paypal if you like. \rThere will be an additional $1 for each payment up to $20 to cover the charges by Paypal.\r\n";
|
||||
$bodyMessage .= "\r\n\nNote to the commissioner:\r\n";
|
||||
$bodyMessage .= $notes."\r\n\n";
|
||||
|
||||
notify_admin($email,$bodyMessage,$headers);
|
||||
|
||||
require "footer.inc"; ?>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
echo "<p align='center'><font color='#ff0000', size='3'><b>$square</b> is NOT available! Someone must have just selected that same square.<br/></font><br/>Please go <a href='javascript:onClick=history.go(-2);'>back</a> and select another square.</p>";
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,12 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
output: 'standalone',
|
||||
experimental: {
|
||||
serverComponentsExternalPackages: ['nodemailer'],
|
||||
},
|
||||
images: {
|
||||
unoptimized: true,
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = nextConfig;
|
||||
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "superbowl-squares",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "tsx server.ts",
|
||||
"build": "next build",
|
||||
"start": "node server.js",
|
||||
"db:push": "prisma db push",
|
||||
"db:seed": "tsx prisma/seed.ts",
|
||||
"db:migrate": "prisma migrate deploy",
|
||||
"db:generate": "prisma generate",
|
||||
"postinstall": "prisma generate"
|
||||
},
|
||||
"dependencies": {
|
||||
"@prisma/client": "^6.3.0",
|
||||
"bcryptjs": "^2.4.3",
|
||||
"emoji-mart": "^5.6.0",
|
||||
"next": "^14.2.21",
|
||||
"next-auth": "^4.24.11",
|
||||
"nodemailer": "^7.0.7",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"ws": "^8.18.0",
|
||||
"zod": "^3.24.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bcryptjs": "^2.4.6",
|
||||
"@types/node": "^22.10.0",
|
||||
"@types/nodemailer": "^6.4.17",
|
||||
"@types/react": "^18.3.12",
|
||||
"@types/react-dom": "^18.3.1",
|
||||
"@types/ws": "^8.5.13",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"postcss": "^8.4.49",
|
||||
"prisma": "^6.3.0",
|
||||
"tailwindcss": "^3.4.16",
|
||||
"tsx": "^4.19.2",
|
||||
"typescript": "^5.7.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,141 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
enum Role {
|
||||
ADMIN
|
||||
VIEWER
|
||||
PLAYER
|
||||
}
|
||||
|
||||
enum PaymentType {
|
||||
VENMO
|
||||
PAYPAL
|
||||
CASHAPP
|
||||
ZELLE
|
||||
CASH
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
email String @unique
|
||||
name String
|
||||
passwordHash String
|
||||
role Role @default(PLAYER)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
squares Square[]
|
||||
chatMessages ChatMessage[]
|
||||
}
|
||||
|
||||
model GameSettings {
|
||||
id String @id @default("singleton")
|
||||
title String @default("Super Bowl Squares")
|
||||
commissioner String @default("")
|
||||
eventName String @default("Super Bowl")
|
||||
eventDate String @default("")
|
||||
eventTime String @default("")
|
||||
sbLogo String @default("/images/superbowlnumber.png")
|
||||
nfcTeam String @default("NFC Team")
|
||||
nfcLogo String @default("/images/nfc-generic.png")
|
||||
afcTeam String @default("AFC Team")
|
||||
afcLogo String @default("/images/afc-generic.png")
|
||||
betAmount Float @default(10)
|
||||
winFirstPct Float @default(20)
|
||||
winSecondPct Float @default(20)
|
||||
winThirdPct Float @default(20)
|
||||
winFinalPct Float @default(30)
|
||||
donationPct Float @default(10)
|
||||
graceHours Int @default(48)
|
||||
rulesText String @default("")
|
||||
paymentInstructions String @default("")
|
||||
paymentMethods PaymentMethod[]
|
||||
}
|
||||
|
||||
model PaymentMethod {
|
||||
id String @id @default(cuid())
|
||||
gameSettingsId String @default("singleton")
|
||||
gameSettings GameSettings @relation(fields: [gameSettingsId], references: [id], onDelete: Cascade)
|
||||
type PaymentType
|
||||
value String
|
||||
enabled Boolean @default(true)
|
||||
}
|
||||
|
||||
model Square {
|
||||
id String @id @default(cuid())
|
||||
position String @unique // "00" to "99"
|
||||
userId String?
|
||||
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
||||
guestName String?
|
||||
guestEmail String?
|
||||
notes String?
|
||||
confirmed Boolean @default(false)
|
||||
signupDate DateTime?
|
||||
firstWin Boolean @default(false)
|
||||
halfWin Boolean @default(false)
|
||||
thirdWin Boolean @default(false)
|
||||
finalWin Boolean @default(false)
|
||||
reminderSent Boolean @default(false)
|
||||
}
|
||||
|
||||
model GridNumber {
|
||||
id String @id @default(cuid())
|
||||
position Int @unique // 0-9 (column/row index)
|
||||
nfcNumber Int // 0-9
|
||||
afcNumber Int // 0-9
|
||||
}
|
||||
|
||||
model Score {
|
||||
id String @id @default("singleton")
|
||||
nfcFirst Int?
|
||||
afcFirst Int?
|
||||
nfcHalf Int?
|
||||
afcHalf Int?
|
||||
nfcThird Int?
|
||||
afcThird Int?
|
||||
nfcFinal Int?
|
||||
afcFinal Int?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model EmailSettings {
|
||||
id String @id @default("singleton")
|
||||
smtpHost String @default("")
|
||||
smtpPort Int @default(587)
|
||||
smtpUser String @default("")
|
||||
smtpPass String @default("")
|
||||
useSsl Boolean @default(false)
|
||||
fromEmail String @default("")
|
||||
fromName String @default("")
|
||||
}
|
||||
|
||||
model EmailTemplate {
|
||||
id String @id @default(cuid())
|
||||
name String @unique
|
||||
subject String
|
||||
body String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model ChatMessage {
|
||||
id String @id @default(cuid())
|
||||
userId String?
|
||||
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
||||
guestName String?
|
||||
message String
|
||||
deleted Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model ChatBlacklist {
|
||||
id String @id @default(cuid())
|
||||
word String @unique
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main() {
|
||||
// Seed 100 squares (positions "00" through "99")
|
||||
const squares = [];
|
||||
for (let row = 0; row < 10; row++) {
|
||||
for (let col = 0; col < 10; col++) {
|
||||
const position = `${row}${col}`;
|
||||
squares.push({ position });
|
||||
}
|
||||
}
|
||||
|
||||
for (const square of squares) {
|
||||
await prisma.square.upsert({
|
||||
where: { position: square.position },
|
||||
update: {},
|
||||
create: square,
|
||||
});
|
||||
}
|
||||
|
||||
// Seed default game settings
|
||||
await prisma.gameSettings.upsert({
|
||||
where: { id: 'singleton' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'singleton',
|
||||
title: 'Super Bowl Squares',
|
||||
commissioner: 'Commissioner',
|
||||
eventName: 'Super Bowl',
|
||||
betAmount: 10,
|
||||
winFirstPct: 20,
|
||||
winSecondPct: 20,
|
||||
winThirdPct: 20,
|
||||
winFinalPct: 30,
|
||||
donationPct: 10,
|
||||
graceHours: 48,
|
||||
},
|
||||
});
|
||||
|
||||
// Seed default score row
|
||||
await prisma.score.upsert({
|
||||
where: { id: 'singleton' },
|
||||
update: {},
|
||||
create: { id: 'singleton' },
|
||||
});
|
||||
|
||||
// Seed default email settings
|
||||
await prisma.emailSettings.upsert({
|
||||
where: { id: 'singleton' },
|
||||
update: {},
|
||||
create: { id: 'singleton' },
|
||||
});
|
||||
|
||||
// Seed default email templates
|
||||
const templates = [
|
||||
{
|
||||
name: 'welcome',
|
||||
subject: 'Welcome to {{eventName}}!',
|
||||
body: 'Hi {{name}},\n\nWelcome to {{eventName}} Squares!\n\nYour account has been created successfully.\n\nUsername: {{email}}\n\nYou can log in and view the game board at:\n{{gameUrl}}/login\n\nThanks for joining!\n{{commissioner}}',
|
||||
},
|
||||
{
|
||||
name: 'square_confirmation',
|
||||
subject: 'Square Purchase Confirmation - {{eventName}}',
|
||||
body: 'Hi {{name}},\n\nThank you for purchasing squares for {{eventName}}!\n\nSquare(s): {{squares}}\nAmount Due: ${{amountDue}}\n\nPlease submit payment within {{graceHours}} hours to keep your squares.\n\nPayment Instructions:\n{{paymentInstructions}}\n\nPayment Methods:\n{{paymentMethods}}\n\nView your squares at: {{gameUrl}}\n\nThanks,\n{{commissioner}}',
|
||||
},
|
||||
{
|
||||
name: 'square_confirmed',
|
||||
subject: 'Payment Confirmed - {{eventName}}',
|
||||
body: 'Hi {{name}},\n\nGreat news! Your payment has been confirmed for {{eventName}}.\n\nSquare(s): {{squares}}\n\nYour squares are now locked in. View the game board at:\n{{gameUrl}}\n\nGood luck!\n{{commissioner}}',
|
||||
},
|
||||
{
|
||||
name: 'square_released',
|
||||
subject: 'Square Released - {{eventName}}',
|
||||
body: 'Hi {{name}},\n\nYour square(s) for {{eventName}} have been released.\n\nSquare(s): {{squares}}\n\nIf you believe this is an error, please contact the commissioner.\n\nView the game board at: {{gameUrl}}\n\n{{commissioner}}',
|
||||
},
|
||||
{
|
||||
name: 'payment_reminder',
|
||||
subject: 'Payment Reminder - {{eventName}}',
|
||||
body: 'Hi {{name}},\n\nThis is a friendly reminder that your payment for {{eventName}} is due soon!\n\nSquare(s): {{squares}}\nAmount Due: ${{amountDue}}\n\nYour grace period expires in approximately 2 hours. After that, your squares may be released.\n\nPayment Instructions:\n{{paymentInstructions}}\n\nPayment Methods:\n{{paymentMethods}}\n\nView your squares at: {{gameUrl}}\n\nThanks,\n{{commissioner}}',
|
||||
},
|
||||
{
|
||||
name: 'winner_notification',
|
||||
subject: 'Congratulations! You won {{quarter}} - {{eventName}}',
|
||||
body: 'Hi {{name}},\n\nCongratulations! You are the winner of the {{quarter}} quarter!\n\nSquare: {{square}}\nScore: {{nfcTeam}} {{nfcScore}} - {{afcTeam}} {{afcScore}}\nPrize: ${{prize}}\n\nThanks,\n{{commissioner}}',
|
||||
},
|
||||
{
|
||||
name: 'numbers_assigned',
|
||||
subject: 'Numbers Have Been Assigned - {{eventName}}',
|
||||
body: 'Hi {{name}},\n\nThe random numbers have been assigned for {{eventName}}!\n\nVisit the game board to see your numbers and check your squares:\n{{gameUrl}}\n\nGood luck!\n{{commissioner}}',
|
||||
},
|
||||
{
|
||||
name: 'game_results',
|
||||
subject: 'Final Results - {{eventName}}',
|
||||
body: 'Hi {{name}},\n\nThe game is over! Here are the final results for {{eventName}}:\n\nWinners:\n{{winners}}\n\nCongratulations to all the winners!\n\nThank you for participating in this year\'s Super Bowl Squares. We hope you had a great time!\n\nView the final board at: {{gameUrl}}\n\n{{commissioner}}',
|
||||
},
|
||||
];
|
||||
|
||||
for (const template of templates) {
|
||||
await prisma.emailTemplate.upsert({
|
||||
where: { name: template.name },
|
||||
update: {},
|
||||
create: template,
|
||||
});
|
||||
}
|
||||
|
||||
console.log('Seed completed successfully');
|
||||
}
|
||||
|
||||
main()
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
})
|
||||
.finally(async () => {
|
||||
await prisma.$disconnect();
|
||||
});
|
||||
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 9.6 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 9.3 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 17 KiB |