Hello World! Here I did it like in a video tutorial, and still I was mistaken somewhere once it displays this error:
Warning: Cannot modify header information - headers already by (output started at Z: \ home \ dimmetrius.name \ www \ includes \ overall \ header.php: 3) in Z: \ home \ dimmetrius.name \ www \ register. php on line 52
So, here's what happened:
if(isset($_GET['success']) && empty($_GET['success'])) { echo 'Регистрация успешно завершена'; } else { if(empty($_POST) === false && empty($errors) === true) { $register_data = array( 'username' => $_POST['username'], 'password' => $_POST['password'], 'first_name' => $_POST['first_name'], 'last_name' => $_POST['last_name'], 'email' => $_POST['email'] ); register_user($register_data); header('Location: register.php?success'); exit(); } else if(empty($errors) === false) { echo output_errors($errors); } } Where, header('Location: register.php?success'); everything seems to be written correctly, but somewhere the title starts! This is the file, includes\overall\header.php :
<!doctype html> <html> <?php include 'includes/head.php'; ?> <body> <?php include 'includes/header.php'; ?> <div id="container"> <?php include 'includes/aside.php'; ?> Maybe I'm blind, but I do not see any title here!
Here is the function, register_user ($ register_data); which registers users:
function register_user($register_data) { array_walk($register_data, 'array_sanitize'); $register_data['password'] = md5($register_data['password']); $fields = '`' . implode('`, `', array_keys($register_data)) . '`'; $data = '\'' . implode('\', \'', $register_data) . '\''; mysql_query("INSERT INTO `users` ($fields) VALUES ($data)"); } Here, array_walk ($ register_data, 'array_sanitize');
function array_sanitize(&$item) { $item = mysql_real_escape_string($item); } Where can there be a mistake?
<!doctype html>. Read the documentation carefully. - Indifferent