SMS via email

SMS Stuff:



While this is noted as a DEMO, I want you to run it using your own phone to determine if the carrier noted in the code is correct.

So, your assignment is: Does this work?

Which carriers work?
Which carriers fail?

Submit answers via text to the dropbox.

 

CODE FOLLOWS

<?php
    session_name
('sperlt');
    
session_start();

    
$mail_sent '';

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

    
$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');

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

            <h1>SMS via email</h1>

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

                <fieldset>
                    <legend>SMS Stuff:</legend>
                    <label for="from">From: &nbsp; &nbsp; </label>
                    <input type="text" size="30" id="from" name="from" value="<?php echo($from); ?>">

                    <br>
                    <label for="to">To: &nbsp; &nbsp; </label>
                    <input type="text" size="30" id="to" name="to" value="<?php echo($to); ?>">
                    <br>
                    <label for="subject">Subject: &nbsp; &nbsp; </label>
                    <input type="text" size="30" id="subject" name="subject" value="<?php echo($subject); ?>">
                    <br>
                    <label for="message">Message: </label>
                    <textarea rows="4" cols="50" id="message" name="message">
<?php echo($message); ?>
</textarea>
                    <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>

            <p>
                While this is noted as a DEMO, I want you to run it using your own phone
                to determine if the carrier noted in the code is correct.
            </p>
            <p>
                So, your assignment is: Does this work?
            </p>
            <p>
                Which carriers work?<br>
                Which carriers fail?
            </p>
            <p>
                Submit answers via text to the dropbox.
            </p>

            <?php
        
}

    if (
$step == 1)     // second time into this script
        
{

        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;
            }

        if (
$mail_sent)
            {
            echo(
"Successfully sent an email to: $to");
            }
        else
            {
            echo(
'Sending email failed.');
            }
        
?>

            <form action="sms.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");
?>