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

Reply
 
Thread Tools Display Modes
  #1  
Old 03-07-2006, 08:16 AM
Vizionz Vizionz is offline
 
Join Date: Jul 2003
Location: Chicago
Posts: 524
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default need help vbulletin/ seperate php script

Stand alone script trying to get stylesheet not working

will call this little code CODE 1
Quote:
<?
session_start();
require "common.php";
?>
that call will access a file that has this info in it


THIS IS CODE2 Also known as the common.php file
Quote:
<?php

function connectdbase() {
$db = mysql_connect("localhost", "username", "pass");
mysql_select_db("dataname",$db);
}

?>

This is where i have my problem.. if i put this in the php code with the CODE 1 snippet i end yup with Unable to add cookies, header already sent
So where would this problem becoming from. why would the two conflict

Quote:
<?
chdir('/home/Forum);
require_once('./global.php');
?><? echo $style['css']; ?>
Reply With Quote
  #2  
Old 03-07-2006, 08:27 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you really need to set your own head/session/cookies, you could try adding one (or both) of the following lines before your call to global.php:
PHP Code:
define('NOHEADER'1);
define('NOCOOKIES'1); 
Reply With Quote
  #3  
Old 03-07-2006, 09:05 AM
Vizionz Vizionz is offline
 
Join Date: Jul 2003
Location: Chicago
Posts: 524
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks marco that was what i needed
Reply With Quote
  #4  
Old 03-07-2006, 06:07 PM
ConKien ConKien is offline
 
Join Date: Apr 2004
Posts: 92
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarcoH64
If you really need to set your own head/session/cookies, you could try adding one (or both) of the following lines before your call to global.php:
PHP Code:
define('NOHEADER'1);
define('NOCOOKIES'1); 
Hi MarcoH64, but if I want to use global.php for VB's cookie to integrate with another app, would the above code disable the vb cookie system?

Thanks for your help!
Reply With Quote
  #5  
Old 03-07-2006, 09:55 PM
Vizionz Vizionz is offline
 
Join Date: Jul 2003
Location: Chicago
Posts: 524
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yeah that disables the vb system so you would want to kill the cookies from the other app instead...

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource
on line 29

$sql="SELECT * from songlist WHERE ID=$songID"; line 27
$result=mysql_query($sql);line 28
$data=mysql_fetch_object($result);line 29

offhand is there something wrong with that line ? that you can see
Reply With Quote
  #6  
Old 03-07-2006, 10:02 PM
ConKien ConKien is offline
 
Join Date: Apr 2004
Posts: 92
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Vizionz for the reply!

If the 2 lines above disable the vb system, then why we need to include the global.php? Isn't that the whole purpose of integrate with vb cookies, keep track of the session n stuff?
Reply With Quote
  #7  
Old 03-07-2006, 11:56 PM
Vizionz Vizionz is offline
 
Join Date: Jul 2003
Location: Chicago
Posts: 524
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you dont have to use the two lines he put out i have to because th script i am working on requires to connect to a different database and uses its own individual cookies if you just need to grab the vbulletin info just use everything but them two lines

Quote:
Originally Posted by Vizionz
yeah that disables the vb system so you would want to kill the cookies from the other app instead...


Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource
on line 29

$sql="SELECT * from songlist WHERE ID=$songID"; line 27
$result=mysql_query($sql);line 28
$data=mysql_fetch_object($result);line 29

offhand is there something wrong with that line ? that you can see
anyone ?
Reply With Quote
  #8  
Old 03-08-2006, 07:01 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do you have a valid DB connection?
Reply With Quote
  #9  
Old 03-08-2006, 09:33 AM
Vizionz Vizionz is offline
 
Join Date: Jul 2003
Location: Chicago
Posts: 524
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i believe so its calling the database connection with the common.php file i posted above

<?
require "common.php";
echo "<body background='$background' bgcolor='$bgcolor' link='$links' alink='$links' vlink='$link'>";
connectdbase();
$sql="SELECT * from songlist WHERE ID=$songID";
$result=mysql_query($sql);
$data=mysql_fetch_object($result);
?>

thats what its doing at the beginning of the script so i dont understand
Reply With Quote
  #10  
Old 03-09-2006, 09:44 AM
Vizionz Vizionz is offline
 
Join Date: Jul 2003
Location: Chicago
Posts: 524
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bump
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 09:51 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.04752 seconds
  • Memory Usage 2,260KB
  • 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
  • (2)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete