Chart Rhyme Verse Endings - warwickfoster/qurantools GitHub Wiki
app/ajax/ajax_update_preferences.php
File:Purpose
The PHP script you provided is designed to handle user preference changes for a web application. It receives user input via POST request and updates the corresponding preferences in the database.
Functionality
The script performs the following actions based on the P
parameter in the POST request:
1. Preference Updates
- Italics Transliteration
- Hide Transliteration
- Formulaic Glosses
- Show Quick Tips
- Keyboard Layout
- Floating Pages
- Verse Count
- Default Mode
- Translator
- Colour Search (Highlight Colour)
- Colour Cursor
2. Input Validation
- The script checks the validity of user input for specific preferences, such as verse count, mode, and translator selection.
- It ensures that the input values are within valid ranges or default values if invalid.
3. Database Update
- The script updates the relevant fields in the
USERS
table in the database with the new preference values.
4. Success Message
- The script returns a success message after successfully updating the preferences.
Usage
To use the script, send a POST request with the following parameters:
U
: User IDT
: Ajax TokenP
: Preference nameV
: Preference value
Example
POST request:
U=123&T=abcdef&P=Italics&V=1
Additional Notes
- The script requires the
config.php
andfunctions.php
files to be included. - The
db_query()
anddb_quote()
functions are used for database operations. - The script assumes that the user is authenticated and authorized to make preference changes.