function execChangeProfile($firstname, $lastname, $sex, $departmentID) { if (!isValidName($firstname) || !isValidName($lastname)) { return "Please enter valid names!"; } if (!isValidID($departmentID)) { return "Invalid department id!"; } $departDAO = new DepartmentDAO(); $depart = $departDAO->getDepartmentByID($departmentID); if ($depart === null) { return "Could not find the depart!"; } $userDAO = new UserDAO(); $user = $userDAO->getUserByID($_SESSION["userID"]); $user->setDepartment($depart); if ($user->getFirstName() != $firstname) { $user->setFirstName($firstname); } if ($user->getLastName() != $lastname) { $user->setLastName($lastname); } if ($user->getGender() != $sex) { $user->setGender($sex); } if (isset($_FILES["uploadphoto"])) { $ans = uploadPhoto($user, $_FILES["uploadphoto"]); if ($ans !== true) { return $ans; } } $userDAO->updateUser($user); return true; }
//Verifico la sesion include_once "../checkSession.php"; include_once "../functions.php"; $checkArray = array('nombre', 'grupo'); if (checkAllPost($checkArray)) { //Traigo las clases Antes del POST para ver los grupos en la barra izquierda include_once "../classes/jugador.php"; include_once "../classes/grupo.php"; include_once "../security.php"; //Mysql Inyection $db = new Database(); $nombre = $db->checkInjection($_POST['nombre']); $id = $db->checkInjection($_POST['grupo']); //Si eligio imagen y pudo subirse al server if (uploadPhoto("{$id}.jpg", 'grupos')) { $path = "../images/grupos/{$id}.jpg"; } else { $path = "../images/grupos/default.jpg"; } $g = new grupo(); //Le asigno los datos al grupo creado arriba $g->setNombre($nombre); $g->setFoto($path); $g->setId($id); //Guardo el objeto en la Db if ($g->objectToDb()) { if ($g->addAdmin($_SESSION['id'])) { alertMessage("Grupo Creado con Éxito"); } else { alertMessage("Hubo un error Agregandote al Grupo");
<?php include_once "../functions.php"; $checkArray = array('nombre', 'foto'); if (checkAllPost($checkArray)) { include_once "../classes/conexiones.php"; include_once "../classes/grupo.php"; include_once "../security.php"; //Mysql Inyection $db = new Database(); $nombre = $db->checkInjection($_POST['nombre']); //Traer ultimo ID, el que le corresponde al nuevo grupo $id = $g->nextId(); //Si eligio imagen y pudo subirse al server if (uploadPhoto("{$id}.jpg", 'login')) { $path = "../images/grupo/{$id}.jpg"; } else { $path = "../images/grupo/default.jpg"; } //Creo objeto y le asigno los datos $g = new grupo($nombre, $path); //Guardo el objeto en la Db $g->objectToDb(); } //Traigo la vista include_once "../view/addGroup.php";
public function loadProfil() { $pseudouser = str_replace(' ', '-', $_SESSION['user']['pseudo']); $succes = ""; $error = ""; $nomville = ""; if (!empty($_POST)) { if (!empty($_POST['modifyProfil'])) { $verification = new Verification($_POST); $verificationPhoto = new Verification($_FILES); $verification->notEmpty('email', "Veuillez compléter le champ email."); $verification->notEmpty('nom', "Spécifiez votre nom de famille."); $verification->notEmpty('prenom', "Spécifiez votre prénom."); $verification->notEmpty('sexe', "Êtes-vous un homme ou une femme?"); $verification->notEmpty('ville', "Choississez une ville."); $error .= $verification->error; if ($verification->isValid()) { if (!empty($_FILES['photo']['name'])) { $verificationPhoto->PhotoOk('photo', $pseudouser . '.jpg', 'Users/Profil', false); } if (!empty($_FILES['couverture']['name'])) { $verificationPhoto->PhotoOk('couverture', $pseudouser . '.jpg', 'Users/Bannière', false); } if (!$verificationPhoto->isValid()) { $error .= "Un problème s'est produit lors de l'ajout des photos."; } else { if (!empty($_FILES['photo']['name'])) { deletePhoto($pseudouser . '.jpg', 'Users/Profil', 'photo'); } if (!empty($_FILES['couverture']['name'])) { deletePhoto($pseudouser . '.jpg', 'Users/Bannière', 'couverture'); } /*upload images*/ // $error .= uploadPhoto($pseudouser . '.jpg', 'Users/Profil', 'photo'); $error .= uploadPhoto($pseudouser . '.jpg', 'Users/Bannière', 'couverture'); } if (empty($error)) { $ville = $this->groupe->getVilleByName($_POST['ville'])->fetch(); $id_ville = $ville['id']; $this->user->modifierProfil($_SESSION['user']['pseudo'], $id_ville); $succes = "Profil modifié avec succès!"; } } } if (!empty($_POST['changePw'])) { $verification = new Verification($_POST); $verificationPhoto = new Verification($_FILES); $verification->notEmpty('ex_mot_de_passe', "Veuillez spécifier votre ancien mot de passer."); $verification->notEmpty('mot_de_passe', "Spécifiez votre nouveau mot de passe."); $verification->notEmpty('mot_de_passe_confirmation', "Retapez votre nouveau mot de passe."); $error .= $verification->error; if ($verification->isValid()) { if ($this->user->CheckPasswordUser()) { if ($_POST['mot_de_passe'] == $_POST['mot_de_passe_confirmation']) { if (passwordOk($_POST['mot_de_passe'])) { $this->user->updatePw(); $data = $this->user->CheckUser()->fetch(); $_SESSION['user'] = $data; $succes = "Mot de passe modifié avec succès."; } else { $error .= 'Le mot de passe ne possède pas les bons critères'; } } else { $error .= 'Les deux nouveaux mots de passent ne correspondent pas.'; } } else { $error .= "L'ancien mot de passe fourni n'est pas correcte."; } } } } $id_ville = $_SESSION['user']['id_ville']; if (!empty($_SESSION['user']['id_ville'])) { $ville = $this->groupe->getVilleById($id_ville)->fetch(); $nomville = $ville['name']; } $_SESSION['user'] = $this->user->getDataUser($_SESSION['user']['pseudo'])->fetch(); //refresh la session. $vue = new Vue("Profil", "User", ['stylesheet.css'], ['calendrier.js', 'modifier_profil.js', 'showphoto.js', 'RechercheGroupe.js', 'Verification.js']); $vue->loadpage(['nomville' => $nomville, 'pseudouser' => $pseudouser, 'error' => $error, 'succes' => $succes]); }
<?php include './functions/database_logic.php'; include './functions/photo_logic.php'; session_start(); $ip = get_client_ip(); $nick = $_SESSION['nick']; $email = $_SESSION['email']; $albumName = $_POST['albumName']; $access = $_POST['access']; if (!isAlbum($nick, $albumName)) { if (newAlbum($ip, $nick, $email, $albumName, $access, "DEFAULT")) { if (isset($_FILES['albumCover'])) { $albumCover = $_FILES['albumCover']; if (acceptImage($albumCover)) { $path = "data/" . $nick . "/" . $albumCover["name"]; $error = uploadPhoto($ip, $albumCover, $nick, $email, $path, $albumName); if ($error != '0') { $path = "DEFAULT"; } } setAlbumCover($nick, $albumName, $path); header("Location: ../albums.php"); } } } ?>
function _uploadPhotos($fileVariableName, $filepath) { foreach ($_FILES[$fileVariableName]['name'] as $index => $value) { $fileName = $_FILES[$fileVariableName]['name'][$index]; uploadPhoto($fileVariableName, $filepath, $fileName); } }
$age = $_POST['age']; $gender = $_POST['gender']; $avatar = $_FILES['avatar']; if (newUser($ip, $nick, $password, $email, $name, $surname, $age, $gender)) { echo "Usuario registrado.<br/>"; $path = "data/user.png"; if (isset($_FILES['avatar'])) { if (acceptImage($avatar)) { echo "Imagen aceptada.<br/>"; $path = "data/" . $nick; if (!file_exists("../" . $path) and !is_dir("../" . $path)) { mkdir("../" . $path, 0777, true); // 0777 default for folder, rather than 0755 } $path = $path . "/" . $avatar["name"]; $error = uploadPhoto($ip, $avatar, $nick, $email, $path, "Fotos de Perfil"); if ($error != '0') { $path = "data/user.png"; switch ($error) { case '1': echo "No se ha podido crear el álbum de fotos."; break; case '2': echo "No se ha podido añadir la foto a la base de datos."; break; case '3': echo "No se ha podido la foto."; break; default: echo $error; break;
function ajaxafg_flickr_send() { global $pf, $wpdb; $results = ''; $error = 0; /* Check if both name and file are filled in */ if (!$_POST['afgfirstname'] || !$_POST["img_src"]) { $error = 1; $results = "You must enter your name and a file to upload"; if (file_exists(AFGPATH . '/' . $_POST["img_src"])) { unlink(AFGPATH . '/' . $_POST["img_src"]); } } else { if (!isset($_POST['afgtsandcs']) || intval($_POST['afgtsandcs']) != 1) { $error = 1; $results = "You must accept the terms and conditions"; if (file_exists(AFGPATH . '/' . $_POST["img_src"])) { unlink(AFGPATH . '/' . $_POST["img_src"]); } } else { if (CODEDEBUG) { //file_put_contents(AFGPATH.'/file.log', 'upload-afg_flickr_send'); $content = print_r($_POST, true); file_put_contents(AFGPATH . '/file.log', $content, FILE_APPEND); } $fname = $_POST['afgfirstname']; $email = $_POST['afgyouremail']; $tsandcs = $_POST['afgtsandcs']; $newpath = AFGPATH . '/' . $_POST["img_src"]; include 'lib/wideimage-11.02.19/WideImage.php'; $wideImage = new WideImage(); $w = (int) $_POST['afgw'] ? $_POST['afgw'] : 530; $h = (int) $_POST['afgh'] ? $_POST['afgh'] : 530; $workingImg = $wideImage->load($newpath); if (isset($_POST['afgx']) && isset($_POST['afgy'])) { $x = (int) $_POST['afgx']; $y = (int) $_POST['afgy']; $workingImg = $workingImg->crop($x, $y, $w, $h); } else { $workingImg = $workingImg->crop(0, 0, $w, $h); } $workingImg->saveToFile($newpath); $description = $fname . "\n" . $email . "\n" . $tsandcs; /* Call uploadPhoto on success to upload photo to flickr */ $photoid = uploadPhoto($newpath, $name, $description); if (CODEDEBUG) { file_put_contents(AFGPATH . '/file.log', $photoid, FILE_APPEND); } if (!$photoid) { $error = 1; $results = "Something has gone wrong"; unlink($newpath); } else { $photoinfo = $pf->photos_getInfo($photoid); //$getTwin = $pf->photos_search(array()) ; $results = array('firstname' => '', 'lastname' => '', 'youremail' => '', 'phonenumber' => '', 'sport' => '', 'age' => '', 'gender' => '', 'imagetitle' => '', 'imagestory' => '', 'yourfile' => '', 'tsandcs' => '', 'consent' => '', 'commsphone' => '', 'commsemail' => ''); $rules = array('firstname' => 'notEmpty', 'lastname' => 'notEmpty', 'youremail' => 'email'); $messages = array('firstname' => "Please enter your first name", 'lastname' => "Please enter your surname", 'youremail' => "Please enter your email address"); foreach ($results as $key => $value) { $results[$key] = $_POST['afg' . $key]; } $errors = validateInputs($results, $rules, $messages); if (count($errors) == 0) { $error = False; } $age = intval($results['age']); //echo "SELECT *, 10 AS relevance FROM ". $wpdb->prefix ."flickrtwins WHERE age='". . "' OR age='" . intval($results['age']) - 1 . "' "; $sqlbits = array(); $sqlbits[] = isset($results['sport']) ? "SELECT *, 50 AS relevance FROM " . $wpdb->prefix . "flickrtwins WHERE sport='" . $results['sport'] . "' " : ''; $sqlbits[] = isset($results['age']) ? "SELECT *, 30 AS relevance FROM " . $wpdb->prefix . "flickrtwins WHERE age='" . $age . "' " : ''; $sqlbits[] = isset($results['age']) ? "SELECT *, 10 AS relevance FROM " . $wpdb->prefix . "flickrtwins WHERE age='" . strval($age + 1) . "' OR age='" . strval($age - 1) . "' " : ''; $sqlbits[] = isset($results['gender']) ? "SELECT *, 20 AS relevance FROM " . $wpdb->prefix . "flickrtwins WHERE gender='" . $results['gender'] . "' " : ''; $sql2 = implode(' UNION ', $sqlbits); $sql = "SELECT *, sum(relevance) as rel FROM ({$sql2}) results ORDER BY sum(relevance) desc LIMIT 0,1;"; //echo $sql; $match = $wpdb->get_row($sql); //var_dump( $wpdb->last_query ); if ($match->id == null) { $match = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}flickrtwins ORDER BY RAND() LIMIT 0,1 "); } /*make flat*/ //echo afg_get_photo_url($photoinfo['photo']['farm'], $photoinfo['photo']['server'], $photoinfo['photo']['id'], $photoinfo['photo']['secret'], '_n'); $user = $workingImg->resize(255, 255); unlink($newpath); $twin = $wideImage->load(afg_get_photo_url($match->farm, $match->server, $match->photoid, $match->photosecret, '_n'))->resize(255, 255); $frame = $wideImage->load(AFGPATH . '/images/frame.png')->merge($user, 9, 7)->merge($twin, 264, 7); $pathinfo = pathinfo($_POST["img_src"]); $newpath = AFGPATH . '/uploads/twins/' . $pathinfo['filename'] . '_framed.' . $pathinfo['extension']; $frame->saveToFile($newpath); $twinoid = uploadPhoto($newpath, 'twin ' . $name, $description); unlink($newpath); $twininfo = $pf->photos_getInfo($twinoid); $wpdb->insert($wpdb->prefix . "flickruploads", array('fname' => $results['firstname'], 'lname' => $results['lastname'], 'email' => $results['youremail'], 'phone' => isset($results['phonenumber']) ? strip_tags($results['phonenumber']) : '', 'sport' => isset($results['sport']) ? strip_tags($results['sport']) : 0, 'age' => isset($results['age']) ? strip_tags($results['age']) : '', 'gender' => isset($results['gender']) ? strip_tags($results['gender']) : '', 'imagetitle' => isset($results['imagetitle']) ? substr(strip_tags($results['imagetitle']), 0, 80) : '', 'imagestory' => isset($results['imagestory']) ? substr(strip_tags($results['imagestory']), 0, 200) : '', 'photoid' => $photoinfo['photo']['id'], 'photosecret' => $photoinfo['photo']['secret'], 'farm' => $photoinfo['photo']['farm'], 'server' => $photoinfo['photo']['server'], 'twinlid' => $match->id, 'flatid' => $twininfo['photo']['id'], 'flatsecret' => $twininfo['photo']['secret'], 'flatfarm' => $twininfo['photo']['farm'], 'flatserver' => $twininfo['photo']['server'], 'tsandcs' => isset($results['tsandcs']) ? 1 : 0, 'consent' => isset($results['consent']) ? 1 : 0, 'commsphone' => isset($results['commsphone']) ? 1 : 0, 'commsemail' => isset($results['commsemail']) ? 1 : 0, 'submittedtime' => date('Y-m-d H:i:s'))); if (CODEDEBUG) { $content = print_r($wpdb->queries, true); file_put_contents(AFGPATH . '/file.log', $content, FILE_APPEND); file_put_contents(AFGPATH . '/file.log', $wpdb->print_error(), FILE_APPEND); } $results['photouploaded'] = array('id' => $photoinfo['photo']['id'], 'secret' => $photoinfo['photo']['secret'], 'farm' => $photoinfo['photo']['farm'], 'server' => $photoinfo['photo']['server']); $results['phototwin'] = array('id' => $twininfo['photo']['id'], 'secret' => $twininfo['photo']['secret'], 'farm' => $twininfo['photo']['farm'], 'server' => $twininfo['photo']['server']); $results['match'] = $match->id; $results['matchedwith'] = array('id' => $match->photoid, 'secret' => $match->photosecret, 'farm' => $match->farm, 'server' => $match->server); $results['insertid'] = $wpdb->insert_id; $template = 'emails/email-thankyou'; if (trim(stripslashes(substr(strip_tags($results['imagetitle']), 0, 80))) == '' && trim(stripslashes(substr(strip_tags($results['imagestory']), 0, 200))) == '') { $template = 'emails/email-thankyou2'; } $vars = array('email' => $template, 'subject' => 'Thank you', 'firstname' => $results['firstname'], 'image' => afg_get_photo_url($results['photouploaded']['farm'], $results['photouploaded']['server'], $results['photouploaded']['id'], $results['photouploaded']['secret'], '_n'), 'twin' => afg_get_photo_url($match->farm, $match->server, $match->photoid, $match->photosecret, '_n'), 'usertitle' => stripslashes(substr(strip_tags($results['imagetitle']), 0, 80)), 'userstory' => stripslashes(substr(strip_tags($results['imagestory']), 0, 200)), 'uniceftitle' => stripslashes($match->imagetitle), 'unicefstory' => stripslashes($match->imagestory), 'shareurl' => urlencode(add_query_arg(array('id' => $results['insertid'], 'showtwin' => '1'), get_home_url())), 'sharepic' => afg_get_photo_url($twininfo['photo']['farm'], $twininfo['photo']['server'], $twininfo['photo']['id'], $twininfo['photo']['secret'], null)); if (CODEDEBUG) { $content = print_r($vars, true); file_put_contents(AFGPATH . '/file.log', $content, FILE_APPEND); } sendemail($results['youremail'], $results['firstname'] . ' ' . $results['lastname'], $vars, 0); } } } if (CODEDEBUG) { $content = print_r($results, true); file_put_contents(AFGPATH . '/file.log', $content, FILE_APPEND); } return $results; }
<input type="text" class="input input-sm pSubcateg pull-left" list="subcategNames" > <datalist id="subcategNames"> </datalist> <input type="text" class="input input-sm pColor pull-left" list="colorNames" > <?php productCategory::getColorOptions(); ?> <input type="text" class="btn btn-primary descr" readonly> </div> --> <?php // $number = 11; // $numberHex = dechex($number); // echo "number hex is $numberHex"; if ($_FILES) { echo "<p>here</p>"; uploadPhoto("image", "newFile"); echo "<p>your file is uploaded</p>"; } echo "<p> here</p>"; print_r($_POST); ?> <form action="test.php" method="post" enctype="multipart/form-data"> upload photo <input type="file" name="image"> <input type="submit"> </form> <script> </script> <?php include 'template/blankEnd.php';
public function loadCreationGroupe() { $succes = ''; $error = ''; if (!empty($_POST)) { $nomphoto = str_replace(' ', '-', $_POST['nom']); if (!empty($_FILES['photogroupe']['name'])) { $error .= "Veuillez selectionner une photo de groupe!"; } if (!empty($_FILES['Bannière']['name'])) { $error .= "Veuillez selectionner une Bannière pour le groupe!"; } $verification = new Verification($_POST); $verificationPhoto = new Verification($_FILES); $verification->notEmpty('nom', "Veuillez spécifier un nom à votre groupe."); $verificationPhoto->PhotoOk('photogroupe', $nomphoto . '.jpg', 'Groupes/Profil'); $verificationPhoto->PhotoOk('Bannière', $nomphoto . '.jpg', 'Groupes/Bannière'); $verification->notEmpty('categorie', "Veuillez séléctionner une catégorie."); $verification->notEmpty('nombre', "Indiquez le nombre maximal de membres."); $verification->notEmpty('sport', "Choississez un sport."); $verification->notEmpty('ville', "Choississez une ville."); $verification->notEmpty('description', "Décrivez votre groupe."); $verification->notEmpty('niveau', "Veuillez préciser le niveau."); // $verification->notEmpty('visibilite', "Votre groupe sera-il privé ou public?"); $error = $verification->error; $error .= $verificationPhoto->error; if (!$verificationPhoto->isValid()) { $error .= "Ce groupe existe déjà! Veuillez choisir un autre nom."; } if ($verification->isValid() && $verificationPhoto->isValid()) { // && $verificationPhoto->isValid()){ /*upload images*/ $error .= uploadPhoto($nomphoto . '.jpg', 'Groupes/Profil', 'photogroupe'); $error .= uploadPhoto($nomphoto . '.jpg', 'Groupes/Bannière', 'Bannière'); //Add BDD if (empty($error)) { $ville = $this->groupe->getVilleByName($_POST['ville'])->fetch(); $_POST['ville'] = intval($ville['id']); $id = $this->groupe->addGroupe(); $this->user->addLeader($id); $succes = "Groupe ajouté avec succès!</br> Vous pouvez consulter sa page en cliquant "; } } } $categorie = $this->groupe->getCategory()->fetchAll(); $sports = $this->sport->getSports()->fetchAll(); $niveau = $this->groupe->getNiveau()->fetchAll(); $vue = new Vue("CreationGroupe", "Groupe", ['font-awesome.css', 'stylesheet.css'], ['showphoto.js', 'RechercheGroupe.js']); // CSS a unifier dans le meme fichier $vue->loadpage(['sports' => $sports, 'categorie' => $categorie, 'error' => $error, 'succes' => $succes, 'id' => $id, 'niveau' => $niveau]); }
echo '<br>File error'; echo "Error: " . $_FILES["file"]["error"] . "<br />"; } else { if ($_FILES["file"]["type"] != "image/jpg" && $_FILES["file"]["type"] != "image/jpeg" && $_FILES["file"]["type"] != "image/png" && $_FILES["file"]["type"] != "image/gif") { echo 'Error 3'; $error = 3; } else { if (intval($_FILES["file"]["size"]) > 1525000) { echo 'Error 4'; $error = 4; } else { $dir = dirname($_FILES["file"]["tmp_name"]); $newpath = $dir . "/" . $_FILES["file"]["name"]; rename($_FILES["file"]["tmp_name"], $newpath); //Instantiate phpFlickr $status = uploadPhoto($newpath, $_POST["name"]); if (!$status) { $error = 2; } } } } } } function uploadPhoto($path, $title) { $apiKey = "e0fb27a9db978169247afe3169afba43"; $apiSecret = "d9a3f7d933ae7ccf"; $permissions = "write"; $token = "72157662014557483-df831fa3afbc5468"; $f = new phpFlickr($apiKey, $apiSecret, true);
include_once "../classes/jugador.php"; include_once "../security.php"; //Mysql Inyection $db = new Database(); $nombre = $db->checkInjection($_POST['nombre']); $apellido = $db->checkInjection($_POST['apellido']); $dni = $db->checkInjection($_POST['dni']); $sexo = $db->checkInjection($_POST['sexo']); $celular = $db->checkInjection($_POST['celular']); $email = $db->checkInjection($_POST['email']); $pais = $db->checkInjection($_POST['pais']); $localidad = $db->checkInjection($_POST['localidad']); $login = $db->checkInjection($_POST['login']); $pass = $db->checkInjection($_POST['pass']); //Si eligio imagen y pudo subirse al server if (uploadPhoto("{$login}.jpg", 'login')) { $path = "../images/login/{$login}.jpg"; } else { $path = "../images/login/default.jpg"; } //Creo un jugador y le asigno los datos $j = new jugador($nombre, $apellido, $dni, $sexo, $celular, $email, $pais, $localidad, $login, '', '', $path); //Creo el Salt y Hasheo la password $salt = $j->createSalt(); $hashedpass = $j->createHash($pass, $salt); //Asigno el halt y el pass al objeto $j->setSalt($salt); $j->setPass($hashedpass); if (!$j->exists()) { $j->objectToDb(); } else {
public function loadBackOfficeClub() { if (!empty($_POST)) { if (isset($_POST['modifierclub'])) { $verification = new Verification($_POST); $verificationPhoto = new Verification($_FILES); if (!empty($_FILES['photo']['name'])) { $verificationPhoto->PhotoOk('photo', $_POST['nomclub'] . '.jpg', 'Clubs/Bannière/', false); } $verification->notEmpty('informations', "Veuillez remplir la description du club."); $verification->notEmpty('telephone', "Veuillez remplir le numéro de téléphone du club."); $verification->notEmpty('email', "Veuillez remplir l'adresse email du club."); $verification->notEmpty('lien', "Veuillez ajouter le lien du site du club."); $verification->notEmpty('adresse', "Veuillez remplir l'adresse du club."); $error = $verification->error; if ($verification->isValid() && $verificationPhoto->isValid()) { if (!empty($_FILES['photo']['name'])) { deletePhoto($_POST['nomclub'] . '.jpg', 'Clubs/Bannière', 'photo'); } /*upload images*/ $error .= uploadPhoto($_POST['nomclub'] . '.jpg', 'Clubs/Bannière', 'photo'); if (empty($error)) { $this->admin->updateClub($_POST['id_club']); $succes = "Club modifié avec succès!"; } } } if (isset($_POST['addclub'])) { if (!empty($_FILES['photo']['name'])) { $error .= "Veuillez selectionner une icone pour le club."; } $verification = new Verification($_POST); $verificationPhoto = new Verification($_FILES); $verification->notEmpty('informations', "Veuillez remplir la description du club."); $verification->notEmpty('telephone', "Veuillez remplir le numéro de téléphone du club."); $verification->notEmpty('email', "Veuillez remplir l'adresse email du club."); $verification->notEmpty('lien', "Veuillez ajouter le lien du site du club."); $verification->notEmpty('nom', "Veuillez remplir le nom du club."); $verification->notEmpty('adresse', "Veuillez remplir l'adresse du club."); $nomclub = str_replace(' ', '-', $_POST['nom']); $verificationPhoto->PhotoOk('photo', $nomclub . '.jpg', 'Clubs/Bannière'); $error = $verification->error; if ($verification->isValid() && $verificationPhoto->isValid()) { $error .= uploadPhoto($nomclub . '.jpg', 'Clubs/Bannière/', 'photo'); if (empty($error)) { $this->admin->addClub(); $succes = "Club ajouté avec succès!"; } } } if (isset($_POST['Suppr'])) { //supprimer club ici. $this->admin->deleteClub(); $succes = "Suppression réussie!"; } } $clubs = $this->groupe->getClubs()->fetchAll(); $vue = new Vue("BackOfficeClub", "Admin", ['font-awesome.css', 'admin.css'], ['Admin/admin.js']); $vue->loadbackoffice(['clubs' => $clubs, 'error' => $error, 'succes' => $succes]); }
<?php include_once './functions/database_logic.php'; include './functions/photo_logic.php'; session_start(); $ip = get_client_ip(); $nick = $_SESSION['nick']; $email = $_SESSION['email']; $albumName = $_POST['albumName']; if (isset($_FILES['image']) and acceptImage($_FILES['image'])) { echo "Imagen aceptada.<br/>"; $image = $_FILES['image']; $path = "data/" . $nick . "/" . $image["name"]; echo $ip . " " . $nick . " " . $email . " " . $path . " " . $albumName; $error = uploadPhoto($ip, $image, $nick, $email, $path, $albumName); switch ($error) { case '0': header("Location: ../photos.php?album=" . $albumName); break; case '1': echo "No se ha podido crear el álbum de fotos."; break; case '2': echo "No se ha podido añadir la foto a la base de datos."; break; case '3': echo "No se ha podido subir la foto."; break; default: echo $error; break;
$files[filemtime($baseDir . $file)] = $file; } } closedir($handle); } // Sort by mod time. ksort($files); // Last ones first. $files = array_reverse($files); // List if URLs. $urls = array(); // Create a list of URLs to the most recent files. $fileCounter = 0; foreach ($files as $file) { ++$fileCounter; // We only get TEN recent files (100 is too many!). if ($fileCounter > 10) { // TODO: Move excessive files to an archive directory? break; } array_push($urls, $baseURL . $file); } return $urls; } // If file data is posted then upload the file, // else get the list of image urls. if (isset($_FILES["file"])) { uploadPhoto(); } else { getPhotoURLs(); }
removeDosage(intval($r)); break; case 'updateCategory': updateCategory(intval($r), $s); break; case 'updateProduct': updateProduct(intval($r), $s, $t); break; case 'updateDosage': updateDosage(intval($r), $s, $t); break; case 'updateCompound': updateCompound(intval($r), $s, $t); break; case 'uploadPhoto': uploadPhoto(intval($r), $s); break; default: return false; break; } ?> <?php function test() { echo "<h2>This could be an XML specification that your js interprets... but for starters just make it an element. <h2>"; } function addCategory() { //adds that category to the database
move_uploaded_file($_FILES['photo']['tmp_name'], $upfile); $img = 'http://test/upload/' . $_FILES['photo']['name']; mysql_query("UPDATE user_photoes SET photo='{$img}' WHERE user_email='{$email}'"); } else { return "<tr><td><p class='error'>Неверный тип файла</p></td></tr>"; } } else { return "<tr><td><p class='error'>Файл слишком большой</p></td></tr>"; } } else { return "<tr><td><p class='error'>Ошибка при загрузке файла</p></td></tr>"; } } } function showPhoto($email) { $res = mysql_query("SELECT photo FROM user_photoes WHERE user_email='{$email}'"); $row = mysql_fetch_array($res); echo $row['photo']; } function showCover($email) { $res = mysql_query("SELECT cover FROM user_photoes WHERE user_email='{$email}'"); $row = mysql_fetch_array($res); echo $row['cover']; } $change_name = changeName($change_name_NAME, $change_name_PASSWORD, $pass, $email); $change_password = changePassword($email, $pass, $changePassword_old_password, $changePassword_new_password, $changePassword_new_password2); $change_cover = uploadCover($_FILES['cover'], $email); $change_photo = uploadPhoto($_FILES['photo'], $email);
$completed = checkComplete(); if ($completed == false) { header('Location:completeAccount.php'); } } if (isset($_GET['q'])) { logout(); header("location:login.php"); } if (isset($_REQUEST['postStatus'])) { extract($_REQUEST); postStatus($post, 0); } if (isset($_REQUEST['photoSubmit'])) { // extract($_REQUEST); $uploaded = uploadPhoto($_FILES["fileToUpload"]); if ($uploaded) { header('Location:index.php'); } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Home</title> <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="css/bootstrap-theme.min.css">