Example #1
0
<?php

session_start();
include 'funkcie.php';
include 'pouzivatelia.php';
include 'preteky.php';
$po = new POUZIVATELIA();
$po = POUZIVATELIA::vrat_pouzivatela($_GET["id"]);
if (isset($_POST['posli3'])) {
    vymaz_obrazok($_GET['id']);
    pridaj_obrazok($_GET['id']);
}
if (isset($_POST['vymaz'])) {
    vymaz_obrazok($_GET['id']);
}
$zobraz_form = true;
if (isset($_POST['posli2'])) {
    $po->vymaz_pouzivatela($_GET['id']);
    echo '<meta http-equiv="refresh" content="0; URL=index.php">';
    //unset($po);
    ?>
  
  <?php 
    echo '<p class="chyba">Vymazane!</p>';
    $zobraz_form = false;
}
if (isset($_POST['posli']) && over($_POST['meno']) && over($_POST['priezvisko'])) {
    $po->uprav_pouzivatela($_POST['meno'], $_POST['priezvisko'], $_POST['oddiel'], $_POST['oscislo'], $_POST['cip'], $_POST['poznamka'], $_POST['uspech']);
    unset($po);
    $po = new POUZIVATELIA();
    $po = POUZIVATELIA::vrat_pouzivatela($_GET["id"]);
Example #2
0
function pridaj_obrazok($id)
{
    if ($_FILES['obrazok']['type'] != 'image/png' && $_FILES['obrazok']['type'] != 'image/jpg' && $_FILES['obrazok']['type'] != 'image/jpeg' && $_FILES['obrazok']['type'] != 'image/gif' && $_FILES['obrazok']['type'] != 'image/bmp') {
    } else {
        $type = $_FILES['obrazok']['type'];
        $pripona = explode("/", $type);
        if (file_exists('pictures/' . $id . '.png')) {
            $subor = 'pictures/' . $id . '.png';
            unlink($subor);
            pridaj_obrazok($id);
        } else {
            if (file_exists('pictures/' . $id . '.jpg')) {
                $subor = 'pictures/' . $id . '.jpg';
                unlink($subor);
                pridaj_obrazok($id);
            } else {
                if (file_exists('pictures/' . $id . '.jpeg')) {
                    $subor = 'pictures/' . $id . '.jpeg';
                    unlink($subor);
                    pridaj_obrazok($id);
                } else {
                    if (file_exists('pictures/' . $id . '.gif')) {
                        $subor = 'pictures/' . $id . '.gif';
                        unlink($subor);
                        pridaj_obrazok($id);
                    } else {
                        if (isset($_FILES['obrazok'])) {
                            $novy_nazov = '';
                            if ($_FILES['obrazok']['error'] == UPLOAD_ERR_OK) {
                                if (is_uploaded_file($_FILES['obrazok']['tmp_name'])) {
                                    $novy_nazov = 'pictures/' . $id . '.' . $pripona[1] . '';
                                    $podarilosa = move_uploaded_file($_FILES['obrazok']['tmp_name'], $novy_nazov);
                                    if ($podarilosa) {
                                    }
                                    $novy_nazov = '';
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}