Re: Dump Globalsã > By: Mortifis to All on Sat Feb 16 2019 11:26:39ãã > Mo> Is there a js function similar to php var_dump($GLOBALS); ?ãã > Not that I'm aware of. It's easier and less verbose to target the variableã > that you want rather than dumping the entire global space:ãã > writeln(JSON.stringify(my_var));ãã > You could use this to dump the global scope of your script:ãã > function scope_dump() {ã > Object.keys(js.scope).forEach(function (e) {ã > const exclude = [ã > 'conio',ã > 'js',ã > 'stderr',ã > 'stdin',ã > 'stdout'ã > ];ã > if (exclude.indexOf(e) > -1) return;ã > writeln(e + ':\r\n' + JSON.stringify(js.scope[e]) + '\r\n');ã > });ã > }ãã ããperfect, thank you, one thing I am having trouble with is set_cookie(...,ã(time() - 1000, ...) I keep getting an error: cannot convert NaN to integer ãã2 wrongs don't make a right, but 3 left turns will get you back on the freeway!ãã---ã þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81ã
Re: Re: Dump Globalsã > By: Mortifis to echicken on Sat Feb 16 2019 13:04:07ãã > Mo> perfect, thank you, one thing I am having trouble with isã > Mo> set_cookie(..., (time() - 1000, ...) I keep getting an error: cannotã > Mo> convert NaN to integer ãã > http://wiki.synchro.net/server:web#extra_global_methodsãã > What you're passing as the expiration time can't be interpreted as anã > integer. Mind the order of parameters you're passing to set_cookie. Theã > first two parameters need to be strings. The third parameter is optional,ã > and if passed needs to be a number, being the expiration time. See the wikiã > for the rest of the parameters.ãã > So what you want is something like this:ãã > set_cookie('key', 'value', time() - 1000); // Or time() - 1000 or whateverããthat's is the format I have been using, though I believe I tracked the issueãdown to a misplace , :/ so in the web interface I am, ahem, scripting, I setãthe cookie then did the scope_dump() you gave me and http_request:{ ... cookieãis still cookie{} ... ããnew question: how would one do a logout from the interface ... tried settingãuser.numer = 0; with no affect ãã2 wrongs don't make a right, but 3 left turns will get you back on the freeway!ãã---ã þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81ã
Re: Re: Dump Globalsã > By: Mortifis to echicken on Sat Feb 16 2019 15:33:53ãã > Mo> new question: how would one do a logout from the interface ... triedã > Mo> setting user.numer = 0; with no affect ãã > How are you logging the user in in the first place?ãã > I believe the Runemaster web UI uses HTTP authentication that's baked intoã > the web server. The user is already logged in before the script begins toã > execute, and I don't think there's a proper way to log them out after that.ã > With most browsers, the only way to log out of this type of session is toã > close the browser. Clearing the cache may work. I see a logout.ssjs thatã > attempts to do just this, but if it does it wouldn't take effect until theã > next request comes in from that client.ããI had been using runemaster logout.ssjs and fiddling with it because it didn'tãactually logout, even if you close the browser and reopen it you're stillãlogged in; unless you clear the cache and cookies etc ...ã ã > Are you creating a web interface from scratch, or is this a mod of somethingã > that already exists?ããhalf of both ... I migrated a php theme I wrote for my transport managementãsuite and am modifying it for js, ssjs, xjs and in an attempt to change theãcurrent login.ssjs and logout.ssjs I am running into the issues you mention,ãespecially since the theme navigation remains and content is in a centre, ahem,ã<iframe> some, if not most, of the content is ripped and modified fromãweb/root web/templates/nightshade ããI'll just leave it with the baked in stock login.ssjs and forget logouts :-Þããããã2 wrongs don't make a right, but 3 left turns will get you back on the freeway!ãã---ã þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81ã
Re: Re: Dump Globalsã > By: Mortifis to echicken on Sat Feb 16 2019 15:33:53ãã ã > Are you creating a web interface from scratch, or is this a mod of somethingã > that already exists?ãã ãI have a basic running model at http://ephram.synchro.net ã2 wrongs don't make a right, but 3 left turns will get you back on the freeway!ãã---ã þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81ã
Sysop: | Karloch |
---|---|
Location: | Madrid, Spain |
Users: | 54 |
Nodes: | 8 (0 / 8) |
Uptime: | 129:48:49 |
Calls: | 700 |
Files: | 17,895 |
D/L today: |
128 files (60,769K bytes) |
Messages: | 66,010 |