<?php

include_once __DIR__ . '/../secrets.php';

include '../db_connect.php';

$userid = $_POST['userid'];
$token = $_POST['token'];
$key = $_POST['key'];

$security_key = decrypData($key);

if ($security_key === false) {
    echo 'Invalid encryption data';
    exit;
}

if ($security_key == SECURITY_KEY_PLAIN) {
	
	$con = dbConnect();
	
    $sql = "UPDATE signup SET token = '$token' WHERE userid = '$userid'";
    $result = mysqli_query ($con, $sql);
    
    $sql1 = "UPDATE page_table SET token = '$token' WHERE profile_userid = '$userid'";
    $result1 = mysqli_query ($con, $sql1);
    
}


?>