форум vBSupport.ru > Форумные движки и CMS (Порталы) > CMS (Portals)
  • »
VBsupport перешел с домена .ORG на родной .RU Ура! Пожалуйста, обновите свои закладки - VBsupport.ru
 
 
 
 
DanzI
Простоузер
Question Integracia script.Unable to add cookies, header already sent.
0

У меня есть самописный сайт (я начинающий) в нем я инклудом вставляю код скрипта авторизации... вообще он работает я проверил все... если вошел на форуме )
Ну выдает ошибку

Code:
Unable to add cookies, header already sent.
File: D:\AppServ\www\head.php
Line: 22
я знаю что нужно ставить послыку кукис перед ехо итд... но я очень запутался помогите разобратся.

Сайт состоит из нескольких частей Head.php Footer.php и нескольких Block.php

Сам Скрипт авторизации от чего идет проблемма лежит в block.php

Head.php

PHP Code:
<?php
$CI 
"Blog";
$login "{login}";
$search "<input  size=15 type=password name=password />";
$warning "0";
$site "http://site";
$blockl "";
$blockr "";
$Messages "Message :)";
$popup "0";
echo 
"
<HTML>
 <HEAD>
  <TITLE>????</TITLE>
<META content=text/html; charset=windows-1251 http-equiv=Content-Type>
<LINK rel=stylesheet type=text/css href=
$site/site.css media=screen>
<link rel=stylesheet type=text/css href=menu.css />
<script src=pro_drop_1/stuHover.js type=text/javascript></script>
<meta name=keywords content=RF Online />
<meta name=description content=RFO SHOP />
<script type=text/javascript></SCRIPT>"
;
if(
$popup 0)
{
echo 
"
<SCRIPT LANGUAGE=Javascript SRC=http://DanzI.popunder.ru/popunder.php?id=DanzI></SCRIPT>"
;
}
echo 
"
<BODY bgcolor=#F2DBA4>

<!--*/HEAD*/!-->
 <table width=1024 height=25 align=center  border=0 cellspacing=0 cellpadding=0>
  <tr>
   <td background=
$site/img/left.png width=25 height=25 ></td>
   <td height=25 bgcolor=#494949 background=bgtop.png ><div align=center><font color=black>
$CI</font></div></td>
   <td background=
$site/img/right.png width=25 height=25 ></td>
  </tr>
 </table>"
;
 if(
$warning 0)
{
echo 
"
 <!--*/warning message*/!-->
  <table bgcolor=#F2DBA4 width=1024 height=25 align=center border=3 cellspacing=0 cellpadding=0>
  <tr width=100% bgcolor=red>
   <td><div align=center>
$Messages</div></td>
  </tr>
 </table>"
;
}
echo 
"
 <!--*/LOGO*/!-->
  <table bgcolor=#F2DBA4 width=1024 height=200 align=center  border=0 cellspacing=0 cellpadding=0 background=logo.png>
   <tr>
    <td>
    </td>
   </tr>
  </table>

<!--*/NAVIG*/!-->
  <table bgcolor=#F2DBA4 width=1024 height=36 align=center  border=0 cellspacing=0 cellpadding=0>
   <tr bgcolor=black width=100% height=100%>
    <td width=205 background=leftcent.png>
    </td>
    <td width=614>
     <div align=center>
      <ul class=solidblockmenu>
       <li><a href=
$site title=HOME>&nbsp; ??????? &nbsp;</a></li>
       <li><a href=
$site title=HOME>&nbsp; ??????? &nbsp;</a></li>
       <li><a href=
$site title=HOME>&nbsp; ????? &nbsp;</a></li>
       <li><a href=
$site title=HOME>&nbsp; ?????? &nbsp;</a></li>
       <li><a href=
$site title=HOME>????????</a></li>
       <li><a href=
$site title=HOME>? ???</a></li>
       <li><a href=http://popunder.ru/r.php?r=DanzI title=HOME>?? ???????</a></li>
      </ul>
     </div>
    </td>
    <td width=205 background=rightcent.png><div align=right>
