Self Destruct Letter Script | Fun Easy Mobile Friendly

Processor.php File

This is the processor file which enters new letters into the database. It sanitizes the strings before entering into the database.

<?php
include_once('functions.php');
include_once('config.php');
head();
if(isset($_POST['rt'])){
$rt=mysqli_real_escape_string($con, $_POST['rt']);
$rtz = filter_var($rt, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH);
$exp=mysqli_real_escape_string($con, $_POST['exp']);
$expz = filter_var($exp, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH);
$dt=mysqli_real_escape_string($con, $_POST['dt']);
$dtz = filter_var($dt, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH);
$lett=mysqli_real_escape_string($con, $_POST['lett']);
$lettz = filter_var($lett, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH);
$urll=date('mdyi');
$ran=rand();
$url=$urll.$ran;
if($dtz==''){echo "Please pick an expiration date.";
exit();
}
$ct= strlen($lettz);
if($ct<7){echo "Please write a letter.";
exit();
}
$ipadd=$_SERVER['REMOTE_ADDR'];
$result = $con->query("SELECT ip, url FROM letters WHERE ip='$ipadd' ORDER BY id DESC") ;
 $num=$result->num_rows;
if($num > 33){
while ($row = $result->fetch_assoc()) {
echo '<p>Oh so you like to use this? I\'m glad that you do. You get to send 5 letters for free. However if you buy me a beer I\'ll lets you create 20 more for $5! email me max@a1websitepro.com after you send me a paypal payment and Ill make it happen! </p>';
echo '<a href="letter.php?user='.$row['url'].'" target="_new">Visit your Last Letter If Still Available</a> ';
exit();
}
}
//test
$regex = "@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?).*$)@";
$theletter=preg_replace($regex, '', $lettz);
//end test
//echo $rtz.'<br/> '.$expz.'<br/> '.$dtz.'<br/> '.$lettz;
 mysqli_query($con,"INSERT INTO letters(`long`, `times`, `datee`, `letter`, `ip`, `url` )VALUES ('$rtz','$expz','$dtz','$theletter','$ipadd','$url')");
echo '<a href="letter.php?user='.$url.'" target="_new">Preview Letter Will Use 1 View</a>';
$dir=basename(getcwd());
$root = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/'.$dir;
echo '<br/><a href="mailto:?subject=You Have A Self Destruct Letter Waiting&body=You have been written a self destruct letter you can see your letter here. '.$root.'/letter.php?user='.$url.'">Email Letter</a>';

echo '<p>Share the link below with the person that the letter is intended for!</p>';
echo '<input type="test" value="'.$root.'/letter.php?user='.$url.'"/>';
}; 

foot()
?>

Functions.php File

Here is the functions file.

<?php include_once('config.php');
function head(){
  $dir=basename(getcwd());
$root = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/'.$dir;
echo '<html lang="en-US">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<meta name="description" content="Self destruct letters at your service.Letters self destruct after they are read. Say what you really want to!"/>
<meta property="og:title" content="Self Destruct Letters "/>
<meta property="og:url" content="'.$root.'"/>
<meta property="og:site_name" content="Self Destruct Letters "/>
<meta property="og:description" content="Self Destruct Letters At Your Service" />
<meta name="twitter:description" content="Self Destruct Letters At Your Service" />
<title>Self Destruct Letters</title>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link href="https://fonts.googleapis.com/css?family=Quintessential" rel="stylesheet">
<link rel="stylesheet" href="style.css">
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="js.js"></script>
</head>';
}

function foot(){
echo '</body></html>';
}

