The user enters the site. Through ajax there is a request for login.php.
login.php:
<?php if(isset($_POST['login'])); { session_start(); $login = $_POST['login']; $pass = $_POST['pass']; include ('config.php'); $log = mysql_fetch_array(mysql_query("SELECT * FROM `db_users` WHERE username = '$login'")); $login_ms = $log['username']; $pass_ms = $log['password']; $steam_id = $log['steam_id']; $_SESSION['flag'] = $log['flags']; if ($pass == '') { echo "<div class='status-error'>Неправельный логин или пароль.</div> <script>$('.status-error').slideDown('slow'); setTimeout(function() { $('.status-error').slideUp('slow'); }, 3000); </script>"; } else { if ($login_ms == $login and $pass == $pass_ms) { $_SESSION['login'] = $login_ms; $_SESSION['steam_id'] = $steam_id; echo "<div class='status-accept'>Добро пожаловать ".$login_ms.".</div> <script>$('.status-accept').slideDown('slow'); setTimeout(function() { $('.status-accept').slideUp('slow'); }, 3000); setTimeout(function() { window.location.replace('/'); }, 1000); </script>"; } else { echo "<div class='status-error'>Неправельный логин или пароль.</div> <script>$('.status-error').slideDown('slow'); setTimeout(function() { $('.status-error').slideUp('slow'); }, 3000); </script>"; } } } ?> Next, in head.php I also run session_start (); :
<head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="<?php echo $adm['sitename'].' - '.$adm['description'] ?>"> <meta name="keywords" content=""> <?php session_start(); $adm = mysql_fetch_array(mysql_query('SELECT * FROM `admin`')); $users = mysql_fetch_array(mysql_query('SELECT SUM(onl) as onl FROM `db_users`')); $global = mysql_fetch_array(mysql_query('SELECT SUM(db_users.kill) as kil,SUM(death) as ded,SUM(animal) as ani FROM `db_users`')); ?> Index.php
<!DOCTYPE html> <html lang="ru"> <?php include ('inc/config.php'); include ('inc/head.php'); ?> <body> NotePad ++ UTF-8 WITHOUT BOOM does not help. If I transfer include ('inc / head.php'); higher than
<!DOCTYPE html>also does not help.
echo 'hello';to remove? ....... head included in login file? - Alexey Shimanskysession_startandheadershould be called before any output . Where do you think the<!DOCTYPE html> <html lang="ru">information is placed before or after thehead? I hope the hint is clear - Alexey ShimanskyЕсли я перенесу include ('inc/head.php'); выше чем <!DOCTYPE html> тоже не помогает............... repeat again ... and re-attach the link cannot-modify-header-information.ru and this phpfaq.ru/newbie/headers ...... session_start and header should be called before any output ....... see ... is therehead.phpin thehead.phpfile beforesession_start()? - Alexey Shimansky