πŸ€ PHP CODERS UZB πŸ€
77 subscribers
165 photos
38 videos
213 files
227 links
πŸ‡ΊπŸ‡Ώ Xarajatsiz harakat nolga teng! @phpadminuz
Download Telegram
<?php

$token = 'Bot tokeningiz';
$chat_id = 'Chat ID';

$document = 'faylning_to'liq_manzili.jpg'; // Yuborishni istagan fayl manzili

$apiUrl = "https://api.telegram.org/bot{$token}/sendDocument";

$postFields = [
'chat_id' => $chat_id,
'document' => new CURLFile($document),
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type:multipart/form-data']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
$result = curl_exec($ch);
curl_close($ch);

echo $result;
?>

πŸ’¬ @phpcodersuzb
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘1
$update = json_decode(file_get_contents('php://input')); 
$type = $message->chat->type;
$text = $message->text;
$cid = $message->chat->id;
$ispremium = $message->from->is_premium;

if($text=="/start" and $type == "private"){
bot('sendmessage',[
'chat_id'=>$cid,
'reply_to_message_id'=>$mid,
'text'=>"πŸ‘‹ Salom bizni botimizga xush kelibsiz!",
'parse_mode' => 'html',
]);
if($ispremium){
bot('sendmessage',[
'chat_id'=>$cid,
'text'=>"<b>⭐️ Premiumingiz bor ekan!</b>",
'parse_mode' => 'html',
]);
}else{}
}

πŸ’¬ @phpcodersuzb
Please open Telegram to view this post
VIEW IN TELEGRAM
function one($word){
$firstChar = $word[0];
return $firstChar;
}

function two($word) {
$last = $word[strlen($word) - 1];
return $last;
}

$text = "Yaxshi Dasturchilar";

$fine = one($text);
$cds = two($text);

echo "$text ning 1-harfi: $fine";
echo "\n";
echo "$text ning ohirgi harfi: $cds";

πŸ’¬ @phpcodersuzb
Please open Telegram to view this post
VIEW IN TELEGRAM
➑️ PHP Bot API'da antiflood funksiyasi:

$antifloodDelay = 3; // To'xtash uchun vaqtni belgilash (sekundda)
$antifloodLimit = 5; // To'xtash limitini belgilash

// Antiflood uchun o'zgaruvchilarni o'zlashtirish
if (!isset($update['message']['date'])) {
$update['message']['date'] = time();
}
$user_id = $update['message']['from']['id'];
$user_key = 'antiflood_' . $user_id;
$floodCount = $redis->get($user_key);
if (!$floodCount) {
$floodCount = 1;
$redis->set($user_key, $floodCount, $antifloodDelay);
} else {
if ($floodCount >= $antifloodLimit) {
// To'xtalishni aniqlash
$delay = $redis->ttl($user_key);
if ($delay > 0) {
// To'xtalish uchun kichik xabar yuborish
$response['text'] = 'Iltimos, keyinroq yozing. Sabrli bo\'ling.';
$response['method'] = 'sendMessage';
$response['chat_id'] = $update['message']['chat']['id'];
$response['reply_to_message_id'] = $update['message']['message_id'];
$response['parse_mode'] = 'HTML';
sleep($delay);
return $response;
} else {
$redis->set($user_key, 1, $antifloodDelay);
}
} else {
// Antiflood ni ozgartirish
$redis->incr($user_key);
}
}

πŸ’¬ @phpcodersuzb
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘2
Live stream finished (45 seconds)
Random reaksiya bosadigan funksiya (bot uchun) βœ…

return bot('setmessagereaction', [
'chat_id' => $cid,
'message_id' => $mid,
'reaction' => json_encode(array([
'type' => 'emoji',
'emoji' => $reaction,
])
)
]);
}

if(isset($message)){
$reactions = ['πŸ˜‡', '🀯', '🀝','πŸ”₯','❀️','πŸ†', 'πŸ€·β€β™‚οΈ', 'πŸ‘','πŸ‘','πŸ€“','😎','πŸ‘Œ',];
$randomReaction = $reactions[array_rand($reactions)];
reaction($cid, $mid, $randomReaction);
}
πŸ’¬ @phpcodersuzb
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ“΄ Videoni bazaga saqlaydi va bot orqali tasodifiy tarzda yuboriladi! (Via for random ⚑️)

 if($text == "πŸ”„ Tasodifiy video"){
$nec = file_get_contents("data/statvid.txt");
$phpcodersuzb = rand(1,$nec);
$video = file_get_contents("video/R_$phpcodersuzb.txt");
$ok = file_get_contents("step/$cid/ok.txt");
if(mb_stripos($ok,$phpcodersuzb)==false){
file_put_contents("step/$cid/ok.txt", "$ok\n$phpcodersuzb");
bot('sendvideo',[
'chat_id'=>$cid,
'video'=>"$video",
'caption'=>"<b>πŸ“₯ @$bot orqali yuklandi!</b>",
'parse_mode'=>"html",
'reply_markup'=>$vid,
]);
}else{
bot('sendMessage',[
'chat_id'=>$cid,
'text'=>"<b>πŸ–₯ Hozircha videolar mavjud emas keyinroq qayta urinib koΚ»ring!</b>",
'parse_mode'=>'html',
]);
}
}

if(($mp4) and $step=="yuk"){
$ha = bot('sendMessage',[
'chat_id'=>$cid,
'text'=>"<b>βœ…οΈ Video yuklandi!</b>",
'parse_mode'=>'html',
'reply_markup'=>$home,
]);
if($ha){
$get = file_get_contents("data/statvid.txt");
$b = $get + 1;
file_put_contents("video/R_$b.txt", "$doc_id");
file_put_contents("data/statvid.txt", "$b");
}
}
πŸ’¬ @phpcodersuzb
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘1