Вылетает ошибка Warning: Cannot modify header information - headers already sent by (output started at Z:\home\nepro74.ru\www\scripts\app_config.php:1) in Z:\home\nepro74.ru\www\ch06\scripts\create_user.php on line 18
create.php
<?php
require '../../scripts/database_connection.php';
$first_name = trim($_REQUEST['first_name']);
$last_name = trim($_REQUEST['last_name']);
$email = trim($_REQUEST['email']);
$bio = trim($_REQUEST['bio']);
$facebook_url = str_replace("facebook.org", "facebook.com", trim($_REQUEST['facebook_url']));
$position = strpos($facebook_url, "facebook.com");
if($position === false){$facebook_url = "http://www.facebook.com/" . $facebook_url;}
$twitter_handle = trim($_REQUEST['twitter_handle']);
$twitter_url = "http://www.twitter.com/";
$position = strpos($twitter_handle, "@");
if($position === false){$twitter_url = $twitter_url . $twitter_handle;}
else{$twitter_url = $twitter_url . substr($twitter_handle, $position + 1);}
$insert_sql = "INSERT INTO users (first_name, last_name, email, bio, facebook_url, twitter_handle) "."VALUES ('{$first_name}', '{$last_name}', '{$email}', '{$bio}', '{$facebook_url}', '{$twitter_handle}');";
mysql_query($insert_sql);
header("Location:show_user.php?user_id=" . mysql_insert_id());
?>
show.php
<?php
require '../../scripts/database_connection.php';
$user_id = $_REQUEST['user_id'];
$select_query = "SELECT * FROM users WHERE user_id = " . $user_id;
$result = mysql_query($select_query);
if($result) {
$row = mysql_fetch_array($result);
$first_name = $row['first_name'];
$last_name = $row['last_name'];
$bio = $row['bio'];
$email = $row['email'];
$facebook_url = $row['facebook_url'];
$twitter_handle = $row['twitter_handle'];
$twitter_url = "http://www.twitter.com/" . substr($twitter_handle, $position+1);
$user_image = "../../images/missing_user.png";
} else {
die ("Ошибка обнаружения пользователя с ID {$user_id}");
}
?>
<html>
...................................
</html>