403Webshell
Server IP : 216.92.14.13  /  Your IP : 216.73.217.126
Web Server : Apache
System : Linux vps4089.pairvps.com 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64
User : rmlac2fmr ( 1040637)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/home/rmlac2fmr/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/home/rmlac2fmr/fix_all_dupes.py
import json, time

db = json.load(open("/home/rmlac2fmr/public_html/jn.com/ops/data/db.json"))

from collections import Counter
ids = Counter(p["id"] for p in db["persons"])
fixed = 0

for pid, count in ids.items():
    if count <= 1:
        continue
    dupes = [p for p in db["persons"] if p["id"] == pid]
    print(f"\nDUPLICATE ID: {pid}")
    # Keep the first one, give new IDs to the rest
    for i, p in enumerate(dupes):
        if i == 0:
            print(f"  KEEP: {p['firstName']} {p['lastName']} ({p['email']}) -> {pid}")
            continue
        new_id = f"P{int(time.time()*1000)%100000000}{fixed}"
        old_id = p["id"]
        email = p["email"].lower() if p["email"] else ""
        name = f"{p['firstName']} {p['lastName']}"
        print(f"  FIX:  {name} ({p['email']}) -> {new_id}")

        # Update the person
        p["id"] = new_id

        # Update travel requests that match this person by email
        for r in db["travelRequests"]:
            if r["personId"] == old_id and r.get("submittedEmail", "").lower() == email:
                r["personId"] = new_id
                print(f"    -> Travel request {r['id']} relinked")

        # Add assignment if missing
        if not any(a["personId"] == new_id for a in db["assignments"]):
            db["assignments"].append({"id": f"A{int(time.time()*1000)%100000000}{fixed}", "personId": new_id, "showId": "S2"})
            print(f"    -> Assignment added")

        fixed += 1
        time.sleep(0.01)  # Ensure unique timestamps

# Deduplicate assignments
seen = set()
clean = []
for a in db["assignments"]:
    key = (a["personId"], a["showId"])
    if key not in seen:
        seen.add(key)
        clean.append(a)
db["assignments"] = clean

json.dump(db, open("/home/rmlac2fmr/public_html/jn.com/ops/data/db.json", "w"), indent=2)

# Verify
ids2 = Counter(p["id"] for p in db["persons"])
remaining = {pid: c for pid, c in ids2.items() if c > 1}
print(f"\n{'='*50}")
print(f"Fixed {fixed} duplicate IDs")
print(f"Remaining duplicates: {len(remaining)}")
if remaining:
    for pid, c in remaining.items():
        names = [f"{p['firstName']} {p['lastName']}" for p in db["persons"] if p["id"] == pid]
        print(f"  {pid}: {names}")
else:
    print("All clean!")

Youez - 2016 - github.com/yon3zu
LinuXploit