-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
90 lines (66 loc) · 2.41 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
require 'php/NumberParser.php';
require 'php/Mail.php';
$p = new NumberParser();
if($_POST['numbers'] != null) {
$emails = $p->buildEmails($_POST['numbers']);
if(count($emails) > 0) {
$singleEmail = join(',', $emails);
$from = $_POST['from'];
$mail = new Mail();
$mail->sendMail($from, $singleEmail, $_REQUEST['message']);
/*
foreach($emails as $email) {
}*/
echo '<p>Messages Sent</p>';
}
}
?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<form method="post">
<label>Email to send from (ex: [email protected])</label><br/>
<input type="text" name="from" /><br/>
<label>Phone Numbers (each one on a new line, it works to just copy a column from google docs)</label><br/>
<textarea name="numbers" rows="5"></textarea><br/>
<label>Message (160 characters) Include <b>www.bit.ly/asuc2012</b> in the message for a trackable link to the asuc elections page</label><br/>
<textarea id="message" name="message" rows="5"></textarea><br/>
<p>Characters Remaining: <span>160</span></p>
<input type="submit"/>
</form>
<script type="text/javascript">
$(document).ready(function(){
var max_length = 160;
//run listen key press
whenkeydown(max_length);
$('form').submit(function() {
return r = confirm("Are you sure you want to send this message?");
})
});
var whenkeydown = function(max_length)
{
$("#message").unbind().keyup(function()
{
//check if the appropriate text area is being typed into
if(document.activeElement.id === "message")
{
//get the data in the field
var text = $(this).val();
//set number of characters
var numofchars = text.length;
//set the chars left
var chars_left = max_length - numofchars;
//check if we are still within our maximum number of characters or not
if(numofchars <= max_length)
{
//set the length of the text into the counter span
$("p span").html("").html(chars_left).css("color", "#000000");
}
else
{
//style numbers in red
$("#message").val(text.substr(0, max_length));
}
}
});
}
</script>