View survey.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once 'util.php'; | |
include_once 'db.php'; | |
include_once 'user.php'; | |
include_once 'sms.php'; | |
class Survey { | |
protected $title; | |
protected $description; | |
public function addUserToSurvey ($pdo, $users, $surveyId, $level,$invitationsStatus){ | |
//$users is an indexed array of phone numbers. |
View user.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once 'util.php'; | |
include_once 'db.php'; | |
class User { | |
protected $phoneNumber; | |
protected $name; | |
public function allPhoneNumbers($pdo){ | |
//returns an array of phone numbers | |
try{ | |
$stmt = $pdo->prepare("SELECT phone_number FROM user"); |
View sms.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'vendor/autoload.php'; | |
use AfricasTalking\SDK\AfricasTalking; | |
include_once 'util.php'; | |
class Sms { | |
protected $AT; | |
function __construct() | |
{ | |
$this->AT = new AfricasTalking(Util::$API_USERNAME, Util::$API_KEY); | |
} |
View index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const routes = require('./routes/userRoutes'); | |
const Parser = require('body-parser'); | |
const app = express(); | |
app.use(Parser.urlencoded({extended:true})); | |
app.use(routes); | |
app.listen(process.env.API_PORT); |
View index.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$menu = new Menu(); | |
if($text == "" && $isUserRegistered == true){ | |
//user is registered and string is is empty | |
echo "CON " . $menu->mainMenuRegistered("<Add a name here>"); | |
}else if($text == "" && $isUserRegistered== false){ | |
//user is unregistered and string is is empty | |
$menu->mainMenuUnRegistered(); | |
}else if($isUserRegistered== false){ | |
//user is unregistered and string is not empty |
View home.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('Testing something') |
View userRoutes.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const userController = require('../controllers/userController'); | |
const route = express.Router(); | |
route.post('/user', userController.newUser); | |
module.exports = route; |
NewerOlder