$search</div></td>
   </tr>
  </table>
<!--*/CENTER*/!-->
  <table bgcolor=#F2DBA4 width=1024 align=center  border=0 cellspacing=0 cellpadding=0>
   <tr width=100% bgcolor=grey>
     <td width=205 bgcolor=a5a4a4 valign=top> "
;
        include(
'block2.php');
  echo 
"
     </td>
    <td width=614 valign=top bgcolor=a5a4a4> <div align=center>"
;
?>

Footer.php
PHP Code:
<?php

$copyrait 
"{copyrait}";

$google "skript googla";
 

   echo 
"
    </div></td>
    <td width=205 bgcolor=a5a4a4 valign=top>"
;
        include(
'block.php');
        include(
'block3.php');
  echo 
"
    </td>
   </tr>
  </table>
  <!--*/CENTER2*/!-->
  <table bgcolor=#F2DBA4 width=1024 align=center  border=0 cellspacing=0 cellpadding=0 height=150>
   <tr width=100% bgcolor=a5a4a4>
     <td width=205 bgcolor=red background=
$site/footer/1.png></td>
     <td width=614 bgcolor=white background=
$site/footer/3.png></td>
     <td width=205 bgcolor=blue valign=top background=
$site/footer/6.png></td>
   </tr>
  </table>
<!--*/footer*/!-->
  <table bgcolor=#F2DBA4 width=1024 height=100 align=center  border=0 cellspacing=0 cellpadding=0>
   <tr width=100% bgcolor=a5a4a4>
    <td bgcolor=green   background=
$site/footer/2.png>
     <div align=center>
$google
     </div>
    </td>
   </tr>
  </table>
  <table width=1024 height=25 align=center  border=0 cellspacing=0 cellpadding=0>
   <tr width=100% height=30% >
    <td background=
$site/footer/5.png width=25 height=25></td>
    <td bgcolor=black background=
$site/footer/4.png><div align=center><font color=white>$copyrait</font></div></td>
    <td background=
$site/img/footright.png width=25 height=25 ></td>
   </tr>
  </table>

 </BODY>
</HTML>"
;
?>
block.php
PHP Code:
<?php
$blocktitle 
"AUTH";

echo 
"
<br>
<table cellspacing=0 cellpadding=0 align=center >
  <tr>
  <td background=start.png width=36 height=36></td>
  <td background=between.png  height=36 width=133>
   <div align=center><font color=white>
$blocktitle</font></div>
  </td>
  <td background=end.png width=36 height=36></td>
 </tr>
</table>
<table cellspacing=0 cellpadding=0 align=center>
 <tr bgcolor=cf1519 >
  <td width=205>"
;
include(
'login3.php');
echo 
"
  </td>
 </tr>
 <tr>
  <td height=2 width=205 bgcolor=black>
  </td>
 </tr>
</table>
<br>
"
;
?>
login3.php

PHP Code:
<?php
$curdir 
getcwd ();
chdir('forum/');
require_once(
'forum/global.php');
chdir ($curdir);

// Edit the lines below to show path to your forums
$forumpath "http://site/forum/";
// Set the maximum display size for the avatar
$maxw 150// Max thumbnail width
$maxh 150// Max thumbnail height

