Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-17-2005, 02:20 PM
Mijae's Avatar
Mijae Mijae is offline
 
Join Date: Nov 2001
Location: Russia
Posts: 523
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Unable to add cookies, header already sent.

<a href="http://www.dailylaugh.net/" target="_blank">http://www.dailylaugh.net/</a>

Can you please tell me if you are getting that? If you are, what could possibly be the problem?
Reply With Quote
  #2  
Old 05-17-2005, 02:33 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You are trying to include vB into another page?
Reply With Quote
  #3  
Old 05-17-2005, 04:34 PM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you are placing a cookie after a template or something that has been echoed/printed
Reply With Quote
  #4  
Old 05-17-2005, 06:26 PM
Mijae's Avatar
Mijae Mijae is offline
 
Join Date: Nov 2001
Location: Russia
Posts: 523
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How can I fix this?

What I am doing is calling newsout.php, which extracts news from a specified forum. The template itself is inside the php script, and the script is outside the /forum folder. I had the php file inside the /forum but I had a guest appear 24/7 in Who's Online, so to fix that I moved it, and now I get this. How can I fix? :P

Code:
<?php
chdir("./forum");
require_once("./global.php");

// VARIABLES TO SET

// hostname or ip of server
$servername="localhost";

// username and password to log onto db server
$dbusername="x";
$dbpassword="x";

// name of database
$dbname="x";

//path to your forums
$forumspath = "http://www.dailylaugh.net/forum";

function writenews($cats, $filetw, $newsitems=7){ 
global $servername;
global $dbusername;
global $dbpassword;
global $dbname;
global $forumspath;

//Connect to the database
$connection = mysql_connect("$servername","$dbusername","$dbpassword") or die ("Cannot connect to server.");
$db = mysql_select_db("$dbname", $connection) or die ("Could not select database.");

//Create SQL statement this gets the title poster and other bits
$sql = "SELECT threadid, title, forumid, replycount, postusername, postuserid, lastposter, dateline, iconid FROM vb3_thread 

WHERE forumid IN ($cats) AND sticky = '0' ORDER BY threadid DESC LIMIT $newsitems"; 

//execute sql query
$sql_result = mysql_query($sql, $connection) or die ("Could not execute query.");

if (!$sql_result) { 
echo "Could not get news.";
} 

while ($row = mysql_fetch_array($sql_result)) {
$threadid = $row["threadid"];
$title = $row["title"]; 
$forumid = $row["forumid"];
$replycount = $row["replycount"];
$postusername = $row["postusername"];
$postuserid = $row["postuserid"];
$lastposter = $row["lastposter"];
$iconid = $row["iconid"];
$dateline = $row["dateline"];

//create the second SQL statement to pull the post from the thread it resides in
$sql2 = "SELECT postid, threadid, username, userid, title, dateline, pagetext, iconid FROM vb3_post WHERE threadid = 

\"$threadid\" ORDER BY postid ASC LIMIT 1";

//This gets the text of the post
$sql_result2 = mysql_query($sql2, $connection) or die ("Could not execute query in second sql statement.");
if (!$sql_result2) { 
echo "Could not get news.";
} 
while ($row2 = mysql_fetch_array($sql_result2)) {
$ptext = $row2["pagetext"];

//Convert time
$dateposted = date("D j M Y, g:i A",$dateline);

//Comments or comment depending on number of replies
if ($replycount==1) {
$commenttext = "Comment";
}
else {
$commenttext = "Comments";
}

// This parses the bbcode
require_once("./includes/functions_bbcodeparse.php");
$outxt=parse_bbcode2($ptext,"1","1","1","1","1");

// Uncomment next 4 lines if you want to limit the amount of text displayed to the first paragraph.
// $trimmed = explode("<br />", $outxt);
//$outxt=$trimmed[0];
//$trimmed = explode("</p>", $outxt);
//$outxt=$trimmed[0];

// This is optional. It strips out unecessary tags if you wish and leaves those specified behind
// $outxt = strip_tags($outxt, '<a>,<b>,<strong>,<i>,<em>,<br />,<br>,<p>');

// This sql gets the title of the forum
$sql3 = "SELECT title FROM vb3_forum WHERE forumid = \"$forumid\" LIMIT 1";
$sql_result3 = mysql_query($sql3, $connection) or die ("Could not execute query in second sql statement.");
$row3 = mysql_fetch_array($sql_result3);
$forumname = $row3["title"];

//EDIT the HTML OUTPUT HERE

$towrite .= "
<span class=\"news\"><a href=\"$forumspath/showthread.php?s=&amp;threadid=$threadid\" class=\"newstitle\">$title</a>, posted 

on <i>$dateposted</i> by <a 

href=\"$forumspath/member.php?s=&amp;action=getinfo&amp;userid=$postuserid\"><b>$postusername</b></a> ( <a style=\"font-size: 

11px;\" href=\"$forumspath/showthread.php?s=&amp;threadid=$threadid\">$replycount $commenttext</a> )</span><br />

<div class=\"newsbody\">$outxt</div><br />
";
// END HTML EDIT
}
}


// If you want to write out to a file - good idea to reduce db load
// Then uncomment this section and edit appropriately. You need
// to have a folder to stores the output file and they need to writeable (chmod 666)
// $filetw is name of output file.
// You may then want to call this file by cron so thing update reguarly.

//$tmpfile = fopen("/path/to/storafe/folder/".$filetw."","w+"); 
//$fp = fwrite($tmpfile,$towrite); 
//fclose($tmpfile); 
//flush (); 

// If you are writing to a file comment the line below out.
echo $towrite;
}

// This calls the writenews function. Done as a function so can be called multiple times.
// First variable is forum id to get news from. One forum is like 1 and multiple forums
// like 1,2,3. Output file onyl applies if you are outputting a file (see just above)
// The last variable is the number of news itmes to grab / display. Deafults to 10.

@writenews("10", "newsoutput.txt","5");
?>
Reply With Quote
  #5  
Old 05-17-2005, 08:05 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you have included vB's global why are you setting up another database connection?

just use $DB_site
Reply With Quote
  #6  
Old 05-17-2005, 09:57 PM
Mijae's Avatar
Mijae Mijae is offline
 
Join Date: Nov 2001
Location: Russia
Posts: 523
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Because I have no idea what you are talking about. I just copied this script from the hack's post.
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 11:07 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04055 seconds
  • Memory Usage 2,222KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete