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 10-03-2008, 02:13 PM
dvongrad dvongrad is offline
 
Join Date: Sep 2008
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default vBulletin and PHP cookies

I am trying to use vBulletin in such a way that if it is not started from my Windows-based C++ application, then vBulletin will not start up. This is achieved with the C++ code, listed below.

The SendRequest call creates a POST header to be passed to start.php, listed below. I know this works because $_POST["App"] exists and the script pauses for 5 seconds because supposedly the cookie in the script was created due to the if check on $post. After the 5 second delay, the message box in the C++ code displays, so I know it's not immediately trying to execute index.php with the C++ call to ShellFnsefaultAction. If $post from start.php is null (such as by launching http://www.zokero.com/vBulletin/start.php directly in IE7), I execute the exit("start: ..."), which alsp works as expected.

In index.php provide by the install of vBulletin, I added the 3 lines into that file, as listed below. The problem I'm running into is that even though start.php creates the cookie because $post from the script is not null as called from C++ SendRequest, when I get to index.php from the C++ function ShellFnsefaultAction, index.php thinks the $_COOKIE["App"] DOES NOT exist and the exit("index:...") is displayed EVERY TIME!! I can not get past this, no matter what I try, so I'm hoping that you will be able to provide with a solution and/or tell me why my approach soesn't work. Thank you for your time and attention regarding this matter.

C++:

SendRequest("http://www.zokero.com/vBulletin/start.php", CString("App=SeisWare"), sHeaderReceive, sMessage);
MessageBox("Test");
ShellFnsefaultAction(m_hWnd, "http://www.zokero.com/vBulletin/index.php");

start.php:

<?php
$post = $_POST["App"];

if ($post != null)
{
$duration = time() + 8 * 60 * 60;
$success = setcookie("App", "SeisWare", $duration);

if ($success == TRUE)
sleep(5);
}
else
exit("<html><body><center><h1>start: Please restart SeisWare to access the forums.</h1></center></body></html>");
?>

index.php:

$app = $_COOKIE["App"];

if ($app == null)
exit("<html><body><center><h1>index: Please restart SeisWare to access the forums.</h1></center></body></html>");

--------------- Added [DATE]1223047091[/DATE] at [TIME]1223047091[/TIME] ---------------

As a side note, the display of this post is putting a smiley for all occurances of : (colon colon D), even though I specified no smileys, no icons and left the additional options as defaults.
Reply With Quote
  #2  
Old 10-03-2008, 03:55 PM
Amenadiel's Avatar
Amenadiel Amenadiel is offline
 
Join Date: Sep 2006
Posts: 171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Are you actually opening index.php in your browser?

If you aren't, I believe there's no way to generate the cookie, it's the same that happens with curl, you can send a post request with or without parameters and it'll be catched and executed as it should, but if the result of that execution is a cookie, then you need to physically visit that file with your browser.
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 02:29 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03379 seconds
  • Memory Usage 2,170KB
  • 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)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)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