Using php/mysql to store-retrieve fcm tokens and send notifications.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 5a80489 Mar 9, 2018

README.md

fcm-php

Using php/mysql to store-retrieve fcm tokens and send notifications.

The Project

This code was part of a school assignment for the BACHELOR study System & Network Engineering at the University of Applied Sciences Amsterdam (HVA-SNE-Implementation). The assignment was to create a two-factor authentication system for a VPN. Officially we had to use a NPS (Windows) and write our own DLL for it, we never got the DLL to work so we made a work around.

Database

You will need a database with 1 table:

CREATE TABLE IF NOT EXISTS phone (
  id int(9) PRIMARY KEY AUTO_INCREMENT, 
  username varchar(254) NOT NULL, 
  fcmtoken TEXT, 
  code int(6));

index.php

This is the 'front-end' code, it does not generate any HTML to display. It takes a json request and handles depending on the json['action'] parameter.

code_generator.php

Generates a 6 digit code for two factor authentication use. Depending on the size of the organisation you implement this is there is a change people get the same code so you will need the username+code in order to make out if it is a valid code.

It also saves the newly generated code.

test.php

A very simple test script in which you set a static username.

fcm.php

The project made use of Google Firebase to send notifications to the android app. It builds the json you send to firebase, the $token parameter is the device unique firebase token an android app creates, the $code is the 6 digit authentication code.

RADIUS.php

used for the first step of an authentication. You will need to set the server information parameters: line 7,8,9