BestDigitalCard documentation
Self-hosted digital visiting card platform. Upload, install, publish QR cards. Design and Developed by MediaByteX.
Documentation/index.html. Plain text: README.txt in the zip root. If you install the optional demo content (database/demo-data.sql), the live dummy cards are /business-card, /menu-card, /appointment-card, /catalog-card. database/database.sql alone contains tables, plans and settings only — no default accounts.Welcome
BestDigitalCard is a plain PHP + MySQL script. Customers register, choose a plan, and publish a mobile card with WhatsApp, QR, vCard, PDF, reviews, leads, menu, catalogue or appointments.
There is no Composer, no Node, no build step. Point the domain at the project root and run the installer.
Author: MediaByteX · Version: 1.0.3
Requirements
- PHP 8.1+ (tested on 8.3 and 8.4)
- MySQL 5.7+ or MariaDB 10.3+ (utf8mb4)
- Apache 2.4 with
mod_rewrite,AllowOverride All(Nginx rules are below) - Extensions:
mysqli,mbstring,openssl,json,curl,gd - Writable:
uploads/andlogs/
Recommended PHP limits (also in .htaccess when PHP runs as Apache module):
upload_max_filesize = 20M
post_max_size = 64M
max_file_uploads = 100
max_input_vars = 5000
memory_limit = 256M
Installation
A. Web installer (recommended)
- Unzip the package. Upload every file inside the
sourcefolder to the web root (public_html,www, orhtdocs). Keep the folder structure. On the server you must seeindex.php,app/,install/anddatabase/. - Create an empty MySQL database and a user with all privileges on that database (cPanel → MySQL Databases).
- Visit
https://your-domain.com/install/ - Enter host, database name, user, password, site URL and site name.
- Administrator account: enter your admin name, email and your own strong password twice. There is no default password. The password must have at least 10 characters with an uppercase letter, a lowercase letter, a number and a symbol (common passwords such as
Admin@123are rejected). It is stored withpassword_hash(). - Demo content (optional): tick Install demo content only if you want the 4 dummy cards, a demo customer account and coupon
WELCOME20. It is off by default. When ticked, the demo customer (demo@example.com) gets a random password that is shown once on the success page. - Click Install BestDigitalCard. The wizard writes
.env, importsdatabase/database.sql(anddatabase/demo-data.sqlif ticked), creates your administrator and upload folders, then writesinstall/installed.lock. - If the lock file cannot be written, the installer shows an error instead of “finished”. Make
install/writable (or create an emptyinstall/installed.lock, or delete theinstall/folder). - Open
/app/Admin/login.phpand sign in with the email and password you chose.
install/installed.lock exists or when the database already contains an administrator (or the installed_at flag). Deleting the lock file alone does not re-open it. To start over, use a new, empty database.B. Manual install (phpMyAdmin)
- Create database
bestdigitalcard(utf8mb4_unicode_ci). - Import
database/database.sql(tables, plans, settings — no default accounts). It contains no administrator account, no default password, no demo cards, no demo customer and no coupons. - Optional: import
database/demo-data.sqlfor the 4 dummy cards, the demo customer and couponWELCOME20. When imported by hand the demo customer has no usable password (it only owns the showcase cards). - Copy
.env.exampleto.envand setDB_HOST,DB_USER,DB_PASS,DB_NAME,CRON_KEY. - Create your first administrator with the one-time setup tool (it refuses to run once an administrator exists, and locks the installer afterwards):
- SSH / CLI:
php install/create-admin.php— asks for email, name and password (hidden, typed twice). - Browser (no SSH): add
SETUP_TOKEN=followed by a random secret of 32+ characters to.env, openhttps://your-domain.com/install/create-admin.php, enter the same token, your email and a strong password, then removeSETUP_TOKENfrom.env.
- SSH / CLI:
- Make
uploads/andlogs/writable (0755 or 0775). - Enable rewrite. Visit the site URL.
cp .env.example .env
# edit DB_* values
mysql -u USER -p bestdigitalcard < database/database.sql
mysql -u USER -p bestdigitalcard < database/demo-data.sql # optional
php install/create-admin.php # first admin (one time)
Nobody can sign in to the admin panel until the first administrator has been created this way (or by the web installer).
C. Upgrading
From v1.0.2: upload the v1.0.3 files (keep .env and uploads/). No database changes, no SQL import needed.
From v1.0.0 / v1.0.1:
- Back up your files and database.
- Upload the v1.0.2 files over the old ones (keep your
.envanduploads/). - Import
database/upgrade-1.0.2.sqlonce. It re-opens orders left in the oldprocessingstate so they can complete, adds unique keys so one gateway order can never own two subscriptions, and marks the database as installed. - All admins sign in again once. If you still use the old default admin password, change it now in Admin → Admins.
.env from your PC. The installer creates one on the server. After install, delete or protect /install/ if you want; the lock file already blocks a second run.Nginx (if you are not on Apache)
location ~ /\.(env|git) { deny all; }
location ~ ^/(core|cron|logs|database)/ { deny all; }
location / {
try_files $uri $uri/ @cardrouter;
}
location @cardrouter {
rewrite ^/([a-zA-Z0-9][a-zA-Z0-9_-]{1,80})$ /card.php?slug=$1 last;
}
Logins & optional demo content
| Role | Password | URL | |
|---|---|---|---|
| Admin | the email you entered | the password you chose (no default) | /app/Admin/login.php |
| Demo customer (optional) | demo@example.com | random, shown once by the installer (manual SQL import: login disabled) | /app/Auth/login.php |
The demo content is only present if you ticked Install demo content or imported database/demo-data.sql. Dummy published cards (homepage “View live demo” uses these slugs):
/business-card— Sharma Consulting (Rahul Sharma)/menu-card— Spice Garden restaurant/appointment-card— Glow Salon & Spa/catalog-card— Urban Mart shop
Without demo content, the homepage “View live demo” buttons open “card not found” until you publish your own cards with these slugs (or edit the links in index.php).
WELCOME20 before going live. Dummy names, phones and UPI IDs are sample data only.First 10 minutes after install
- Log in as admin → Site Settings.
- Set site name, logo, site URL, support email and WhatsApp.
- Turn Email verification on only after SMTP works (default is off so registration works without mail).
- Add Razorpay / Cashfree / manual UPI if you sell plans.
- Edit plans and prices under Plans.
- Register a test customer (or, if demo content was installed, log in as the demo customer) and open My Cards to see the editor.
- Create your own card. If demo content was installed, delete the dummy cards, demo customer and coupon
WELCOME20when you go live.
Admin panel
Path: /app/Admin/
- Dashboard — users, cards, views.
- Users — activate, assign plan, inspect.
- Cards — all published/draft cards.
- Coupons — discount codes. Dummy code
WELCOME20(20% off) exists only if the optional demo content was installed. - Plans — Free / Pro / Business. Edit price, card limits, feature flags.
- Site Settings — branding, SMTP, Razorpay, Cashfree, manual UPI, maintenance, registration toggle.
- Admins — extra staff (super vs admin).
- Error Logs —
logs/php_errors.log.
User panel
Path: /app/User/ after /app/Auth/register.php or login.
- Create Card — pick template, fill profile, contact, hours, services, menu, catalogue, reviews, UPI, opener animation.
- My Cards — edit, pause, QR, PDF, public link.
- Leads — form submissions from the public card.
- Reviews / Review cards — Google-review QR flow (plan flag).
- Offline card — print-ready PDF themes.
- Subscription — upgrade with coupon, Razorpay, Cashfree or manual UPI.
A card is public only when it is published, the user is active, and (for paid plans) a subscription is active and not expired.
Card types
| Template | File | Best for |
|---|---|---|
| business-card | app/Card/3-business-card.php | Consultants, agencies, shops |
| menu-card | app/Card/1-menu-card.php | Restaurants, cafes |
| appointment-card | app/Card/4-appointment-card.php | Salons, clinics |
| catalog-card | app/Card/2-catalogue-card.php | Product sellers |
Pretty URL: https://your-domain.com/your-slug rewrites to card.php?slug=your-slug.
Payments
Enable gateways in Admin → Settings → Payments. Webhooks:
- Razorpay →
/app/User/razorpay-webhook.php - Cashfree →
/app/User/cashfree-webhook.php - Manual UPI — user submits, admin confirms from the dashboard
APP_ENV=production in .env disables demo “activate without pay”. Keep that value on a live server.
Email / SMTP
Admin → Settings → Email. Host, port (587 TLS or 465 SSL), username, password, from name/email.
Until SMTP is saved, PHP mail() is used and often fails on shared hosting. Leave email verification off until a test password-reset arrives.
Cron jobs
Both scripts accept CLI or HTTPS with CRON_KEY from .env.
0 2 * * * php /path/to/cron/subscription-check.php
0 3 * * 0 php /path/to/cron/cleanup-logs.php
# or
https://your-domain.com/cron/subscription-check.php?key=YOUR_CRON_KEY
Subscription cron expires plans and sends 7-day / 1-day reminder emails when SMTP works.
Rebranding / reskin
Change the public brand without rewriting PHP logic. Do these in order.
- Name, tagline, logo, support contacts — Admin → Site Settings. Logo: PNG or JPG, about 400×400 px.
- Landing accent colour — edit the
:rootCSS variables at the top ofindex.php. Default accent is#16a34a. - Admin panel —
resources/css/admin-panel.css - User panel —
resources/css/user-panel.css - Public cards —
resources/card_assets/css/card.cssand template JS inresources/card_assets/js/pages/ - Dummy cards (only if the optional demo content was installed) — Admin → Cards, or delete the
demo@example.comcustomer in Admin → Users. Create your own card before launch. - Legal pages —
legal.phpalready uses the site name from settings. - Accounts — the admin password is set by you during install; delete the optional demo customer before launch.
Author credit (MediaByteX) lives in core/Config/author.php, source comments, and the card footer. The product name in Admin → Settings is independent of that credit.
/* Design and Developed by MediaByteX */
Folder map
README.txt English documentation (zip root)
START-HERE.txt One-page quick start
LICENSE.txt License + third-party credits
CHANGELOG.txt Version history
Documentation/ This HTML guide + INSTALLATION.txt
database/ database.sql (tables, plans, settings — no default accounts),
demo-data.sql (optional: 4 dummy cards, demo customer, WELCOME20),
upgrade-1.0.2.sql
source/ Upload THIS folder to public_html
--- inside source/ (what you upload) ---
install/ Web installer + create-admin.php (both lock after success)
database/ database.sql (tables, plans, settings — no default accounts),
demo-data.sql (optional: 4 dummy cards, demo customer, WELCOME20),
upgrade-1.0.2.sql (installs older than v1.0.2 only)
.env.example Copy to .env
app/Admin Admin pages
app/Auth Login, register, password reset
app/User Customer dashboard
app/Card Four public templates + partials
core/Config database.php, site.php, author.php
core/Helpers mailer, SEO, card save, uploads
cron/ Subscription + log cleanup
resources/ CSS, JS, card artwork, blog posts
uploads/ User media (keep writable)
logs/ PHP error log folder
Troubleshooting
Installer or homepage says service unavailable. Wrong DB details in .env, or database/database.sql not imported. Check logs/php_errors.log.
Pretty URLs 404. Enable mod_rewrite and AllowOverride All for the vhost. Confirm .htaccess uploaded.
Blank page after install. PHP version below 8.1, or a missing extension. The installer lists checks.
Cannot write .env. Make the web root writable for one install, or create .env yourself from .env.example.
Uploads fail. Folder permissions on uploads/. On PHP-FPM, raise upload_max_filesize in php.ini (htaccess php_value is ignored).
Card says not found. Not published, user inactive, or paid plan with no active subscription.
Emails never arrive. Fill SMTP. Test with forgot-password on your own test customer account.
Installer says “already installed”. The lock file exists or the database already has an administrator. This is the reinstall protection; use a new, empty database for a fresh install.
Installer says the lock file could not be written. Make install/ writable, or create an empty install/installed.lock, or delete the install/ folder.
Admin was logged out unexpectedly. Since v1.0.2 every admin request is checked against the database. Deactivating, deleting or changing the password of an admin ends that admin’s sessions immediately.
Homepage images missing. Keep uploads/misc/*.png from the package (hero, about, review, pdf-card, WhatsApp, manage-reviews).
Credits
- Product — BestDigitalCard
- Design and Developed by — MediaByteX
- Font Awesome 6 Free — CDN, Font Awesome Free license
- Google Fonts — SIL Open Font License
- jQuery 3.7 — MIT, used on the appointment booking page
Full PHP source. No ionCube, no encoded files, no Composer packages. License terms: LICENSE.txt.
Changelog
v1.0.3
- Documentation and listing consistency:
database/database.sqlis described everywhere as tables, plans, settings — no default accounts. The 4 dummy cards, demo customer and couponWELCOME20are described only as the optionaldatabase/demo-data.sql, imported by the installer only when Install demo content is ticked (off by default) or imported manually. - Installer form and success page name exactly what
demo-data.sqladds. database.sqlheader states explicitly that it contains no demo cards, no demo customer and no coupons.- Minimum PHP version corrected to 8.1 in the docs and the installer check (the code uses PHP 8.1 syntax; tested on PHP 8.3 and 8.4).
- No application logic or database schema changes from v1.0.2 (upgrading from v1.0.2 needs no SQL import).
v1.0.2
- Admin session revocation —
core/Middleware/auth-admin.phpre-loads the admin from the database on every authenticated request (account must exist, beactive, hold thesuper/adminrole and still have the password it signed in with). Otherwise the session is destroyed immediately (redirect to login, or HTTP 401 JSON for AJAX). The role is refreshed from the database on every request. - Transactional payments — Razorpay and Cashfree webhooks (and the browser return flows) now fulfil an order in one database transaction with a row lock (
SELECT … FOR UPDATE): subscription, transaction record, user plan, coupon usage and order status are committed together or rolled back together. No more intermediateprocessingstate; failed attempts are retried safely and a plan is granted exactly once. Unique keys onsubscriptions.razorpay_order_id/cashfree_order_id. - No default admin credentials —
database.sqlno longer contains an administrator or any password. The installer requires a unique strong password (typed twice). Manual installs create the first admin with the one-timeinstall/create-admin.php(CLI, or browser with aSETUP_TOKEN). Demo content moved to optionaldatabase/demo-data.sql(installer checkbox, off by default; random demo password). - Installer lock — the lock-file write is checked and verified; failure is reported as an error, never as success. Second safeguard: the installer refuses to run when the database already has an administrator or the
installed_atflag, even if the lock file was deleted. - Strong-password rule for admin accounts created or changed in Admin → Admins.
- Added
database/upgrade-1.0.2.sqlfor existing installs.
v1.0.1
- Super-admin gate on admin account management
require_super_admin()now runs at the start of thesave_adminanddelete_adminactions incore/ajax/admin-ajax.php(before POST data is read), and on the Admins page, with a live database role check so a demoted admin loses access immediately- Submitted admin roles are limited to
superoradmin - Removed unimplemented "WhatsApp lead alerts" and "Export to Excel" claims from the public landing page
v1.0.0
- Initial public release
- Web installer at
/install/ - Single MySQL dump:
database/database.sql - Four dummy published cards and demo user (since v1.0.2 these are in the optional
database/demo-data.sql, not indatabase.sql) - Admin panel, user panel, public landing and blog
- Razorpay, Cashfree and manual UPI
- SMTP mailer, cron jobs, HTML + text documentation
Support
MediaByteX
Support is provided through this marketplace's item comments/messages.
When you write, include: domain, PHP version, a screenshot, and the last lines of logs/php_errors.log.
© BestDigitalCard · Design and Developed by MediaByteX