// We check if user is logged in
if ($vbulletin->userinfo['userid']!=0) {

// ++++++++++++++++++++++++++++++++++
// display avatar - resize if too big
// ++++++++++++++++++++++++++++++++++
$userid=$vbulletin->userinfo['userid'];
$file $forumpath."image.php?u=$userid";
// +++++++++++++++++++++++++++++++++++++++++
// As Logged in display welcome back message
// +++++++++++++++++++++++++++++++++++++++++
echo "<div align=\"center\">Welcome Back, <b>";
echo 
$vbulletin->userinfo['username'];
echo 
" !</b></div><br />";
list(
$width$height$type) = getimagesize($file);
if ( 
$width <= $maxw AND $height <= $maxh )// check width and height
   
{// if width and height under size display unchanged
       
echo "<div align=\"center\"><img src=\"$file\" align=\"center\" border=\"0\"></div><br />";
   }
   else
   {
 if (
$width $maxw)//check if width is too wide
  
// if it is, resize
  
$ratio $width $maxw//work out resize ratio
  
$newwidth $maxw// new width
  
$newheight = ($height $ratio); // new height at this resize
  
}
  else
  {
  
$newheight $height// if width is ok, set this cos we need it later
  
$newwidth $width// if width was ok, set this cos we ned it later
  
}
 If (
$newheight <= $maxh )
  {
  
// if current height is ok, were done.
  
}
  else 
// either origional or resized height is too big
   
if( $newheight >= $maxh )
   { 
// if resized height is still too big we resize it
   
$ratio2 $newheight $maxh//work out resize ratio
   
$newheight $maxh// give $newheight a new value
   
$newwidth = ($newwidth $ratio2); // new width at this resize
   
// the value of $newwidth has just been changed
   
else
   {
// if were here then origional height is too big so we resize it
   
$ratio2 $newheight $maxh//work out resize ratio
   
$newheight $maxh// give $newheight a new value
   
$newwidth = ($newwidth $ratio2); // new width at this resize
   
}
  
// now we can finally display resized pic
        
echo "<div align=\"center\"><img src=\"$file\" border=\"0\" width = \"$newwidth\" height = \"$newheight\" align=\"center\"></div><br />"// display resized pic
   
}
// +++++++++++++++++++++++
// end avatar display code
// +++++++++++++++++++++++
 
 
 
// Display last visit time and date
echo "<div align=\"center\">";
echo 
"<b>You last visited:</b> <br /> $pmbox[lastvisitdate] at $pmbox[lastvisittime]<br />";
// Display PM Details and generate link to PM box
echo "<a href=\"".$forumpath."private.php?$session[sessionurl] \"><b>PM:</b> </a> $vbphrase[unread_x_nav_compiled] $vbphrase[total_x_nav_compiled]";
echo 
"</div><br />";
// As were logged in display logout link
echo "<a href=\"".$forumpath."login.php?$session[sessionurl]do=logout&amp;logouthash=$logouthash";
echo 
$vbulletin->userinfo['logouthash'];
echo 
"\">";
echo 
"<div align=\"center\"><font size=\"1\" face=\"verdana\"><b>Log Out</b></font></div></a><br />";
} else {
 
// ++++++++++++++++++++++++++++++++++++++++++
// If user is not logged in, we do this stuff
// ++++++++++++++++++++++++++++++++++++++++++
// Display text and link to register.
echo "
 You have to <a href=\""
.$forumpath."register.php?s=$session[sessionhash]\"
 target=\"_parent\"><b>register</b></a>  before you can post on our forums or use our advanced features.
 "
;
// Display login boxes + button
// You can style this with html or CSS as normal if desired.
echo"
 <form action=\""
.$forumpath."login.php\" method=post onsubmit=md5hash(vb_login_password,vb_login_md5password,vb_login_md5password_utf)>
 <script type=text/javascript src=\""
.$forumpath."/clientscript/vbulletin_md5.js\"></script>
 User Name:<br />
 <input name=vb_login_username type=text id=navbar_username onfocus=\"if (this.value == '
$vbphrase[username]') this.value = '';\" size=10 />
 <br />Password:<br />
 <input name=vb_login_password type=password size=10 />
 </br>
 <label for=cb_cookieuser_navbar><input name=cookieuser type=checkbox id=cb_cookieuser_navbar value=1 checked=checked />
 Remember Me?<br /></label>

 <input type=submit title=
$vbphrase[enter_username_to_login_or_register] value=\"Log In\" />
 <input type=hidden name=s value=
$session[sessionhash] />
 <input type=hidden name=do value=login />
 <input type=hidden name=vb_login_md5password />
 <input type=hidden name=vb_login_md5password_utf />
 </form>
"
;
// +++++++++++++++++++++++++++++++++++++++
// End of login box for non logged in user
// +++++++++++++++++++++++++++++++++++++++
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++
// we want do display stats either way so they go here
// +++++++++++++++++++++++++++++++++++++++++++++++++++
// get total number of threads and posts
//$getstats = $db->query_read('SELECT threadcount, replycount FROM ' . TABLE_PREFIX . 'forum');
//while ($forum = $db->fetch_array($getstats))
//{
// $totthreads += $forum['threadcount'];
// $totposts += $forum['replycount'];
//}
//$totthreads = vb_number_format($totthreads);
//$totposts = vb_number_format($totposts);
// display total threads and total posts - Uses vB phrases, but change if you like
//echo"<br /> $vbphrase[threads]: $totthreads<br />$vbphrase[posts]: $totposts<br /> ";
// Only display link and number of new posts if logged in
//if ($vbulletin->userinfo['userid']!=0) {
// finds number of new posts
//$newposts = $db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "post AS post " . iif($vbulletin->options['threadmarking'], 'LEFT JOIN ' . TABLE_PREFIX . 'threadread AS threadread ON (threadread.threadid = post.threadid AND threadread.userid = ' . $vbulletin->userinfo['userid'] . ')') . " WHERE dateline >= " . $vbulletin->userinfo['lastvisit'] . iif($vbulletin->options['threadmarking'], ' AND dateline > IF(threadread.readtime IS NULL, ' . (TIMENOW - ($vbulletin->options['markinglimit'] * 86400)) . ', threadread.readtime)'));
//$newposts = vb_number_format($newposts['count']);
//echo"<a href=\"".$forumpath."search.php?$session[sessionurl]do=getnew\">$vbphrase[new_posts]</a>: $newposts<br />";}
//  end of number of new posts stuff
?>
Bot
Yandex Bot Yandex Bot is online now
 
Join Date: 05.05.2005
Реклама на форуме А что у нас тут интересного? =)
 
 
kerk
k0t
 