function write(){
echo '<button type="button" class="btn btn-danger btn-lg" data-toggle="modal" data-target="#letter">Try It Now</button>
<div id="letter" class="modal fade" role="dialog">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Write your letter.</h4>
      </div>
      <div class="modal-body">
<div class="form-group">
<label for="readtime"><a href="#" title="How Long" data-toggle="popover" data-trigger="hover" data-placement="bottom" data-content="How long will you give a person to read this message?">How Long?</a>:</label>
  <select class="form-control" id="readtime">
    <option value="10000">10 Seconds</option>
    <option value="30000">30 Seconds</option>
    <option value="60000">1 Minute</option>
    <option value="90000">1 Minute 30 Seconds</option>
    <option value="120000">2 Minutes</option>
    <option value="180000">3 Minutes</option>
  </select>
</div>
<div class="form-group">
  <label for="expire"><a href="#" title="How Many Times" data-toggle="popover" data-trigger="hover" data-placement="bottom" data-content="How many times can a person view this message? Make sure you select 2 if you plan on previewing the letter!!!">How Many Times?</a>:</label>
  <select class="form-control" id="expire">
    <option value="1">1 Time</option>
    <option value="2">2 Times Use this option if you want to preview letter.</option>
    <option value="3">3 Times</option>
  </select>
</div>
<div class="form-group">
  <label for="date"><a href="#" title="Expiration Date" data-toggle="popover" data-trigger="hover" data-placement="bottom" data-content="Choose an Expiration date ">Expiration Date</a>:</label>
  <input type="date" class="form-control" id="date" />
</div>
<div class="form-group">
<label for="letter"><a href="#" title="How Long" data-toggle="popover" data-trigger="hover" data-placement="bottom" data-content="Tell them how you really feel.">Write Letter</a>:</label>
  <textarea class="form-control" rows="10" id="letter">Dear </textarea>
</div>
<button onclick="ajax_post();">Submit</button>
<div id="status"></div>
<script>
function ajax_post(){
    var hr = new XMLHttpRequest();
    var url = "processor.php";
    var readtime1 = document.getElementById("readtime").value;
    var expire1 = document.getElementById("expire").value;
    var date1 = document.getElementById("date").value;
var letter1 = $("textarea#letter").val();
    var vars = "rt="+readtime1+"&exp="+expire1+"&dt="+date1+"&lett="+letter1;
    hr.open("POST", url, true);
    hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    hr.onreadystatechange = function() {
      if(hr.readyState == 4 && hr.status == 200) {
        var return_data = hr.responseText;
      document.getElementById("status").innerHTML = return_data;
      }
    }
    hr.send(vars); // After Check Steps are done execute the request
    document.getElementById("status").innerHTML = "processing...";
}
</script>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>

  </div>
</div>';
}
function timeout(){
global $con;
global $urlll;
$resultw = $con->query("SELECT * FROM letters WHERE url='$urlll'") ;
while ($roww = $resultw->fetch_assoc()) {
return $roww['long'];
}
}

function theletter(){
global $con;
global $urlll;
$result = $con->query("SELECT * FROM letters WHERE url='$urlll'") ;
while ($row = $result->fetch_assoc()) {
$date=date('Y-m-d');
$expdate=$row['datee'];
$times=$row['times'];
if($date>$expdate){
return 'The Letter you are trying to access has been destroyed!';
exit();
}
if($times>0){
$total=$times-1;
mysqli_query($con,"UPDATE letters SET times='$total'WHERE url='$urlll' ");
}
if($times<1){
return 'The Letter you are trying to access has been destroyed!';
exit();
}
return $row['letter'];
}

}


?>

js.js File

Here is your javascript file for the server.

function myFunction() {
document.getElementById('sdl').style.display="none";
document.getElementById('message').style.display="block";
}

$(document).ready(function(){
    $('[data-toggle="popover"]').popover(); 
});

document.addEventListener('contextmenu', event => event.preventDefault());

Style.css file

Here is the style.css file for your server.

Only cool people share!

#sdl{
  width:58%; 
  height:100%; 
  display:block; 
  margin:0 auto;
  background-image:url(images/parchment.png); 
  background-size:100% 100%;
  padding:88px;
  letter-spacing:3px; 
  font-size:large; 
  font-weight:bold;
  /*text-shadow:1px 1px 2px #000; */
  line-height:45px;
  font-family: 'Quintessential', cursive;
  -webkit-animation-name: animatecircle;
  animation-name:animatecircle;
  -webkit-animation-duration: 180s;
  animation-duration: 180s;
  z-index:50000;
}

