Cara membuat web host manager sendiri V7 fitur Panel Reseller

Me Nime Id
Please wait 0 seconds...
Scroll Down and click on Go to Link for destination
Congrats! Link is Generated

 Oke! Kita tambahkan fitur Panel Reseller ke WHM Custom, supaya orang lain bisa jual hosting dari sistem ini.

Fitur yang Akan Dibuat:

  • Admin bisa membuat akun reseller.
  • Reseller bisa membuat akun hosting untuk pelanggan mereka sendiri.
  • Reseller punya batas jumlah akun yang bisa mereka buat.
  • Reseller bisa menghapus/mengelola akun pelanggan mereka.
  • Admin bisa menentukan harga paket reseller.

1️⃣ Tambahkan Tabel Reseller di Database

📌 Jalankan SQL ini untuk membuat tabel reseller

CREATE TABLE resellers (
    id INT AUTO_INCREMENT PRIMARY KEY,
    username VARCHAR(50) UNIQUE NOT NULL,
    email VARCHAR(100) NOT NULL,
    password VARCHAR(255) NOT NULL,
    max_clients INT NOT NULL DEFAULT 5,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

📌 Tambahkan Kolom reseller_id di Tabel Accounts

ALTER TABLE accounts ADD COLUMN reseller_id INT DEFAULT NULL;

📌 Sekarang, setiap akun hosting bisa punya reseller yang mengelolanya!


2️⃣ Buat Script Tambah Reseller

📌 File admin/add_reseller.php

<?php
include '../includes/config.php';

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $username = $_POST['username'];
    $email = $_POST['email'];
    $password = password_hash($_POST['password'], PASSWORD_BCRYPT);
    $max_clients = $_POST['max_clients'];

    $stmt = $conn->prepare("INSERT INTO resellers (username, email, password, max_clients) VALUES (?, ?, ?, ?)");
    $stmt->bind_param("sssi", $username, $email, $password, $max_clients);

    if ($stmt->execute()) {
        echo "Reseller berhasil ditambahkan!";
    } else {
        echo "Gagal menambahkan reseller.";
    }
}
?>
<h2>Tambah Reseller</h2>
<form method="post">
    <input type="text" name="username" placeholder="Username Reseller" required><br>
    <input type="email" name="email" placeholder="Email Reseller" required><br>
    <input type="password" name="password" placeholder="Password" required><br>
    <input type="number" name="max_clients" placeholder="Maksimal Akun" required><br>
    <button type="submit">Tambah Reseller</button>
</form>

📌 Admin bisa buat reseller & atur berapa akun hosting yang bisa mereka kelola!


3️⃣ Buat Halaman Login Reseller

📌 File reseller/login.php

<?php
session_start();
include '../includes/config.php';

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $username = $_POST['username'];
    $password = $_POST['password'];

    $stmt = $conn->prepare("SELECT id, password FROM resellers WHERE username=?");
    $stmt->bind_param("s", $username);
    $stmt->execute();
    $stmt->store_result();
    
    if ($stmt->num_rows > 0) {
        $stmt->bind_result($id, $hashed_password);
        $stmt->fetch();
        
        if (password_verify($password, $hashed_password)) {
            $_SESSION['reseller_id'] = $id;
            header("Location: dashboard.php");
            exit;
        } else {
            echo "Password salah!";
        }
    } else {
        echo "Reseller tidak ditemukan!";
    }
}
?>
<h2>Login Reseller</h2>
<form method="post">
    <input type="text" name="username" placeholder="Username" required><br>
    <input type="password" name="password" placeholder="Password" required><br>
    <button type="submit">Login</button>
</form>

📌 Reseller bisa login ke panel mereka sendiri!


4️⃣ Buat Halaman Dashboard Reseller

📌 File reseller/dashboard.php

<?php
session_start();
include '../includes/config.php';

if (!isset($_SESSION['reseller_id'])) {
    header("Location: login.php");
    exit;
}

$reseller_id = $_SESSION['reseller_id'];

// Ambil jumlah akun yang telah dibuat oleh reseller ini
$result = $conn->query("SELECT COUNT(*) FROM accounts WHERE reseller_id=$reseller_id");
$account_count = $result->fetch_row()[0];

// Ambil batas maksimal akun reseller ini
$result = $conn->query("SELECT max_clients FROM resellers WHERE id=$reseller_id");
$max_clients = $result->fetch_row()[0];

?>
<h2>Dashboard Reseller</h2>
<p>Total Akun Hosting: <?php echo $account_count; ?> / <?php echo $max_clients; ?></p>

<a href="create_account.php">Buat Akun Hosting Baru</a>
<a href="logout.php">Logout</a>

📌 Reseller bisa melihat berapa akun yang sudah mereka buat & batas akun mereka!


5️⃣ Buat Halaman Buat Akun Hosting untuk Pelanggan Reseller

📌 File reseller/create_account.php

<?php
session_start();
include '../includes/config.php';

if (!isset($_SESSION['reseller_id'])) {
    header("Location: login.php");
    exit;
}

$reseller_id = $_SESSION['reseller_id'];

// Cek apakah reseller masih bisa membuat akun baru
$result = $conn->query("SELECT COUNT(*) FROM accounts WHERE reseller_id=$reseller_id");
$account_count = $result->fetch_row()[0];

$result = $conn->query("SELECT max_clients FROM resellers WHERE id=$reseller_id");
$max_clients = $result->fetch_row()[0];

if ($account_count >= $max_clients) {
    die("Anda telah mencapai batas maksimal akun hosting!");
}

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $username = $_POST['username'];
    $domain = $_POST['domain'];

    $stmt = $conn->prepare("INSERT INTO accounts (username, domain, reseller_id, status, due_date) VALUES (?, ?, ?, 'active', DATE_ADD(NOW(), INTERVAL 30 DAY))");
    $stmt->bind_param("ssi", $username, $domain, $reseller_id);

    if ($stmt->execute()) {
        echo "Akun hosting berhasil dibuat!";
    } else {
        echo "Gagal membuat akun hosting.";
    }
}
?>
<h2>Buat Akun Hosting Baru</h2>
<form method="post">
    <input type="text" name="username" placeholder="Username Akun" required><br>
    <input type="text" name="domain" placeholder="Domain Akun" required><br>
    <button type="submit">Buat Akun</button>
</form>

📌 Reseller bisa membuat akun hosting untuk pelanggan mereka sendiri!


🔥 Sekarang WHM Custom Sudah Bisa Panel Reseller!

Admin bisa membuat reseller & menentukan batas akun mereka.
Reseller bisa login ke panel mereka sendiri.
Reseller bisa membuat akun hosting untuk pelanggan mereka.
Reseller hanya bisa membuat akun sesuai batas mereka.

Posting Komentar

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.