Skip to content

Commit 9b3c97c

Browse files
Add files via upload
1 parent e062cc8 commit 9b3c97c

48 files changed

Lines changed: 9946 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

public_html/Bikehome page.png

876 KB
Loading
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# NiteSha Cars — Admin Panel
2+
3+
Rental management for NiteSha Cars & Bikes: vehicles, bookings, payments,
4+
security deposits, KM tracking, enquiries and reports.
5+
6+
The public website lives separately at **niteshacars.in**. This is the admin
7+
panel it links to, and the endpoint its enquiry form posts to.
8+
9+
Plain PHP and MySQL. No framework, no Composer, no build step — deploying is
10+
uploading the files.
11+
12+
## Putting it on the server
13+
14+
1. **Create a database.** In hPanel → Databases → MySQL, create a database and
15+
a user, and note the name, user and password.
16+
17+
2. **Upload the files** into the folder the subdomain serves, e.g.
18+
`admin.niteshacars.in`. Upload everything except `config.php`, which does
19+
not exist yet and is created for you.
20+
21+
3. **Open `install.php`** in a browser — `https://admin.niteshacars.in/install.php`.
22+
It checks the hosting, creates the tables, writes `config.php` and makes your
23+
Super Admin account.
24+
25+
4. **Delete `install.php`.** It refuses to run once an account exists, so it is
26+
not a way in, but there is no reason to leave it there.
27+
28+
5. **Sign in** at `https://admin.niteshacars.in/`.
29+
30+
To connect the enquiry form on the public site, post to
31+
`https://admin.niteshacars.in/api/enquiry-submit.php` with `name` and `phone`
32+
(and optionally `email`, `message`, `pickup_location`, `start_date`,
33+
`return_date`, `vehicle_id`). Include a field named `website`, hidden with CSS —
34+
it is a honeypot, and real visitors never fill it in. The address you post from
35+
must be listed in `public_site_origin` in `config.php`.
36+
37+
## What it does
38+
39+
- **Dashboard** — fleet and finance figures, active and upcoming rentals
40+
- **Bookings** — create, take payments, record deposits and refunds, log
41+
pickup and return, and track KM with automatic extra-KM charges
42+
- **Vehicles** — fleet, rate card, KM policy, deposit, odometer, status
43+
- **Enquiries** — what the public form sends, tracked until it becomes a
44+
booking or is turned down with a reason
45+
- **Finance** — expenses by category and vehicle, against income taken
46+
straight from the payments recorded on bookings
47+
- **Reports** — booking, revenue, vehicle, KM, deposit and payment reports
48+
49+
## How it is built
50+
51+
**Money is never a float.** Amounts are handled in whole paise
52+
(`src/money.php`), because `0.10 × 100` is not exactly `10.00` in floating
53+
point and a rental business cannot afford figures that drift.
54+
55+
**Financial records are added, never edited.** Payments, deposits, refunds,
56+
expenses and KM readings are only ever inserted. A mistake is corrected by a
57+
new row that cites the one it corrects, and cancelling is a status change with
58+
a reason. Nothing is deleted, so the trail an auditor follows is the trail of
59+
what actually happened.
60+
61+
**Income is never typed in.** The Finance tab sums the payments already
62+
recorded against bookings, so it cannot disagree with the bookings it
63+
summarises, and the same money cannot be entered twice. Deposits are reported
64+
beside the figures but never inside them: a deposit is the customer's money
65+
being held, not the business's money earned.
66+
67+
**Prices are frozen at booking.** A booking copies the rate, KM allowance,
68+
extra-KM rate and deposit into `booking_charges` when it is created. Changing
69+
the rate card afterwards never alters what an existing customer owes.
70+
71+
**Recorded status is separate from the calendar.** A booking's status moves
72+
only on a real pickup or return, so it is never marked Active without the
73+
odometer reading its extra-KM charge depends on. Alongside it, a schedule chip
74+
derived from the clock reads Upcoming, Awaiting Pickup, On Rent, Overdue
75+
Return and so on.
76+
77+
## Security
78+
79+
Passwords are hashed; five failed attempts lock an account for fifteen
80+
minutes; wrong-password and unknown-account give the same answer, so the form
81+
cannot be used to discover who has an account. Sessions regenerate on sign-in
82+
and the cookie is HttpOnly. Every write carries a CSRF token, every query is a
83+
prepared statement, and permissions are checked on the server for each request
84+
rather than by hiding buttons.
85+
86+
`config.php` holds the database password: it is git-ignored, and `.htaccess`
87+
denies it — along with `src/`, `sql/` and `tools/` — over the web.
88+
89+
The only unauthenticated endpoint is `api/enquiry-submit.php`. It can create an
90+
enquiry and nothing else, and is guarded by an origin allowlist, a honeypot,
91+
and a per-address hourly limit.
92+
93+
## Tests
94+
95+
```bash
96+
php tools/test-money.php # money arithmetic
97+
php tools/test-auth.php <dsn> <user> <pass> # sign-in, roles, numbering
98+
bash tools/test-api.sh <url> <email> <password>
99+
bash tools/test-bookings.sh <url> <email> <password>
100+
bash tools/test-ledger.sh <url> <email> <password>
101+
bash tools/test-enquiries.sh <url> <email> <password>
102+
bash tools/test-expenses.sh <url> <email> <password>
103+
node tools/test-ui.js <url> <email> <password>
104+
node tools/test-booking-ui.js <url> <email> <password>
105+
node tools/test-enquiry-ui.js <url> <email> <password>
106+
node tools/test-finance-ui.js <url> <email> <password>
107+
node tools/test-install-ui.js <url> <db-name> <db-user> # on a spare database
108+
```
109+
110+
350 checks, covering the money arithmetic, the append-only ledger, price
111+
freezing, double-booking, the KM audit trail, the enquiry defences, expense
112+
corrections and voiding, and the booking, enquiry and finance flows driven
113+
through a real browser.
114+
115+
## Brand
116+
117+
| Token | Value |
118+
|---|---|
119+
| Navy | `#0A0E20` |
120+
| Gold | `#F5A500` |
121+
| Deep gold (text on white) | `#B36B00` |
122+
123+
Typeface is Poppins.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
Use this section to tell people about which versions of your project are
6+
currently being supported with security updates.
7+
8+
| Version | Supported |
9+
| ------- | ------------------ |
10+
| 5.1.x | :white_check_mark: |
11+
| 5.0.x | :x: |
12+
| 4.0.x | :white_check_mark: |
13+
| < 4.0 | :x: |
14+
15+
## Reporting a Vulnerability
16+
17+
Use this section to tell people how to report a vulnerability.
18+
19+
Tell them where to go, how often they can expect to get an update on a
20+
reported vulnerability, what to expect if the vulnerability is accepted or
21+
declined, etc.

0 commit comments

Comments
 (0)