[PHP] Setup donator
#1

Hey there!

Im searching for a workiing script to change user's (via $_GET['usr'] defined) the donator rank.
I mean:
1. donator.php?usr=test will runned by any client
2. Check existence of $path/scriptfiles/users/$_GET['usr'].ini
3. Open file, set Donator=1
4. close file
5. output status
How i may realize this?

thanks,
master2die
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=162584 Try reading that.
Reply
#3

You could also try using mysql php and mysql together is brilliant
Reply
#4

You would need to retrieve the file via ftp or scp or some type of file transfer if its located remotely.
Then you would need to use fopen() to attempt to open it, if it fails then the file dosent exist, obviously
After that you would need to fread() through the file, possible parse it (you could use simple string functions or something more complicated like a regex if you like), and edit your desired values.
Once your done that, you need to fwrite() the new data back into that file, and upload it back if its stored remote.

Another tip of mine would be to use a MySQL database or some other kind of file storage system and create a hash/user table system to cross reference the user with a randomly generated hash or encrypted value, or even just a random value altogether, to increase security.
Reply
#5

could you show me a example script?
Reply
#6

Quote:
Originally Posted by iLinx
Посмотреть сообщение
You would need to retrieve the file via ftp or scp or some type of file transfer if its located remotely.
Then you would need to use fopen() to attempt to open it, if it fails then the file dosent exist, obviously
After that you would need to fread() through the file, possible parse it (you could use simple string functions or something more complicated like a regex if you like), and edit your desired values.
Once your done that, you need to fwrite() the new data back into that file, and upload it back if its stored remote.

Another tip of mine would be to use a MySQL database or some other kind of file storage system and create a hash/user table system to cross reference the user with a randomly generated hash or encrypted value, or even just a random value altogether, to increase security.
Or you could be incredibly stupid - or smart - and create an RCON command to check a user's donation status, and modify it. RCON is just as secure as FTP you know. And probably quicker, too.
Reply
#7

Quote:
Originally Posted by Westie
Посмотреть сообщение
Or you could be incredibly stupid - or smart - and create an RCON command to check a user's donation status, and modify it. RCON is just as secure as FTP you know. And probably quicker, too.
Very true, RCON completely slipped my mind when I wrote that post.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)