kerk's Avatar
Default
0

в файле логин.пхп загони весь код в переменную
а потом в блоке ее выведи принтом или эхом, естессно сделай инклюд или рекуае_онсе(блок_логин) перед выводом этой переменной
 
 
DanzI
Простоузер
Default
0

Загнать в переменную эт тип вес код воткнуть в $peremennaia = ""; ? или как такой большой код туда засунуть ? можете по примеру показать я просто попытался пару раз чтото не выходит. И у меня при инклуд или рекуае онсе просто выводит код вместе с хтмл кодом ну тип имею ввиду что нечего не меняется.я чтото оч запутался обьясните плиз.

DanzI добавил 05-29-2009 в 05:45 PM
Плиз разьясните )

Last edited by DanzI : 05-29-2009 at 05:45 PM. Reason: Добавлено сообщение
 
 
kerk
k0t
 
kerk's Avatar
Default
0

PHP Code:
$var 'bla';
if(
$condition)
{
        
$var .= 'bla_bla';
}else{
        
$var .= 'alb_alb';
}
$var .= 'bla_bla_bla';
print 
$var
ка то так
 
 
DanzI
Простоузер
Default
0

я чет непойму зачем условия и это пример чего ?
Хм ( я растерян... да и это поможет избежать Unable to add cookies, header already sent.?

Last edited by DanzI : 05-29-2009 at 06:47 PM.
 
 
kerk
k0t
 
kerk's Avatar
Default
0

это пример кода, который нужно загнать в 1 переменную, с условиями и прочим
 
 
DanzI
Простоузер
Default
0

А что от этого меняется ?... какбы тож самое что инклуд не ? я попробовал теже ошибки...
Я слышал что через буферизацию это решается ... а как без понятия и как ее применить к моему коду?
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT +4. The time now is 06:13 PM.


Powered by vBulletin® Version 3.6.9
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Loading...