Can you add Md5 or sha1 … post secure string function for post request key ? i want to post data with md5 key value for uncheating…
Hey!
First of all, sorry for the total n00b question! I am new to the engine and how it all works.
I am running on OSX and getting build errors. I saw that you only provide the Win64 binaries. I was wondering if someone has had success compiling for Mac and if so, could they give me some steps to follow to get the plugin running?
Cheers,
My PHP code for getting data from a database. The $postRequest variable is whatever you parse through as Key in the Add String Field node before you post the request to the server.
Code for getting a single result back from Server
<?php
try {
$db = new PDO('mysql:host=localhost;dbname=gameDB', 'root', 'password');
} catch (PDOException $e) {
print "ERROR: " . $e->getMessage() . "<br/>";
die();
}
$postRequest = json_decode(file_get_contents('php://input'), true);
$username = $postRequest'username'];
$getUserData = $db->prepare("SELECT * FROM players WHERE username = :username");
$getUserData->execute(array(":username"=>$username));
$userData = $getUserData->fetchObject();
$currentHealth = $userData->currentHealth;
$maxHealth = $userData->maxHealth;
$level = $userData->level;
$password = $userData->password;
$experience = $userData->experience;
$lastLocation = $userData->lastLocation;
$coords_x = $userData->coords_x;
$coords_y = $userData->coords_y;
$coords_z = $userData->coords_z;
$data = array(
"username" => $username,
"level" => $level,
"currentHealth" => $currentHealth,
"maxHealth" => $maxHealth,
"password" => $password,
"experience" => $experience,
"lastLocation" => $lastLocation,
"coords_x" => $coords_x,
"coords_y" => $coords_y,
"coords_z" => $coords_z
);
echo json_encode($data);
?>
Code for getting more than one result back from Server
<?php
try {
$db = new PDO('mysql:host=localhost;dbname=gameDB', 'user', 'password');
} catch (PDOException $e) {
print "ERROR: " . $e->getMessage() . "<br/>";
die();
}
$postRequest = json_decode(file_get_contents('php://input'), true);
$username = $postRequest'username'];
$getCharacterData = $db->prepare("SELECT * FROM characters WHERE username = :username");
$getCharacterData->execute(array(":username"=>$username));
$characterData = $getCharacterData->fetchAll();
echo json_encode($characterData);
?>
If you get a “please rebuild from source” error go into your project, add an empty C++ class (file -> Add Code to Project) which will make your project a C++ project but will still allow you to use Blueprints.
After the class has been created, rebuild your engine in Microsoft Visual Studio by opening the Games folder in your Solution explorer -> right clicking your project’s name and then pressing Rebuild.
Plugin should work fine after that, it did for me.
is there a update comming for the next version of unreal bequase there is a prieview of 4.8
I recently found this and really like it but I have some suggestions for additions. I noticed that there is no support for local data, ie. having a . file in the project folder or a Data Table object that contains plain strings. Could we get a function that can parse strings without having to supply a HTTP URL? I could do this myself but I wouldnt want to mess with your project.
Hey guys! I’m finally back, things have been hectic here but I should have some more time for new features very soon!
@Mike: Yeah, security’s a bit annoying sometimes, glad you could figure things out!
@0000000000a: Encryption is not something I have plans for at the moment, but I could look into it!
@Quantum & @johnbo: Thanks for the help here while I was gone!
@Slyvan: Not for preview releases I’m afraid, since it’s really hard to get compatible plugins out for preview releases
@conneich: I’ve updated the release with a new node called “From String”! I’ve made an example for you:
In other news, I made a new build + source release for you all, for UE4.7.6! You can get it right here: http://www.stefander.nl/files/JSONQuery_UE4.7.6.zip
A little edit for who want to bind an event on request failed
JsonFieldData.h
after
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnGetResult);
add
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnJsonFailure);
after
/* Event which triggers when the content has been retrieved */
UPROPERTY(BlueprintAssignable, Category = "")
FOnGetResult OnGetResult;
add
/* Event which triggers when the content cannot been retrieved */
UPROPERTY(BlueprintAssignable, Category = "")
FOnJsonFailure OnJsonFailure;
**JsonFieldData.cpp :: OnReady
**after
UE_LOG(LogJson, Error, TEXT("Response was invalid! Please check the URL."));
add
OnJsonFailure.Broadcast();
**Result
**
I’ve updated the latest release, thanks very much for the headsup, totally missed this!
Make an online repo un github for community contibutions
I’ve always wanted to keep the binaries together with the source so they’re always distributed together, which while a bit cumbersome, is the reason I don’t have a public repo at the moment! That may be coming soon though!
You can alway update Release pack on github.
hello I studied the blueprint 1 day, but I am having a problem writing to the file php I get good to do a GET of an element
but I can 't recover a $ _ POST ’ score ']; for playback on unreal
I board doing a simple operation that should give me results: scrore = 104;
but the result is 4 if someone would thank you the solution.
my ph
my image unreal :
**
ok with a little problem solved research**
correction below:
Great Plugin ! Just wondering if this will work withCouchDb its a Database
@Kheka: I’ll see what I can do!
@lalexl: Glad you figured it out!
@kingj5: Sure, any -enabled backend will do!
I’m follow you and your repo now on github
Hi… thanks for the php code.
im trying to use this base code for checking username and password, but cant seem to get it to work. can any one help, with what set of nodes i need to check username with password
First of all thanks for an amazing plugin!
Secondly (sadly) i’m still too fresh in terms of c++ and I need a little help. I’m trying to get JSONQuery to work and communicate between blueprints and code. Currently I’m passing a UJsonFieldData pointer to c++ class method
UFUNCTION(BlueprintCallable, meta = (FriendlyName = "Import Test Data"), Category = "API Data Import")
bool ImportTestData(UJsonFieldData* TestData);
In this method I would like to iterate over object array and do some other stuff.
Problem is: when I try to call method on UJsonFieldData like this:
bool UDatabaseManager::ImportTestData(UJsonFieldData* TestData)
{
FString Result = InvestmentsData->GetString(FString(TEXT("TEST")));
return true;
}
the UBT returns linker error
I DO have include “JsonFieldData.h” in header of my class and “JSONQuery” added both to my public and private dependency module names.
I would really appreciate your help guys. Sorry if I’m asking question in wrong place
Hi Stefander!
I think, if you select all Blueprint (^A), then copy(^C) it and paste(^V) into notepad or paste here, maybe more helpful for us(then we can just copy and paste in our project to test or use), thanks.
Thank U, great work!
Hi,
first off thanks for this plugin… its pretty awesome.
it works when I play the game in editor…
but when I package the game… then run it I get this pop up error and the game never loads
" Plugin “JSONQiery” failed to load because module ‘JSONQuery’ could not be found"
I created a folder in my project called plugins and put the plugin in there.
But then when I try to package again it says it cant because the plugin already exists in the main unreal engine editor folder.
Am I doing something wrong. I’m sure this works somehow with packaged games…(or its not useful lol)
Thanks!