Hardware Reference
In-Depth Information
(
[sender] => 012345678
[content] => Null Wow this might work, you know!
[inNumber] => 447786202240
[submit] => Submit
[network] => UNKNOWN
[email] => none
[keyword] => NULL
[comments] => Wow this might work, you know!
)
Both contain enough information to let you switch your lights on with a text message. The code is trivial
as follows:
if ($_POST['from'] == "012345678") {
if ($_POST['text'] == "bedroom on") {
system("/usr/local/bin/heyu turn bedroom_light on");
} else if ($_POST['text'] == "bedroom off") {
system("/usr/local/bin/heyu turn bedroom_light off");
}
}
To eliminate the sending of fiddly text messages (and perhaps save money), you can test future permutations of
this script with a simple web page. Using the simpler format, you can write code such as the following:
<form action="echo.php" method="POST">
<input name="from" value="phone num">
<input name="text" value="your message here">
<input name="msgid" value="" type="hidden">
<input name="type" value="1" type="hidden">
<input type="submit" value="Send Fake SMS">
</form>
Because this is on an open web server, there are some security issues. You can eliminate one by having the
phone number verified by a piece of code on the server ( never validate credentials on the client). You can further
limit another issue (although not eliminate it) by changing your simply named echo.php script to iuytvaevew.php ,
employing security through obscurity so that it is not accidentally found. Some providers will call your web page using
HTTPS, which is the best solution and worth the extra time in setting up a specific username and password for them.
You can rebalance the concepts of security and accessibility by allowing multiple phones to access the house,
by creating a white list of mobile phone numbers, and by adding to this list explicitly. Or you could ban any access
to your page from an IP that isn't similarly approved and known to be your gateway provider. If you were likely to be
communicating a lot through SMS, you could automatically add new phone numbers to a pending list of preapproved
devices, which in turns sends a notification message to the SMS administrator, where they can issue a special
command to add them onto the list.
If your facilities allow, having a physical mobile phone connected through Gnokii may be useful in emergencies
when you have no Internet connectivity and you want to be informed that the automatic power cycling of the router
(with a AW12 perhaps, as mentioned in Chapter 1) is in progress.
Search WWH ::




Custom Search