SMS via email

SMS Stuff:









This is a DEMO, with the purpose of using my own phone to determine if the carrier noted in the code is correct.

 

CODE FOLLOWS

<?php

session_name
('hutchinv');
session_start();

$mail_sent '';

// set error reporting to all
error_reporting(E_ALL);

// variables
$step = isset($_SESSION['step']) ? $_SESSION['step'] : 0;
$step = isset($_POST['step']) ? $_POST['step'] : $step;
$self basename($_SERVER['SCRIPT_NAME']);

$option = array('Verizon''tMobile''Sprint''Att''Virgin' 'Criket''Mint');

$from = isset($_POST['from']) ? $_POST['from'] : '';
$to = isset($_POST['to']) ? $_POST['to'] : '';
$carrier = isset($_POST['carrier']) ? $_POST['carrier'] : '';
$subject = isset($_POST['subject']) ? $_POST['subject'] : '';
$message = isset($_POST['message']) ? $_POST['message'] : '';

$message stripslashes($message);

// set what was checked
$s ' SELECTED ';

include(
'includes/header.php');

// first time into this script
if ($step == 0)
{
    
?>

    <h1>SMS via email</h1>

    <form action="sms_message_demo.php" method="post">

        <fieldset>
            <legend>SMS Stuff:</legend>
            <br>
            <label for="from">From: &nbsp; &nbsp; </label>
            <input type="text" size="30" id="from" name="from" value="<?php echo($from); ?>">
            <br><br>
            <label for="to">To: &nbsp; &nbsp; </label>
            <input type="text" size="30" id="to" name="to" value="<?php echo($to); ?>">
            <br><br>
            <label for="subject">Subject: &nbsp; &nbsp; </label>
            <input type="text" size="30" id="subject" name="subject" value="<?php echo($subject); ?>">
            <br><br>
            <label for="message">Message: </label>
            <textarea rows="4" cols="50" id="message" name="message">
<?php echo($message); ?>
</textarea>
            <br><br>
            <label for="carrier">Carrier :</label>
            <select id="carrier" name="carrier">
                <option value="Verizon" <?php if (in_array('Verizon'$option))
                {
                    echo(
$s);
                } 
?> >Verizon
                </option>
                <option value="tMobile" <?php if (in_array('tMobile'$option))
                {
                    echo(
$s);
                } 
?> >tMobile
                </option>
                <option value="Sprint" <?php if (in_array('Sprint'$option))
                {
                    echo(
$s);
                } 
?> >Sprint
                </option>
                <option value="Att" <?php if (in_array('Att'$option))
                {
                    echo(
$s);
                } 
?> >Att
                </option>
                <option value="Virgin" <?php if (in_array('Virgin'$option))
                {
                    echo(
$s);
                } 
?> >Virgin
                </option>
                <option value="Criket" <?php if (in_array('Criket'$option))
                {
                    echo(
$s);
                } 
?> >Criket
                </option>
                <option value="Mint" <?php if (in_array('Mint'$option))
                {
                    echo(
$s);
                } 
?> >Mint
                </option>
        </fieldset>
        <br>
        <input type="hidden" name="step" value="1">
        <input type="submit" name="Submit" value="Submit">
    </form>
    <br>
    <p>
        This is a DEMO, with the purpose of using my own phone
        to determine if the carrier noted in the code is correct.
    </p>

    <?php
}
// second time into this script
if ($step == 1)
{

    if ((empty(
$from)) || (empty($to)) || (empty($message)) || (empty($subject)))
    {
        
$_SESSION["step"] = 0;
        
$carrier '';
    }

    switch (
$carrier)
    {
        case 
"Verizon":
            
$formatted_number $to "@vtext.com";
            
$mail_sent mail("$formatted_number"$subject"$message");
            break;

        case 
"tMobile":
            
$formatted_number $to "@tmomail.net";
            
$mail_sent mail("$formatted_number"$subject"$message");
            break;

        case 
"Sprint":
            
$formatted_number $to "@page.nextel.com";
            
$mail_sent mail("$formatted_number"$subject"$message");
            break;

        case
"Att":
        case
"Cricket":
            
$formatted_number $to "@cingularme.com";
            
$mail_sent mail("$formatted_number"$subject"$message");
            break;

        case 
"Virgin":
            
$formatted_number $to "@vmobl.com";
            
$mail_sent mail("$formatted_number"$subject"$message");
            break;

        case 
"Mint":
            
$formatted_number $to "@mailmymobile.net";
            
mail("$formatted_number"$subject"$message");
            break;
    }

    
// disguise phone number
    
$to_len = (strlen($to) - 4);
    
$to_hide substr($to0$to_len);
    
$hide_phonenumber str_replace($to_hide'###-###-'$to);

    if (
$mail_sent)
    {
        echo(
"Successfully sent a message to: $hide_phonenumber");
    }
    else
    {
        echo(
'Sending message failed.');
    }
    
?>
    <br><br>
    <form action="sms_message_demo.php" method="post">
        <input type="hidden" name="step" value="0">
        <input type="submit" name="submit" value="Send Another SMS">
    </form>

    <?php
}

include(
"includes/footer.php");

?>