header("Content-Type:application/json; charset=utf-8"); require_once('loader.php'); # check params if( !isset($_POST['action']) ) print_response_msg( 0 ); # login if ( $_POST['action']=='login' && !check_login_status( false ) ) login( $_POST['uacc'], $_POST['upwd'] ); check_login_status(); switch($_POST['action']){ case 'get_sessionData': $result = get_sessionData(); print_response_msg( ( is_array($result) ? 4 : 5 ), ( is_array($result) ? $result : null ) ); break; case 'get_record': $result = get_record(); print_response_msg( ( is_array($result) ? 4 : 5 ), ( is_array($result) ? $result : null ) ); break; case 'update_record':
function update_record( $column ){ # SQL Injection examine if ( strlen($column) > 8 ) return false; for ( $i=0 ; $i<strlen($column) ; $i++ ) if ( ($column{$i} < 'a') || ($column{$i} > 'z') ) return false; $sessionData = get_sessionData(); $sql = "UPDATE record SET ".$column."='1' WHERE record_id=? "; return sql_i( $sql, array( $sessionData['record_id'] ) ); }