Bring the thrill of instant wins to your site with Scratch n Match—an embeddable, fast playing scratch card mini game. Players hover to "scratch," reveal three symbols, and celebrate a clean match with a jackpot. It’s lightweight by design, slotting into any page with simple setup and a polished, mouse driven experience your audience will love.
You control the odds and the action. Tune win rates, cap daily payouts, and limit plays per IP to keep the fun fair and sustainable. Announce winners, drive engagement, and add a proven casino style loop to your game or community. Scratch n Match is the quick, satisfying hit of chance that keeps players coming back.
Name: Scratch n Match
Version: Unknown (circa 2004)
Total Files: 14
Total Size: 0.04 MB
Created Date: Unknown (circa 2004)
Last Updated: Unknown
Author: Peter Kuntz (
Company: KPP Internet Promotions
Copyright: KPP Internet Promotions
License: Custom Proprietary (not GPL, requires license)
Project URL: http://www.kppdesign.nl (defunct)
PHP Version: PHP 4.x
Database: MySQL with MyISAM engine
Server: Apache with IE-specific JavaScript
| File Type | Count | Total Size (MB) | Purpose |
|---|---|---|---|
| .jpg | 6 | 0.014 | Scratch card symbols (crown, seven, diamond, ruby, magic, x) |
| .phtml | 5 | 0.007 | PHP template files (game, admin, config, languages) |
| .txt | 2 | 0.019 | Documentation (readme, license) |
| .sql | 1 | <0.001 | Database schema |
| Total | 14 | 0.04 | Minimal standalone package |
File Distribution Analysis:
Platform: Standalone web mini-game (embeddable)
Frontend: DHTML with IE-specific JavaScript
Backend: Pure PHP procedural code
Communication: Page reload per play
Session Management: IP-based tracking (no user accounts)
Real-time Updates: Mouse-over div removal (DHTML magic)
Game Engine: Modulo-based RNG for win determination
Scratch n Match is a virtual scratch card mini-game where players "scratch" three cards by hovering their mouse over gray overlay panels. The game reveals three symbols, and matching all three wins the jackpot. It's designed as an embeddable gambling widget for other websites, particularly online games needing a lottery/gambling feature.
This is a commercial product by KPP Internet Promotions - a Dutch web design company selling PHP widgets and mini-games. The product was designed to be integrated into existing websites with minimal configuration (just database credentials).
The "BackyardBoxin - ScratchnMatch" naming suggests this was either sold to or bundled with Backyard Boxin game (which we analyzed previously).
Genre: Casino Mini-Game / Virtual Scratch Card / Gambling Widget
Theme: Lottery scratch tickets
Game Style: Simple mouse-driven gambling
Target Audience: Website owners needing gambling features
Gameplay Pace: Instant (1-2 seconds per play)
Integration: Embeddable widget, not standalone game
Core Mechanic:
Visual System:
Symbol Library (6 symbols):
Algorithmic Fairness System:
if ($total % $chance == 0) {
$winner = 1; // Win
}
How It Works:
kr_total counterkr_chance = 10)Win Condition:
if (winner) {
// All 3 symbols match
document.scratch1.src = sc[random];
document.scratch2.src = document.scratch1.src; // Copy
document.scratch3.src = document.scratch1.src; // Copy
} else {
// Symbols don't match
document.scratch1.src = sc[random];
document.scratch2.src = sc[random];
document.scratch3.src = sc[random];
// Ensure #2 and #3 differ
while (document.scratch2.src == document.scratch3.src) {
document.scratch3.src = sc[random];
}
}
Three-Tier Restrictions:
kr_timesaday)kras_users tablekr_max_wins)kr_wins (resets manually)kr_total tracks lifetime playsRestriction Messages:
Admin Panel (scratchadmin.phtml):
Configurable parameters:
1 : X ratioStatistics Visible:
kr_total)kr_wins)Two Languages Included:
Configurable in config.phtml:
`php
$languagefile = "english.phtml"; // or "dutch.phtml"
`
Custom Language Support:
Embed Requirements:
Standalone or Embedded:
2 Tables (MyISAM):
Default Configuration:
INSERT INTO kras_params VALUES (0, 10, 100, 0, 100);
-- total:0, chance:1/10, max_wins:100, wins:0, times/day:100
Database Design Notes:
DHTML scratch interface
Mouse-over reveal mechanic
6 symbol graphics
Algorithmic win determination
IP-based play limiting
Daily win cap system
Admin configuration panel
Multi-language support (2 languages)
Play again button
Win/loss alerts
Total play tracking
Date-based restriction reset
Feature Completeness: 100%
This is a complete, production-ready widget ready for embedding.
No user accounts (by design - IP-based)
No prize configuration (handled by parent site)
No sound effects
No animation (instant reveal)
No mobile touch support (mouse-only)
No modern browser support (IE-specific)
Strong Design Elements:
Well-Architected Features:
Strengths:
Weaknesses:
Code Audit Example:
// From scratch.phtml - SQL injection:
$q_checktimes = "select count(*) from kras_users
where usr_ip='$host' and usr_date=CURDATE();";
// $host = $REMOTE_ADDR (can be spoofed)
// No escaping, direct concatenation
// From scratchadmin.phtml - Multiple vulnerabilities:
if ($action == "save") {
$savequery = "update kras_params
set kr_chance='$chance',
kr_max_wins='$maxwins',
kr_timesaday='$timesaday';";
}
// Issues:
// 1. No authentication (anyone can access admin)
// 2. register_globals dependency
// 3. SQL injection ($chance, $maxwins, $timesaday)
// 4. No CSRF protection
// 5. No input validation
Overall Code Quality Rating: 4/10
Security Warning
For a 2004 commercial widget, this is acceptable but not exceptional. The DHTML technique is clever, the modular design is good, but security is non-existent. As a $50-100 widget sold to small sites, it delivers the feature set promised. DO NOT use in production without complete security rewrite.
What This Codebase Is Good For Today:
NOT Recommended For:
Minimal Setup (DO NOT USE IN PRODUCTION):
Server Requirements:
Installation Steps:
$hostname = "localhost";
$mysqluser = "username";
$mysqlpassword = "password";
$database = "dbname";
$languagefile = "english.phtml";
Critical Issues:
Estimated Effort: 80-120 hours (2-3 weeks full-time)
1. Frontend Rewrite (40-60 hours)
Critical Changes:
Modern Implementation:
`javascript
// OLD (IE-only):
document.all['M'+i].style.display="none";
// MODERN (all browsers):
document.getElementById('M'+i).style.display = "none";
// BETTER (Canvas):
const canvas = document.getElementById('scratchCanvas');
const ctx = canvas.getContext('2d');
// Draw gray overlay, erase on mouse/touch
`
Canvas-Based Scratch:
2. Backend Modernization (25-35 hours)
PHP 8.4 Conversion:
`php
// OLD:
mysql_connect($hostname, $mysqluser, $mysqlpassword);
$result = mysql_db_query($database, $query);
// MODERN:
$pdo = new PDO("mysql:host=$hostname;dbname=$database",
$mysqluser, $mysqlpassword);
$stmt = $pdo->prepare("SELECT * FROM kras_params");
$stmt->execute();
`
Security Fixes:
Authentication Required:
`php
// Admin panel MUST require login:
session_start();
if (!isset($_SESSION['admin']) || $_SESSION['admin'] !== true) {
http_response_code(403);
die('Unauthorized');
}
`
3. Database Modernization (8-12 hours)
Schema Enhancement:
`sql
CREATE TABLE kras_users (
id INT AUTO_INCREMENT PRIMARY KEY,
usr_ip VARCHAR(45) NOT NULL, -- Support IPv6
usr_date DATE NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
INDEX idx_ip_date (usr_ip, usr_date)
) ENGINE=InnoDB;
`
4. Feature Enhancements (15-25 hours)
Modern Features:
5. Admin Dashboard (12-18 hours)
Modern Admin Panel:
Total Estimated Modernization Cost: $4,000 - $12,000 at industry rates
Verdict: The concept is solid and the DHTML technique was clever for 2004, but the implementation is IE-only and insecure.
Building from scratch would be 40-50% faster:
The only reusable elements are:
What Works Well:
What Doesn't Work:
Grade: C- (Functional in 2004, broken today)
As a 2004 commercial widget, this earned its $50-100 price tag. It delivered a working scratch card feature with minimal setup. However, it won't run in any modern browser (document.all removed) and has catastrophic security if you somehow get it running.
CRITICAL SECURITY RISKS (Severity: 9/10):
1. No Admin Authentication - CATASTROPHIC:
`php
// scratchadmin.phtml has ZERO login check
// Anyone can access: scratchadmin.phtml
// Anyone can modify win rates
`
Attack: Visit scratchadmin.phtml, set kr_chance=1 (100% win rate)
2. SQL Injection Everywhere:
`php
$savequery = "update kras_params
set kr_chance='$chance'";
`
Attack: Set $chance to: 1', kr_total=0, kr_wins=0, kr_max_wins=999999--
3. IP Spoofing Trivial:
`php
$host = $REMOTE_ADDR;
// No validation, easily spoofed
`
Attack: Set X-Forwarded-For header, bypass IP limits
4. register_globals Exploitation:
`php
if ($action == "save") {
// $chance, $maxwins come from GET/POST/COOKIE
}
`
Attack: ?action=save&chance=999&maxwins=999999
5. No CSRF Protection:
`html
`
Result: Admin visits attacker's site, parameters changed
6. Browser Compatibility Failure:
7. Financial Manipulation:
Real-World Attack Scenarios:
Scenario 1: Admin Panel Takeover (30 seconds)
Result: Drain prize pool, undetected
Scenario 2: IP Limit Bypass (10 seconds)
Result: Unlimited plays despite IP limits
Scenario 3: Database Manipulation (5 minutes)
`
http://site.com/scratch.phtml?host=1.2.3.4'%20OR%20'1'='1
`
Result: Bypass all restrictions, SQL injection escalation
Risk Level: CRITICAL (for production), LOW (as widget)
Important Context: This was sold as a widget for internal sites, not public gambling. The lack of authentication suggests it was intended for:
For these uses, the security level was "acceptable" in 2004. For any real money gambling, this was always catastrophically insecure.
Innovation Score: 6.5/10 (for 2004)
Pure DHTML Scratch Interface - Clever for 2004
Algorithmic Transparency - Provably Fair
Widget Philosophy - Embeddable Design
IP-Based Limiting - Friction-Free Anti-Abuse
Standard Elements:
Uniqueness Score: 5/10
Scratch n Match is one of many scratch card widgets sold in the mid-2000s. The DHTML implementation is creative, but the concept is straightforward. What makes it notable is the execution quality - it's simple, focused, and works (in IE).
Historical Significance:
Represents the PHP widget market (2003-2008) where developers sold small, focused tools:
KPP Internet Promotions (Netherlands) was one of dozens of companies selling such widgets for $25-200 each. The market died with:
This widget was probably sold for $50-100 and used on hundreds of Dutch websites.
Bottom Line:
Scratch n Match was a clever commercial widget for 2004 that delivered exactly what it promised: a self-contained scratch card feature for embedding in websites. The DHTML technique was innovative for avoiding Flash/Java dependencies, and the algorithmic win determination was transparent.
Strengths:
Fatal Flaws:
Modern Value: Near zero except as:
If you need a scratch card feature today:
Bottom Line
This represents a bygone era of web development - simple PHP widgets sold for small money, clever techniques constrained by browser limitations, and security as an afterthought. Interesting to study, impossible to use, valuable for understanding how far we've come.
| Historical Value | ★★★☆☆ 3/5 - Represents widget economy era |
|---|---|
| Code Quality | ★★☆☆☆ 2/5 - Clever technique, poor security |
| Innovation | ★★★☆☆ 3/5 - DHTML scratch creative for 2004 |
| Security | ☆☆☆☆☆ 0/5 - Catastrophic everywhere |
| Modern Usability | ☆☆☆☆☆ 0/5 - Won't run in modern browsers |
| Widget Design | ★★★★☆ 4/5 - Excellent self-contained approach |
| Overall Grade | D Obsolete but historically interesting |
Running many of the scripts in this archive on a live server presents a serious security risk. These projects were created before modern hardening practices and may contain vulnerabilities that can compromise your system.
We strongly recommend using this code for reference and analysis only, or in isolated local environments. By downloading these files, you accept full responsibility for their use.