# 00 — Overview

## Product

**Searchmercials** is a legacy advertising marketplace and publisher directory platform derived from the Hyperseek / iWeb framework (original lineage ~2001). It combines three primary roles:

- **Advertisers** bid on geographic + category keywords to place video/text ads
- **Publishers** embed search widgets and earn affiliate revenue on matched clicks
- **Directory users** perform keyword/geo-filtered searches against indexed listings

Recent commit history (2023–2024) shows significant work to retrofit a video-ad pipeline into the legacy engine: `update for videoads`, `update for videoads - search`, `update for videoads - detail page`, `update for videoads - search with category`, `update for bids location select`.

## Target users

| Role | Portal | Entry | Key tables |
|------|--------|-------|-----------|
| Advertiser | `/advertisers/` | `httpdocs/advertisers/index.php` | `iweb_accounts`, `iweb_acct_deposits`, `iweb_acct_transactions` |
| Publisher | `/publishers/` | `httpdocs/publishers/index.php` | `iweb_affiliate_info`, `iweb_affiliate_payments`, `iweb_affiliate_searches` |
| Admin | `/admin.php` | `httpdocs/admin.php`, `httpsdocs/admin.php` | Same + moderation views |
| End user (searcher) | `/` | `httpdocs/index.php` → `httpdocs/search/results.php` | `iweb_hyperseek_links`, `iweb_hs_categories` |

## Deployment footprint

- Single host, co-resident with the **YouPortal** platform (at `/var/www/html/youportal`)
- **Multi-domain**: `fixlinks.sh` creates symlinks from many per-domain vhost roots (`searchmercials_com/`, `searchads_tv/`, `avideo_com/`, `pooptube_com/`, `wwbn_tv/`, etc.) back to the shared `httpdocs/` codebase
- **Dual webroots**: `httpdocs/` + `httpsdocs/` both serve the same app under HTTP and HTTPS contexts; shared code via symlinks
- **Cobrand webroots**: the top-level `affiliates/` tree (262 MB) holds per-brand webroots (`searchtube_com/`, `wwbn_com/`, `newspaperrevenues_com/`, `arism_tv/`, etc.) plus the third-party **iDevAffiliate v4.0** installation at `affiliates/affiliate/`. See [13-affiliates-and-data.md](13-affiliates-and-data.md)
- **Shared config/templates**: top-level `data/` tree (59 MB) holds per-cobrand Hyperseek `.inc` config files, `.txt` render templates, GeoIP binaries, historical SQL migration patches (`data/sql/schemas/`), bid spreadsheets, and the `transaction.log` of Authorize.net deposits
- **Data sync**: nightly (?) sync to YouPortal's database via `ypbackfill_feed_data` marker + companion .txt/.curl helpers

## Feature map

- **Bidding engine**: category × geography × keyword pricing; legacy tables in `iweb_sponsor_boxes`, `iweb_hs_featured`
- **GeoIP targeting**: local MaxMind binary DB (`httpdocs/maxmind/assets/*.dat`) + `GeoIP.inc` wrapper in dsX
- **Click tracking**: `r.php` redirect endpoint logs to `iweb_jh_click_log`, aggregated in `iweb_jh_click_summary`
- **Video ads**: recent pipeline, player assets in `httpdocs/search/Player/`; FLV sample in `httpsdocs/validation/flv/video.flv` (Flash-era lineage)
- **Support tickets**: `iweb_support_tickets` + replies; UI at `httpdocs/support/`
- **Payments**: PayPal IPN + Authorize.net CGI processed by `httpsdocs/receive-payment.php`
- **Bot filtering**: `minibots.class.php` (CodeCanyon library) integrated in `classes_new/`

## Scale snapshot

- **~115** first-party PHP/SQL/JSON files at depth ≤3
- **264 MB** in `httpdocs/search/` — majority is bundled media/images, code is a minority
- **2.7 MB** in `httpdocs/auth/` — mostly dhtmlxSuite + jQuery vendor drops
- **1.1 MB** in `httpdocs/classes_new/` — includes vendor zipfile for minibots
- **262 MB** in `affiliates/` — per-brand cobrand webroots + iDevAffiliate vendor app
- **59 MB** in `data/` — shared Hyperseek config, per-cobrand templates, historical migrations

## Why this project needs documentation

- No existing written documentation beyond an empty `Documentation/an/` directory
- Multiple overlapping webroots, symlinked codebases, and `_old`/`_bak` duplicates make the codebase hard to navigate without a map
- Security posture is significantly below modern standards; remediation roadmap needs a clear starting point
- Handoff-readiness: the codebase is largely pre-MVC, procedural, and relies on implicit conventions that aren't obvious to new engineers
