- Home /
Setting up server side accounts using PHP
I'm creating a simple multiplayer game and posting it online. I want to set of server side highscores. As far as I can tell, to do this I need PHP code on my server to do this. I did enough research to learn the syntax for PHP and learned a couple functions but don't understand anything about how to use it. The PHP code I wrote is as follows:
<html>
<p>
<?php
$fileURL = 'http://www.weebly.com/uploads/4/5/9/7/45973299/logininterfacetest';
if(isset($_Post['username']) && isset($_Post['password'])){
$username = $_Post['username'];
$password = $_Post['password'];
$account = $username.';'.$password.'!';
file_put_contents(fileUrl, $account, FILE_APPEND);
}
?>
</html>
and in my game, I have:
IEnumerator AddAccount(){
WWWForm accountAdder = new WWWForm();
accountAdder.AddField("username", playerName);
accountAdder.AddField("password", playerPassword);
WWW temp = new WWW(playerInfoURL, accountAdder);
yield return temp;
if (!string.IsNullOrEmpty(temp.error)) {
print(temp.error);
}
else {
print("Fsadt");
}
}
and I call addaccount when they sign up
So, what do I do with the php script? And what do I need to change in my code? Also, what, preferably free, websites support php? Or is there another way I can do this without php?
Your answer
Follow this Question
Related Questions
Invoke www.error in PHP 1 Answer
Upload audio file into mysql database 0 Answers
Retrieving data from a WWW php call? 1 Answer
Can WWW call a function in PHP like jQuery AJAX can? 1 Answer