Help with transferring values, How to transfer variable values to different parts of program |
Help with transferring values, How to transfer variable values to different parts of program |
fhutt |
Mar 25 2021, 08:50 PM
Post
#1
|
Group: Members Posts: 6 Joined: 25-March 21 Member No.: 27,870 |
Hello,
I have an index page in my secure website with $AUTH_USER variable with the string from the username in the windows 7 login form. This appears to be accessible in the <table> section of the page if the value is derived from the login form. There are times when I would like to change this by entering a different username on the URL eg. https://mypage.com/?name=Family I had problems extracting this 'name' value from the URL but now have it working. What I need to do now is to be able to use this new value in the <table> section. Here are snippets of code. CODE <script> function getQuery(q) { return (window.location.search.match(new RegExp('[?&]' + q + '=([^&]+)')) || [, null])[1]; } var _USER = getQuery("name") document.write("<br>Current user name: '" + _USER + "'<br>") var $AUTH_USER = _USER document.write("<br>Current user name: '" + $AUTH_USER + "'<br>") </script> <table class="c6" cellpadding="5" align="center"> <!--#if expr="$AUTH_USER = Family" --> some code that works here .... <!--#endif --> <!table> The problem is in the <table> section. I verify that the _USER and $AUTH_USER values are correct in the <script> section but $AUTH_USER value is wrong in the <table> section since the IF condition is not met. Could someone please point me in the right direction? Thanks |
fhutt |
Mar 26 2021, 05:51 PM
Post
#2
|
Group: Members Posts: 6 Joined: 25-March 21 Member No.: 27,870 |
I have found the problem.
The line: <!--#if expr="$AUTH_USER = Family" --> is a 'Server Side Includes' (SSI) conditional statement. It is only evaluated by the server transferring the file to a remote user. In the case of launching the html file in a local browser, there is no server involved and that line becomes just a comment. Therefore, the variable cannot be evaluated by a local browser. Sorry for presenting a problem that cannot be solved. |
pandy |
Mar 26 2021, 09:37 PM
Post
#3
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
I see. I assumed this was on a server.
|
fhutt |
Mar 27 2021, 09:12 PM
Post
#4
|
Group: Members Posts: 6 Joined: 25-March 21 Member No.: 27,870 |
Yes.
|
Lo-Fi Version | Time is now: 26th April 2024 - 03:51 AM |