SA-MP Forums Archive
http - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: http (/showthread.php?tid=620836)



http - MerryDeer - 03.11.2016

Hi,

How with http for example safe message? like write player /pm [name] [message]

I want to safe message, send to php file, what message and what name, in php file get and write into mysql file.


Re: http - MerryDeer - 03.11.2016

up topic

I tried something but there is problem when sending to php, when text is with & or +, not all symbols are reading i gues i need decode something, i read need to send decoded querie, but how in sa-mp format http, to make decode or something, that in php i could retrieve any string?


Re: http - 4D1L - 03.11.2016

Correct me if I'm wrong here but wouldn't it much more efficient to store what you want into the mysql database from the script directly instead of sending the string to a php file which connects to a SQL database and stores the string?


Re: http - Dignity - 03.11.2016

Honestly I don't mean any offense but you post these kind of threads every day or so. You should learn the basics and then try to do what you want to do. This is all basic php and mysql.

4D1L mentioned what you should do.


Re: http - MerryDeer - 04.11.2016

Because that query not impose server, like imaginage playing 500 players, and you are saving /pm, there can by 20 sms/second or more, i have on 100 players issues, not of course just pm saving,money other things, queries too much they don't have time to complete..


Re: http - Dayrion - 04.11.2016

So.. Why do you save /pm in PHP? Why you don't write basically logs in a .txt or .log file ?


Re: http - MerryDeer - 04.11.2016

But that file can by very huge


Re: http - MerryDeer - 04.11.2016

ANOther question, how to connect to database in php file only one time? because if i always call to php file and always connect to database there will be a lot of connections..


Re: http - Sithis - 04.11.2016

MySQL queries are also threaded, just like HTTP requests. This means it won't impact the server in terms of blocking the main thread.


Re: http - CXdur - 04.11.2016

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
So.. Why do you save /pm in PHP? Why you don't write basically logs in a .txt or .log file ?
/pm cannot be saved in PHP, what he wants to do is to send a HTTP request to a php file that basically inserts it into the database, rather than doing it in the script. I don't think this should be of too much workload on your server considering the fact that they are threaded (yeah, even though most queries are - you could always look whether or not your queries are efficient if you notice that they take a lot of time, in a lot of cases they are not.

I haven't really worked with the HTTP function and just searched it up now, but it does seem like it should be possible. Whether it's worth doing or not I don't know, you would also have to check if it's valid somehow - coming from the script (in case someone finds the page etc), but this is something I don't know too much about so I won't comment on this.