mirror of
https://github.com/jakejarvis/spoons.git
synced 2025-09-15 04:35:34 -04:00
log all SMS messages/responses into database (note creation of new 'texts' MySQL table! included in updated db_structure.sql)
This commit is contained in:
@@ -1,30 +1,11 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 3.3.10.4
|
||||
-- http://www.phpmyadmin.net
|
||||
--
|
||||
-- Host: mysql.jakejarvis.dreamhosters.com
|
||||
-- Generation Time: May 19, 2013 at 08:43 AM
|
||||
-- Server version: 5.1.56
|
||||
-- PHP Version: 5.2.17
|
||||
|
||||
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
|
||||
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
|
||||
--
|
||||
-- Database: `spoons`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `spooners`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `spooners` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`order_num` int(11) NOT NULL,
|
||||
@@ -36,4 +17,17 @@ CREATE TABLE IF NOT EXISTS `spooners` (
|
||||
`spooned_by` int(11) NOT NULL DEFAULT '0',
|
||||
`target_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=17 ;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=20 ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `texts` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`message` text COLLATE utf8_unicode_ci NOT NULL,
|
||||
`response` text COLLATE utf8_unicode_ci NOT NULL,
|
||||
`phone_number` text COLLATE utf8_unicode_ci NOT NULL,
|
||||
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
|
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
function logSMS($message, $response, $number) {
|
||||
mysql_query('INSERT INTO texts (message, response, phone_number) VALUES ("' . mysql_real_escape_string($message) . '", "' . mysql_real_escape_string($response) . '", "' . mysql_real_escape_string($number) . '")');
|
||||
}
|
||||
|
||||
function getNumTotalSpooners() {
|
||||
$result = mysql_query("SELECT id FROM spooners");
|
||||
return mysql_num_rows($result);
|
||||
|
@@ -44,6 +44,8 @@ if($subject_id == "multiple") {
|
||||
$response = "Invalid command. " . $help;
|
||||
}
|
||||
|
||||
logSMS($_REQUEST['Body'], $response, $_REQUEST['From']);
|
||||
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>';
|
||||
?>
|
||||
<Response>
|
||||
|
Reference in New Issue
Block a user