I am trying to pass 3 variables through post for a basic admin panel for a site.
I have a form like so
<script>
var json = {"thing":"stuff"};
var json_file = JSON.stringify(json);
</script>
<form action='load.php' method='post'>
<input type='hidden' name='username' value='<?php echo $_POST["username"]; ?>' />
<input type='hidden' name='password' value='<?php echo $_POST["password"]; ?>' />
<input type='hidden' name='json' value='json_file' />
<input type='submit' value='Submit' />
</form>
I need the username and password passed along to make sure the person is meant to have access. And the json is meant to be passed on so the PHP script can write it to a file.
I tried wrapping json_file
in btoa(json_file)
and using base64_decode($_POST["json"])
to write, but its always writing things it shouldn't '�'