HEX
Server: Apache
System: Linux www3.pit.tblive.com 5.14.0-687.38.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 12 17:19:12 EDT 2026 x86_64
User: awaldron (1020)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/awaldron/_accomods/apidev.accomods.com/v1/school.php
<?php

//**********************************************************************************************************//
// Method: GET
// Endpoint: school/code/args[0]
// Params:
function get_v1_school_code( $args, $body, $uid, $is_admin, $db ) {
    $school_code = $args[0];
    $sql = "SELECT * FROM school_codes WHERE UPPER(school_code)='".strtoupper($school_code)."'";
    $school = qRow( $db, $sql );

    if (!$school) {
        $data = ['success'=>false, 'msg'=>'School Code not found.'];
    }
    else if ( !$school['code_active'] ) {
        $data = ['success'=>false, 'msg'=>'This school code has been disabled'];
    }
    else if ( strtotime($school['code_expires'])+86400 < time()) {
        $data = ['success'=>false, 'msg'=>'This school code has expired. Please contact Accomods to renew.' ];
    }
    else if ($school) {
        $data = ['success'=>true, 'payload'=>$school];
    }
    else {
        $data = ['success'=>false, 'msg'=>'An unknown error occurred.'];
    }

    response(200, $data);
}