Guest User

Untitled

a guest
Mar 22nd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. <?php
  2.  
  3. /* Start form compiller */
  4.  
  5. $name = $_POST['user_name'];
  6. $phone = $_POST['user_phone'];
  7. $email = $_POST['user_email'];
  8. $type = $_POST['user_type'];
  9. $token = "501269257:AAGHR_3Hoh4LmwUSMNH50TtlPz1xgw-dBtM";
  10. $chat_id = "263700664";
  11.  
  12. /* Create file.vcf in home directories */
  13.  
  14. $fp = fopen("file.vcf", "w");
  15.  
  16. /* Create array for vCard */
  17.  
  18. $arr = array(
  19. 'BEGIN:VCARD' => n,
  20. 'VERSION:3.0' => n,
  21. 'FN:' => $name,
  22. 'TEL;TYPE=work, voice, pref, msg:+' => $phone,
  23. 'EMAIL;TYPE=INTERNET:' => $email,
  24. 'NICKNAME:' => $type,
  25. 'END:VCARD' => n
  26. );
  27.  
  28. /* Record array in $txt */
  29.  
  30. foreach($arr as $key => $value) {
  31. $txt .= "n".$key."n".$value."%0A";
  32. };
  33.  
  34. fwrite($fp,$txt);
  35.  
  36. fclose ($fp);
  37.  
  38. $sendToTelegram = fopen("https://api.telegram.org/bot{$token}/SendDocument?chat_id={$chat_id}&document={$fp}");
  39.  
  40. /* Start redirect */
  41.  
  42. if ($sendToTelegram) {
  43. header('Location: thank-you.html');
  44. } else {
  45. echo "Error";
  46. }
  47.  
  48. /* End redirect */
  49.  
  50. ?>
Add Comment
Please, Sign In to add comment