General developer forum

Socket server for database interface

This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.
Picture of Francois Herbert
Socket server for database interface
I have written a php socket server script which allows us to connect and perform various tasks on the user object.
The need for this was bought about by our users existing on a custom database administration system.
The only elments of the user object we are interested in are:
1. ID (read only)
2. Username (read/write)
3. Firstname (read/write)
4. Lastname (read/write)
5. Email Address (read/write)
6. deleted (write)
7. mnethostid (write)
8. auth (write)

All user record data to and from the system include the following fields (in char delimited form):
1. ID
2. Username
3. Firstname
4. Lastname
5. Email Address

It allows a system to connect and perform the following tasks:
1. List all users - using get_users_listing() and count_records_select() functions
2. Delete User - using get_complete_user_data() and update_record() function
3. Set User - using get_complete_user_data(), update_record(), and insert_record() functions.
4. Get User - using get_complete_user_data() function.

I guess you could call it a basic API at socket level to the moodle user table.

I have attached the code to judge interest also welcome comments regarding the break-ability of it (due to schema and code changes), and of course some constructive criticism smile

Please note, the user security at this stage is only for testing and this code must be modified according to your own security requirements.

Average of ratings: -