Skip to main content

CSV Storage

Overview​

Form submissions are stored as CSV files on the server after all validation passes. The URL is prefixed into the message text before the row is saved, so the existing CSV schema remains unchanged.

Directory Structure​

/opshell-contact-submissions/
├── index.php (directory listing protection)
├── messages.csv (successful submissions)
└── failed-verifications.csv (failed Reoon verifications)

The directory is created at dirname(ABSPATH, 2) . "/opshell-contact-submissions", outside the web root for security.

messages.csv Schema​

ColumnDescription
timestampcurrent_time("mysql")
ip$_SERVER["REMOTE_ADDR"] (sanitized)
nameSanitized text field
emailSanitized email
subjectSanitized text field
messageSanitized textarea; optionally prefixed with Website or server URL: {url}

failed-verifications.csv Schema​

Additional columns beyond the common row:

ColumnDescription
verification_statusReoon response status
is_safe_to_sendJSON-encoded boolean
verification_mode"power"
overall_scoreString score
errorError message

Access Control​

  • Directory is outside web root (not accessible via HTTP)
  • index.php prevents directory listing if directory were accessible
  • File operations use flock(LOCK_EX) for concurrent write safety
  • New file creation checks parent directory existence

CSV Functions​

FunctionPurpose
opshell_contact_submissions_dir()Create/get submissions directory
opshell_append_contact_csv()Thread-safe CSV row append
opshell_save_contact_submission_csv()Save successful submission
opshell_save_failed_contact_verification_csv()Save failed verification