<?php
// Include the configuration file
require_once 'config.php';
//include_once($_SERVER['DOCUMENT_ROOT'] . "/framework/mysql.class.php");
//include_once($_SERVER['DOCUMENT_ROOT'] . "/pay/dbConnect.php");
include_once 'dbConnect.php';

header('Access-Control-Allow-Origin: *'); //for al
//header( 'Access-Control-Allow-Headers: Accept, Accept-Encoding, Accept-Language, Authorization, Cache-Control, Pragma, Content-Type, Origin, Referer, Sec-Fetch-Dest, Sec-Fetch-Mode, Sec-Fetch-Site, User-Agent, X-Requested-With');

////////////////////////
// https://voicetrivia.com/pay/check.php?memID=4&chID=4&memEmail=sillystats@gmail.com
////////////////////////

if (isset($_GET['memID'])) {
	$checkmemID = (int)$_GET['memID'];
	if ($checkmemID != 0) {
		//echo "Not 0";
		$cleanchars  = preg_replace('/[^-a-zA-Z0-9_]/', '', $checkmemID);
		$removeticks = preg_replace("/[^a-zA-Z0-9]+/", "", html_entity_decode($cleanchars, ENT_QUOTES));
		$dbsafememID = mysqli_real_escape_string($db,$removeticks);
		echo "checkmemID: " . $dbsafememID . "<br />";
	}
}

if (isset($_GET['chID'])) {
	$checkchID = (int)$_GET['chID'];
	if ($checkchID != 0) {
		//echo "Not 0";
		$cleanchars2  = preg_replace('/[^-a-zA-Z0-9_]/', '', $checkchID);
		$removeticks2 = preg_replace("/[^a-zA-Z0-9]+/", "", html_entity_decode($cleanchars2, ENT_QUOTES));
		$dbsafechID = mysqli_real_escape_string($db,$removeticks2);
		echo "checkchID: " . $dbsafechID . "<br />";
	}
}

if (isset($_GET['memEmail'])) {
	//$cleanEmail = filter_var($_GET['memEmail'], FILTER_SANITIZE_EMAIL);
	$sanitizedEmail = filter_var($_GET['memEmail'], FILTER_SANITIZE_STRING);

	$cleanEmail = filter_var($sanitizedEmail, FILTER_SANITIZE_EMAIL);

	$dbsafechEmail = mysqli_real_escape_string($db,$cleanEmail);
	echo "checkEmail: " . $cleanEmail . "<br />";
}

?>