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
('eckfordd');
    
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' 'cricket''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('cricket'$option))
                    {
                        echo(
$s);
                    } 
?> >cricket
                    </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");
?>