vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   JS: Retrieve userid (https://vborg.vbsupport.ru/showthread.php?t=69225)

dsmcd01 09-08-2004 01:33 PM

JS: Retrieve userid
 
Hello...

I need to get the current userid from within a js file. I cannot send the userid to the javascript as a parameter (since this particular javascript file is part of a convoluted string of js and html files).

Any suggestions?

TIA,
D.

Modin 09-08-2004 09:26 PM

before you call the .js file I believe you can set a js variable which will be in the scope of the .js file.

ie.
HTML Code:

<script language="javascript">
  myvar = 6;
</script>

<script language="javascript" src="yourjsfile.js"></script>

Then, yourjsfile.js should be able to see myvar... I think...

Not exactly sure on the syntax, but hopefully you get what I mean :)

dsmcd01 09-09-2004 01:30 PM

Thanks. Either I'm in a catch-22 or my coding skills aren't up to the task. The js file that needs the userid is called by an html document which doesn't know the userid. The html is openned by yet another js which does know the userid. I haven't found a way to send the userid from the first js to the html and from there to the 2nd js file.

I'm trying to customize the PHPSpell hack by enabling/disabling the Learn button depending on userid. I've asked there, but no response yet.

Of course now that I'm having trouble my manager wants the customization done asap. Funny how that works. "Oh, it's troublesome? In that case I need it even sooner and the priority just went up." Sheesh. :ermm:

Thx,
D.

Colin F 09-09-2004 01:37 PM

to get it into the html page, I think you can fill it into a text field. And also read it from that text field. The thing is, where would you hide the textfield....

Maybe It'll help :)

Modin 09-09-2004 09:33 PM

yeah, if you passed a hidden field, you could do it.... but that's very insecure since someone could just send the correct headers and see the button you're hiding...


All times are GMT. The time now is 05:12 PM.

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.01134 seconds
  • Memory Usage 1,719KB
  • 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)bbcode_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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