• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] insert to database if worldserver is offline (SOAP)

Status
Not open for further replies.

Tok124

Respected Member
Hello. I want to know how i can make my information from form insert to database if worldserver is offline.

I have a SOAP Script ready that works fine. But if the worldserver is off the SOAP wont work. So i want to make it so that if the worldserver is offline it should send the information from form to database instead of sending it to the worldserver.

Here is my script


And no. I wont use RA because my site is made with SOAP not RA. Maybe RA is a better option but i dont know how to use it. I hope you can help me anyway :)
 

Tommy

Founder
But if the worldserver is off the SOAP wont work.

Of course not. You won't be able to do it unless the Worldserver is online -- unless someone has an alternative, but worldserver runs the SOAP connection.

Are you trying to run account create command? Why? Authserver/Worldserver doesn't need to be restarted every time someone makes an account or if you make an account. If it did, that would be dumb.

Updating email in that query isn't necessary since the 'account create' command has an email argument:

account create username password email

Though, you can easily make the account through PHP instead of trying to run a command when the worldserver is closed (as is the SOAP connection).
 

Tok124

Respected Member
Of course not. You won't be able to do it unless the Worldserver is online -- unless someone has an alternative, but worldserver runs the SOAP connection.

Are you trying to run account create command? Why? Authserver/Worldserver doesn't need to be restarted every time someone makes an account or if you make an account. If it did, that would be dumb.

Updating email in that query isn't necessary since the 'account create' command has an email argument:



Though, you can easily make the account through PHP instead of trying to run a command when the worldserver is closed (as is the SOAP connection).
I had no idea it was possible to set email in the command. The reason why i want to use SOAP for making account is because i wanna try avoid as much database editing as possible while the worldserver is on. I did send the information to database before from the registration form. When a user registered i sometimes had to restart the worldserver to activate the account. So i think soap is better option.
 

Tok124

Respected Member
And also, I want to make a check for all the SOAP Scripts if the worldserver is online or not. And if its not online it should send to database. Let's say i have character unstuck on site. If worldserver is offline the members cannot unstuck their character. So i really need help with this. I just linked the account creation script as an example to show what the code look like.

Btw, Before someone comment about it. I have googled my problem (I always do) and i did find this http://php.net/manual/en/function.is-soap-fault.php and i tried to use it and run a SQL Query in there but it did not really work
 
Last edited:

Hyperion

Founder
Hmm, In the end it's all editing the DB anyway...
If you want to check against the server offline or soap, you can do a socket check on the port being open.

Reasons not to use SOAP: The XML data being sent is easier to hijack and inject

It's more secure to do accounts directly from PHP using stripslashes or escape_string to prevent any injections. Also on a
side note, depending on which emulator you are using (if you decide not to use soap) remember that they usually hash the username/password together.

But yeh.. If you want to check against like I said above, just use a port check in an if statement to see if SOAP is running or the server is offline (which both would be off if the server is off)
 

Tok124

Respected Member
Hmm, In the end it's all editing the DB anyway...
If you want to check against the server offline or soap, you can do a socket check on the port being open.

Reasons not to use SOAP: The XML data being sent is easier to hijack and inject

It's more secure to do accounts directly from PHP using stripslashes or escape_string to prevent any injections. Also on a
side note, depending on which emulator you are using (if you decide not to use soap) remember that they usually hash the username/password together.

But yeh.. If you want to check against like I said above, just use a port check in an if statement to see if SOAP is running or the server is offline (which both would be off if the server is off)
Thank you faded ! That helps alot. Not sure how to make a port check tho but im pretty sure there are 100 results on google on how to do that lol xD

And about sha password i know how it works
its something like
Code:
$password = sha1(strtoupper($_POST['username']).":".(strtoupper($_POST['password'])));

Tested with port check. Works fine. Site loads when submiting the form but it works as it should !

Thread can be marked as solved

Thank you Faded ! You saved my day :D
 
Last edited:

Hyperion

Founder
Thank you faded ! That helps alot. Not sure how to make a port check tho but im pretty sure there are 100 results on google on how to do that lol xD

And about sha password i know how it works
its something like
Code:
$password = sha1(strtoupper($_POST['username']).":".(strtoupper($_POST['password'])));

Yeh, that's the right format!

For the socket, this is what I do to check for ports:
Code:
 $socket = @fsockopen("127.0.0.1", "80", $errorNo, $errorStr, 3);
        if(!$socket)
            echo "offline";
        else
            echo "online";

Just change the ip to yours and 80 to whatever port
 
Status
Not open for further replies.
Top