<?php class mm { function aa($value1, $value2, $value3) { $string = file_get_contents("data/regis.json"); $j = json_decode($string, true); if (array_key_exists($value3, $j)) { $string = file_get_contents("data/clasdi.json"); $j = json_decode($string, true); if (count($j[$value1][$value2]['names']) == 0) { $j[$value1][$value2]['names'] = []; } if (array_search($value3, $j[$value1][$value2]['names']) === FALSE) { array_push($j[$value1][$value2]['names'], $value3); $string = json_encode($j); file_put_contents("data/clasdi.json", $string); } } else { //echo -100; } } } $m1 = new mm(); $m1->aa($_POST['uid'], $_POST['subject'], $_POST['studn']);
<?php class mm { function aa($value1, $value2) { $string = file_get_contents("data/paper.json"); $j = json_decode($string, true); echo json_encode($j[$value2][$value1]); } } $m1 = new mm(); $m1->aa($_POST['coun'], $_POST['token']);
echo 1; } else { echo -1; } } else { echo -1; } } function aa1($value1, $value2) { $string = file_get_contents("data/teach.json"); $j = json_decode($string, true); if (array_key_exists($value1, $j)) { if ($j[$value1] == $value2) { echo 1; } else { echo -1; } } else { echo -1; } } } if (isset($_POST['uid'])) { $m1 = new mm(); if ($_POST['t'] == 0) { $m1->aa($_POST['uid'], $_POST['pwd']); } else { $m1->aa1($_POST['uid'], $_POST['pwd']); } }