<?php
error_reporting(1);
$token = ""; // bot token
$chat_id = ""; //chat_id
$ip = $_SERVER["REMOTE_ADDR"];
$adminpassword = '1ta9';
$chid = 'MD0TM'; // without '@'
$chname = 'ᴍᴀᴅ-ᴛᴇᴀᴍ';
define('API_KEY',$token);
//functions
function bot($method,$datas=[]){
$url = "https://api.telegram.org/bot".API_KEY."/".$method;
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,$datas);
$res = curl_exec($ch);
if(curl_error($ch)){
var_dump(curl_error($ch));
}else{
return json_decode($res);
}
}

function bankchecknum($value, $min, $max) {
    $value = trim($value);

    $min = (int) $min;
    $max = (int) $max;

    $opts = [
        'options' => [
            'min_range' => $min,
            'max_range' => $max
        ]
    ];
    return filter_var($value, FILTER_VALIDATE_INT, $opts) !== false;
}

function normalizeDigits($s) {
    $persian  = ['۰','۱','۲','۳','۴','۵','۶','۷','۸','۹'];
    $arabic   = ['٠','١','٢','٣','٤','٥','٦','٧','٨','٩'];
    $english  = ['0','1','2','3','4','5','6','7','8','9'];
    $s = str_replace($persian, $english, $s);
    $s = str_replace($arabic,  $english, $s);
    return $s;
}


function checknationalcode($id) {
    if (!preg_match('/^\d{10}$/', $id)) return false;

    if (preg_match('/^(\d)\1{9}$/', $id)) return false;

    $sum = 0;
    for ($i = 0; $i < 9; $i++) {
        $sum += intval($id[$i]) * (10 - $i);
    }
    $rem   = $sum % 11;
    $check = intval($id[9]);

    return ($rem < 2) ? ($check === $rem) : ($check === (11 - $rem));
}

function bankcheckstr($str, $min, $max){
    $len = mb_strlen(trim($str), 'UTF-8');
    return ($len >= $min && $len <= $max);
}
//CODED BY @MD0TM