The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Help with transferring values, How to transfer variable values to different parts of program
fhutt
post 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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
fhutt
post 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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Mar 26 2021, 09:37 PM
Post #3


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



I see. I assumed this was on a server.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
fhutt
post Mar 27 2021, 09:12 PM
Post #4





Group: Members
Posts: 6
Joined: 25-March 21
Member No.: 27,870



Yes.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th March 2024 - 07:40 AM