@-webkit-keyframes animatecircle {

0% {height:100%;}

25% {height:150%;}

50% {height:200%;}

75% {height:250%; }

100% { height:300%;}

} 

@keyframes animatecircle {

0% {height:100%;}

25% {height:150%;}

50% {height:200%;}

75% {height:250%; }

100% { height:300%;}


}
.social{disply:block; width:380px; margin:0 auto; padding:45px;}

.large{font-size:3vw; line-height:4vw;}

.sdll{
  width:58%; 
  height:100%; 
  display:block; 
  margin:0 auto;
  background-image:url(images/parchment.png); 
  background-size:100% 100%;
  padding:25px 155px;
  letter-spacing:3px; 
  font-size:large; 
  font-weight:bold;
  text-shadow:1px 1px 2px #000; 
  line-height:45px;
  font-family: 'Quintessential', cursive;
}

.form-control{font-size:large;height:auto;}
h1{
  text-align:center;
  font-size:4vw;
  text-shadow:1px 2px 3px #000;
  letter-spacing:3px;
}

body{background-image:url(images/fire.gif);font-size:large;}

#message{
  display:none; 
  background-image:url(images/parchment.png); 
  background-size:100% 100%;
  padding:155px;
  letter-spacing:3px; 
  font-size:large; 
  font-weight:bold;
  text-shadow:1px 1px 2px #000; 
  line-height:45px; 
  width:58%; 
  height:100%; 
  margin:0 auto;
}
.container-fluid{
  width:75%;
  display:block;
  margin:0 auto;
  height:100%;
}

@media screen and (max-width: 480px) {
#sdl{
  width:95%; 
  height:100%; 
  display:block; 
  margin:0 auto;
  background-image:url(images/parchment.png); 
  background-size:100% 100%;
  padding:55px 5px;
  letter-spacing:3px; 
  font-size:large; 
  font-weight:bold;
  text-shadow:1px 1px 2px #000; 
  line-height:45px;
  font-family: 'Quintessential', cursive;
}

a{font-size:large;}

.large{font-size:7vw; line-height:8vw;}

.sdll{
  width:95%; 
  height:100%; 
  display:block; 
  margin:0 auto;
  background-image:url(images/parchment.png); 
  background-size:100% 100%;
  padding:55px 25px;
  letter-spacing:3px; 
  font-size:55px; 
  font-weight:bold;
  text-shadow:1px 1px 2px #000; 
  line-height:45px;
  font-family: 'Quintessential', cursive;
}

.form-control{font-size:large;height:auto;}
h1{
  text-align:center;
  font-size:4vw;
  text-shadow:1px 2px 3px #000;
  letter-spacing:3px;
}

body{background-image:url(images/fire.gif);font-size:large;}

#message{
  display:none; 
  background-image:url(images/parchment.png); 
  background-size:100% 100%;
  padding:55px 5px;
  letter-spacing:3px; 
  font-size:55px; 
  font-weight:bold;
  text-shadow:1px 1px 1px #000; 
  line-height:45px; 
  width:95%; 
  height:100%; 
  margin:0 auto;
}
.container-fluid{
  width:98%;
  display:block;
  margin:0 auto;
  height:100%;
}
}

Self Destruct Letter Script | Fun Easy Mobile Friendly was last modified: March 14th, 2023 by Maximus Mccullough
Summary
Self Destruct Letter Script
Article Name
Self Destruct Letter Script
Description
This self destruct letter script is fun, fast and mobile friendly. All you have to do is download it and upload it to your server.
Author
Publisher
A1WEBSITEPRO LLC
Logo
Self Destruct Letter Script

Pages:Previous 1 2 3 4 Next

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.