před touto funkcí mám jen jiné funkce, které ošetří dané proměnné z formuláře, podmínky a potom následné zapsání proměnných do databáze... nic víc
tudíž jsme žádnou hlavičku neposílal, ne?
celý code:
<?php
session_start();
if (isset($_GET['action']) && $_GET['action'] == 'odhlasit_se') {
$_SESSION['name'] = '';
$_SESSION['id'] = '';
$_SESSION['rank'] = '';
unset ($_SESSION['name']);
unset ($_SESSION['id']);
unset ($_SESSION['rank']);
}
?>
<?php
if (isset($_POST['go_modify_prof'])) {
if (isset($_POST['age_new'])) {
$age_new = stripslashes(htmlspecialchars(trim(substr($_POST['age_new'], 0, 3))));
}
if (isset($_POST['born_new'])) {
$born_new = stripslashes(htmlspecialchars(trim($_POST['born_new'])));
}
if (isset($_POST['sex_new'])) {
$sex_new = stripslashes(htmlspecialchars(trim($_POST['sex_new'])));
}
if (isset($_POST['group_visit_new'])) {
$group_visit_new = stripslashes(htmlspecialchars(trim($_POST['group_visit_new'])));
}
if (isset($_POST['subject_visit_new'])) {
$subject_visit_new = stripslashes(htmlspecialchars(trim($_POST['subject_visit_new'])));
}
if (isset($_POST['list_id_new'])) {
$list_id_new = stripslashes(htmlspecialchars(trim($_POST['list_id_new'])));
}
if (isset($_POST['style_web_new'])) {
$style_web_new = stripslashes(htmlspecialchars(trim($_POST['style_web_new'])));
}
if (isset($_POST['type_web_new'])) {
$type_web_new = stripslashes(htmlspecialchars(trim($_POST['type_web_new'])));
}
if (isset($_POST['state_new'])) {
$state_new = stripslashes(htmlspecialchars(trim($_POST['state_new'])));
}
if (isset($_POST['city_new'])) {
$city_new = stripslashes(htmlspecialchars(trim($_POST['city_new'])));
}
if (isset($_POST['street_new'])) {
$street_new = stripslashes(htmlspecialchars(trim($_POST['street_new'])));
}
if (isset($_POST['psc_new'])) {
$psc_new = stripslashes(htmlspecialchars(trim($_POST['psc_new'])));
}
if (isset($_POST['skype_new'])) {
$skype_new = stripslashes(htmlspecialchars(trim($_POST['skype_new'])));
}
if (isset($_POST['icq_new'])) {
$icq_new = stripslashes(htmlspecialchars(trim($_POST['icq_new'])));
}
if (isset($_POST['mobil_new'])) {
$mobil_new = stripslashes(htmlspecialchars(trim($_POST['mobil_new'])));
}
if (isset($_POST['web_new'])) {
$web_new = stripslashes(htmlspecialchars(trim($_POST['web_new'])));
}
if (isset($_POST['job_new'])) {
$job_new = stripslashes(htmlspecialchars(trim($_POST['job_new'])));
}
if (isset($_POST['school_new'])) {
$school_new = stripslashes(htmlspecialchars(trim($_POST['school_new'])));
}
if (isset($_POST['me_new'])) {
$me_new = stripslashes(htmlspecialchars(trim(substr($_POST['me_new'], 0, 500))));
}
$last_up = Date("j/m/Y H:i:s", Time());
$photo_new = ($_FILES['photo_new'] ['tmp_name']);
$photo_new_name = ($_FILES['photo_new'] ['name']);
$photo_new_size = ($_FILES['photo_new'] ['size']/1024)/1024;
$povoleni = array('jpg', 'jpeg', 'png', 'gif');
if ($photo_new_size > 2) {
$photo_error_up = "<h3>Fotka má příliš velkou velikost. Maximální velikost fotky může být 2MB.</h3>";
}
elseif (is_uploaded_file($photo_new)) {
if (!in_array(strtolower(pathinfo($photo_new_name, PATHINFO_EXTENSION)), $povoleni)) {
$photo_error_up1 = "<h3>Koncovky souborů musí byt jpg, jpeg, png nebo gif.</h3>";
}
else {
$cesta = "../img/user/";
$photo_id = Date("jmYHis", Time());
$photo_new_name1 = explode(".", $photo_new_name);
include "../include/prevodni-tabulka.php";
$photo_new_name2 = strtr($photo_new_name1[0], $prevodni_tabulka);
$codec1 = explode(".", $photo_new_name);
$codec2 = $codec1[1];
$photo_new_name3 = "$photo_new_name2$photo_id.$codec2";
if (move_uploaded_file($photo_new, $cesta.$photo_new_name3)) {
$photo_move = "Obrázek $soubor_name byl úspěšně nahrán na server.<br>";
require_once "../include/db.php";
$dotaz = mysql_query("SELECT * FROM `XXX` WHERE `login` = '".$_SESSION['login']."'");
while ($vypis = mysql_fetch_assoc($dotaz)) {
$login = $vypis['login'];
}
$photo_cesta = "XXX".$photo_new_name3;
mysql_query("UPDATE `XXX`.`XXX` SET `photo` = '$photo_cesta' WHERE `XXX`.`login` = '".$login."'");
$vlozeni_info = "<h3>Soubor $photo_new_name3 byl úspěšně zapsán do databáze.</h3>";
}
}
}
require_once "../include/db.php";
$dotaz = mysql_query("SELECT * FROM `XXX` WHERE `login` = '".$_SESSION['login']."'");
while ($vypis = mysql_fetch_assoc($dotaz)) {
$login = $vypis['login'];
}
mysql_query("UPDATE `XXX`.`XXX` SET `age` = '$age_new', `born` = '$born_new', `sex` = '$sex_new', `group-visit` = '$group_visit_new', `subject-visit` = '$subject_visit_new', `list-id` = '$list_id_new', `style-web` = '$style_web_new', `type-web` = '$type_web_new', `state` = '$state_new', `city` = '$city_new', `street` = '$street_new', `psc` = '$psc_new', `skype` = '$skype_new', `icq` = '$icq_new', `mobil` = '$mobil_new', `web` = '$web_new', `job` = '$job_new', `school` = '$school_new', `me` = '$me_new' WHERE `XXX`.`login` = '".$login."'");
$vlozeni_info = "<h3>Soubory byly úspěšně zapsány do databáze.</h3>";
$adresa = "XXX";
Header("Location: ".$adresa) ;
exit;
}
/*if (isset($_POST['back_modify'])) {
header("location: ".$_SERVER['SERVER_ROOT']."XXX");
}*/
?>