function addPlayer() { include_once "./model/player.php"; $player = new Player(); //upload picture here $picture = uploadPicture("./images/players", "player_picture"); $name = $_REQUEST['name']; $birth = $_REQUEST['birth']; $division = $_REQUEST['division']; $position = $_REQUEST['position']; $about = $_REQUEST['about']; $signed = $_REQUEST['signed']; include "../../model/player.php"; $player = new player(); if (!$player->add_player($name, $birth, $division, $position, $about, $signed, $picture)) { echo 'problem adding player, try again later'; return; } echo '' . $name . ' has been added successfully'; }
function addPlayer() { if (!isset($_SESSION['username']) || !isset($_SESSION['admin_password'])) { header("index.html"); } $name = $_REQUEST['name']; $birth = $_REQUEST['birth']; $division = $_REQUEST['division']; $position = $_REQUEST['position']; $picture = $_REQUEST['picture']; $about = $_REQUEST['about']; $signed = $_REQUEST['signed']; include "../../model/player.php"; $player = new player(); if (!$player->add_player($name, $birth, $division, $position, $about, $signed, $picture)) { echo '{"result": 0, "message": "problem adding player, try again later"}'; return; } echo '{"result": 0, "message": "' . $name . ' has been added successfully"}'; return; }