I am really new to wordpress, and I am trying to build a page that updates the database with given arguments. For example, if the client application calls https://codonmaster.000webhostapp.com/ranking.php?scoretime=30&nickname=hellooo&score=100 , then I want to insert a column ('hellooo',30,100) in my database.
However, I am stuck getting the query vars to my php code. The page always shows
defaultname,1566820333(current timestamp),0
Yes, the default values. Where should I change to make this page acknowledge needed variables?
My code is below:
<?php
require_once(dirname(__FILE__) . '/wp-config.php');
$wp->init();
$wp->parse_request();
$wp->query_posts();
$wp->register_globals();
$wp->send_headers();
function themeslug_query_vars( $qvars ) {
$qvars[] = 'scoretime';
$qvars[] = 'nickname';
$qvars[] = 'score';
return $qvars;
}
add_filter( 'query_vars', 'themeslug_query_vars' );
$scoretime = get_query_var( 'scoretime', ''.time());
$nickname = get_query_var( 'nickname', 'defaultname' );
$score = get_query_var('score', '0');
echo "{$nickname},{$scoretime},{$score}";