با مرزبان نامه به بهترین شکل از مرزبان استفاده کنnnمرزبان نامه یک کانال تلگرامی است که به کمک کاربران بهترین راهکارها و راهنماییها برای استفاده از مرزبان فراهم میکند. اگر شما هم دوست دارید تجربیاتتان را به اشتراک بگذارید یا از دیگران یاد بگیرید، میتوانید در این کانال فعالیت کنید.
آدرس گروه فعال تلگرامی مرزبان نامه: t.me/+GkG4vhnGcoYyMTkxnnبرای افزایش فعالیت خود و بهبود کانال مرزبان نامه میتوانید از بوسترهای مخصوص استفاده کنید که در آدرس زیر قرار دارد: t.me/boost/Marzban_Namehnnبرای دسترسی به مرجع اطلاعات بیشتر و مقالات مفید میتوانید به وبسایت مرزبان نامه مراجعه کنید: marzbannameh.github.ionnاز طریق کانال یوتیوب مرزبان نامه نیز میتوانید به ویدیوها و آموزشهای تصویری مرتبط با مرزبان دسترسی پیدا کنید: youtube.com/@MarzbanNameh
09 Jan, 12:58
05 Jan, 14:58
marzban-node update
05 Jan, 14:38
05 Jan, 13:33
marzban down
docker image prune -a
marzban up
05 Jan, 12:47
sudo apt install zip; apt install unzip
cd /var/lib
zip -r marzban.zip marzban/
unzip marzban.zip
05 Jan, 11:45
05 Jan, 11:07
03 Jan, 14:59
INSERT INTO proxies (TYPE, user_id, settings)
SELECT 'trojan' AS TYPE, id, CONCAT( '{"password": "', SUBSTRING( CONCAT( CHAR(FLOOR(65 + (RAND() * 26))), CHAR(FLOOR(97 + (RAND() * 26))), CHAR(FLOOR(48 + (RAND() * 10))), CONVERT(SHA2(RAND(), 256) USING utf8mb4)), 1, 22 ), '", "flow": ""}' ) AS settings FROM users WHERE id in ( select id from users where id not in ( select user_id from proxies where type = 'trojan' ) );
INSERT INTO proxies (TYPE, user_id, settings)
SELECT 'Shadowsocks' AS TYPE, id, CONCAT( '{"password": "', SUBSTRING( CONCAT( CHAR(FLOOR(65 + (RAND() * 26))), CHAR(FLOOR(97 + (RAND() * 26))), CHAR(FLOOR(48 + (RAND() * 10))), CONVERT(SHA2(RAND(), 256) USING utf8mb4)), 1, 22 ), '", "method": "aes-128-gcm"}' ) AS settings FROM users WHERE id in ( select id from users where id not in ( select user_id from proxies where type = 'Shadowsocks' ) );
INSERT INTO proxies (user_id, type, settings)
SELECT id, "VMess", CONCAT("{""id"": """, CONVERT(UUID() , CHAR) , """}")
FROM users WHERE id in (select id from users where id not in ( select user_id from proxies where type = 'VMess' ));
INSERT INTO proxies (user_id, type, settings)
SELECT id, "vless", CONCAT('{"id": "', CONVERT(UUID() , CHAR) , '", "flow": ""}')
FROM users WHERE id in (select id from users where id not in ( select user_id from proxies where type = 'vless' ));
29 Dec, 20:30
28 Dec, 17:23
SELECT users.id, users.username, SUM(node_user_usages.used_traffic) AS total_used_traffic
FROM node_user_usages
INNER JOIN users ON node_user_usages.user_id = users.id
WHERE node_user_usages.node_id = 100
GROUP BY users.id, users.username
ORDER BY total_used_traffic DESC;
28 Dec, 16:55
DELIMITER //
CREATE TRIGGER Limit_Admin_UserCreation
BEFORE INSERT ON users
FOR EACH ROW
BEGIN
DECLARE user_count INT;
-- Calculate the number of users created by the admin
SELECT COUNT(*) INTO user_count
FROM users
WHERE admin_id = 1;
-- Check if the number of users created by the admin exceeds the limit
IF user_count = 1000 THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Admin has reached the limit of users.';
END IF;
END //
DELIMITER ;
28 Dec, 12:32
28 Dec, 12:30
DELIMITER //
CREATE TRIGGER Limit_Admin_TotalData
BEFORE INSERT ON users
FOR EACH ROW
BEGIN
DECLARE total_data_limit BIGINT;
-- Calculate the total data limit of all users created by the admin
SELECT SUM(data_limit) INTO total_data_limit
FROM users
WHERE admin_id = 1;
-- Check if the total data limit exceeds or equals 1 TB
IF total_data_limit >= (1 * 1024 * 1024 * 1024 * 1024) THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Admin has reached the total data limit.';
END IF;
END //
DELIMITER ;
28 Dec, 12:02
25 Dec, 13:01
13 Dec, 10:00
CREATE DEFINER=root`@% EVENT `limit_inbounds_for_admins ON SCHEDULE EVERY 10 MINUTE STARTS '2020-01-01 13:25:05' ON COMPLETION NOT PRESERVE ENABLE DO
INSERT INTO exclude_inbounds_association (proxy_id, inbound_tag)
SELECT proxies.id, inbound_tag_mapping.inbound_tag
FROM users
INNER JOIN admins ON users.admin_id = admins.id
INNER JOIN proxies ON proxies.user_id = users.id
CROSS JOIN (
SELECT 'INBOUND1_TAG' AS inbound_tag
UNION ALL
SELECT 'INBOUND2_TAG' -- second inbound
) AS inbound_tag_mapping
LEFT JOIN exclude_inbounds_association eia
ON eia.proxy_id = proxies.id AND eia.inbound_tag = inbound_tag_mapping.inbound_tag
WHERE admins.username IN ('ADMIN1_TAG', 'ADMIN2_TAG') -- admins list
AND eia.proxy_id IS NULL;
11 Dec, 18:25
DELIMITER //
CREATE TRIGGER Add_Prefix_To_Username
BEFORE INSERT ON users
FOR EACH ROW
BEGIN
-- Check if the admin_id is one of the specific admins
IF NEW.admin_id IN (50, 100) THEN
-- Check if the username does not already start with the prefix
IF LEFT(NEW.username, LENGTH('prefix_')) != 'prefix_' THEN
SET NEW.username = CONCAT('prefix_', NEW.username);
END IF;
END IF;
END //
DELIMITER ;
03 Dec, 10:32
marzban backup-service
marzban backup
sudo bash -c "$(curl -sL https://github.com/Gozargah/Marzban-scripts/raw/master/marzban.sh)" @ install-script
03 Dec, 09:13
03 Dec, 08:43
02 Dec, 18:36
02 Dec, 13:08
marzban core-update
marzban edit
marzban edit-env
marzban-node edit
01 Dec, 21:49
27 Nov, 10:57
25 Nov, 14:41
25 Nov, 14:12
24 Nov, 10:25
22 Nov, 10:30
SELECT username, TIMESTAMPDIFF(HOUR, online_at, NOW()) AS LastOnlineHours
FROM users
WHERE TIMESTAMPDIFF(HOUR, online_at, NOW()) >= 24
AND status = 'active'
ORDER BY LastOnlineHours DESC;
19 Nov, 14:26
15 Nov, 18:24
15 Nov, 14:11
15 Nov, 11:17
10 Nov, 12:30
09 Nov, 17:21
sudo bash -c "$(curl -sL https://github.com/DigneZzZ/Marzban-scripts-beta/raw/main/marzban.sh)" @ install --database mysql
sudo bash -c "$(curl -sL https://github.com/DigneZzZ/Marzban-scripts-beta/raw/main/marzban.sh)" @ install --database mariadb
sudo bash -c "$(curl -sL https://github.com/DigneZzZ/Marzban-scripts-beta/raw/main/marzban.sh)" @ install --database mysql --dev
sudo bash -c "$(curl -sL https://github.com/DigneZzZ/Marzban-scripts-beta/raw/main/marzban.sh)" @ install --database mariadb --dev
sudo bash -c "$(curl -sL https://github.com/DigneZzZ/Marzban-scripts-beta/raw/main/marzban.sh)" @ install --database mysql --version v0.5.2
sudo bash -c "$(curl -sL https://github.com/DigneZzZ/Marzban-scripts-beta/raw/main/marzban.sh)" @ install --database mariadb --version v0.5.2
09 Nov, 16:57
sudo bash -c "$(curl -sL https://github.com/DigneZzZ/Marzban-scripts-beta/raw/main/marzban.sh)" @ install --database mysql
sudo bash -c "$(curl -sL https://github.com/DigneZzZ/Marzban-scripts-beta/raw/main/marzban.sh)" @ install --database mariadb
sudo bash -c "$(curl -sL https://github.com/DigneZzZ/Marzban-scripts-beta/raw/main/marzban.sh)" @ install --database mysql --dev
sudo bash -c "$(curl -sL https://github.com/DigneZzZ/Marzban-scripts-beta/raw/main/marzban.sh)" @ install --database mariadb --dev
sudo bash -c "$(curl -sL https://github.com/DigneZzZ/Marzban-scripts-beta/raw/main/marzban.sh)" @ install --database mysql --version v0.5.2
sudo bash -c "$(curl -sL https://github.com/DigneZzZ/Marzban-scripts-beta/raw/main/marzban.sh)" @ install --database mariadb --version v0.5.2
08 Nov, 14:05
07 Nov, 18:50
docker image prune -a
02 Nov, 20:30
02 Nov, 16:18
28 Oct, 17:28
22 Oct, 11:01
# XRAY_SUBSCRIPTION_URL_PREFIX = "https://example.com"
16 Oct, 12:44
16 Oct, 11:40
16 Oct, 09:15
15 Oct, 20:10
LOGIN_NOTIFY_WHITE_LIST = '1.1.1.1,127.0.0.1'
15 Oct, 18:50
15 Oct, 15:11
14 Oct, 15:12
14 Oct, 13:35
07 Oct, 11:18
05 Oct, 22:47
SELECT
COUNT(*) AS total_users,
SUM(CASE WHEN status = 'active' THEN 1 ELSE 0 END) AS active_users,
SUM(CASE WHEN status = 'expired' THEN 1 ELSE 0 END) AS expired_users,
SUM(CASE WHEN status = 'limited' THEN 1 ELSE 0 END) AS limited_users,
SUM(CASE WHEN TIMESTAMPDIFF(MINUTE, now(), online_at) = 0 THEN 1 ELSE 0 END) AS online_users
FROM users
WHERE admin_id = ADMIN_ID;
SELECT username
FROM users
WHERE admin_id = ADMIN_ID
AND TIMESTAMPDIFF(MINUTE, now(), online_at) = 0;
05 Oct, 11:40
SELECT *
FROM users
WHERE admin_id = 3;
START TRANSACTION;
DELETE FROM node_user_usages
WHERE user_id IN (SELECT id FROM users WHERE admin_id = 3);
DELETE FROM proxies
WHERE user_id IN (SELECT id FROM users WHERE admin_id = 3);
DELETE FROM users
WHERE admin_id = 3;
COMMIT;
04 Oct, 09:59
SELECT username, datediff(now(), sub_updated_at) as LastUpdate FROM users
WHERE datediff(now(), sub_updated_at) < 1 AND status = 'active' ORDER BY LastUpdate DESC;
02 Oct, 10:20
DELIMITER //
CREATE TRIGGER prevent_unlimited_traffic_by_admins
BEFORE INSERT ON users
FOR EACH ROW
BEGIN
IF NEW.expire IS NULL THEN
IF NEW.admin_id IN (3, 4, 5) THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Admins with these IDs cannot create users without expire date.';
END IF;
END IF;
END;
//
DELIMITER ;
DELIMITER //
CREATE TRIGGER prevent_unlimited_traffic_by_admins
BEFORE INSERT ON users
FOR EACH ROW
BEGIN
IF NEW.data_limit IS NULL THEN
IF NEW.admin_id IN (3, 4, 5) THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Admins with these IDs cannot create users with unlimited traffic.';
END IF;
END IF;
END;
//
DELIMITER ;
30 Sep, 10:25
28 Sep, 09:52
28 Sep, 09:29
DELIMITER //
CREATE TRIGGER admin_edit_permission
BEFORE UPDATE ON users
FOR EACH ROW
BEGIN
IF NEW.used_traffic <> OLD.used_traffic AND NEW.used_traffic = 0 THEN
IF OLD.admin_id IN (3, 4) THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Edit is not allowed.';
END IF;
END IF;
END;
//
DELIMITER ;
27 Sep, 22:40
DELIMITER //
CREATE TRIGGER bhr_revoke_disable
BEFORE UPDATE ON users
FOR EACH ROW
BEGIN
IF NEW.sub_revoked_at <> OLD.sub_revoked_at THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Revoking subscription is not allowed';
END IF;
END;
//
DELIMITER ;
DELIMITER //
CREATE TRIGGER bhr_revoke_disable
BEFORE UPDATE ON users
FOR EACH ROW
BEGIN
IF OLD.admin_id IN (3, 4) AND NEW.sub_revoked_at <> OLD.sub_revoked_at THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Revoking subscription is not allowed';
END IF;
END;
//
DELIMITER ;
17 Sep, 16:46