vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   vBulletin and PHP cookies (https://vborg.vbsupport.ru/showthread.php?t=192591)

dvongrad 10-03-2008 02:13 PM

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 ShellFns:DefaultAction. 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 ShellFns:DefaultAction, 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");
ShellFns:DefaultAction(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 ::D (colon colon D), even though I specified no smileys, no icons and left the additional options as defaults.

Amenadiel 10-03-2008 03:55 PM

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.


All times are GMT. The time now is 01:12 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.00918 seconds
  • Memory Usage 1,718KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete