R
R
Ratami Sato2015-12-01 13:33:21
PHP
Ratami Sato, 2015-12-01 13:33:21

Where could 1 come from here?

Index

include_once('core/properties.php');//Подключение к базе
session_start();//Начало сессии

$header = include_once('tmp/header.php');//Head
echo $header;

$news = include_once('tmp/news.php');//News
echo $news;

$footer = file_get_contents('tmp/footer.php');//Footer
echo $footer;

header
<?
  if (empty($_SESSION['login']) or empty($_SESSION['id'])){
    echo '
    <form class="head_cont" method="post" action="/core/modules/logon.php">
    <input type="login" name="login" placeholder="'.$lang['login_title'].'" />
    <input type="password" name="password" placeholder="'.$lang['login_pass'].'" />
    <input type="submit" value="'.$lang['login_button'].'" /><br />
    <a href="/join.php">'.$lang['join_title'].'</a>
    </form>
    ';
}
else{
        $id=$_SESSION['id'];
        $login=$_SESSION['login'];
        $name=$_SESSION['name'];
        echo '
        <div class="head_cont">
        Добро пожаловать, <a href="/ip192.168.10.'.$id.'">'.$name.'</a>!
        <br /><a href="/logout.php">Выйти</a>
        </div>';
}
echo '<html><head><title>'.$lang['site_name'].'</title><link rel="stylesheet" href="tmp/css/style.css" /></head><body>';
echo '<div class="header"><p><a href="/">'.$lang['site_name'].'</a></p></div>';
?>

And on the page it displays under $header and $news 1
3a26d2ee40b44e3896862343a5069b52.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Aleksey Ratnikov, 2015-12-01
@reatachi_kun

include_once returns TRUE , which when echo is implicitly cast to a string, that is, to 1: php.net/manual/en/language.types.string.php#langua...
Solution: remove echo next to include and go read the documentation.

L
Lesha Kiselev, 2015-12-01
@Yakud

ob_start();
include_once('tmp/header.php');//Head
$header = ob_get_clean();
echo $header;

ob_start();
include_once('tmp/news.php');//News
$news = ob_get_clean();
echo $news;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question