Link to home
Start Free TrialLog in
Avatar of lmh99
lmh99

asked on

Hide data from HTML source

Dear CGIs!

This is novice in CGI programming.
On my home pages, user can search members that match
with his queries.

There is no problem, except I don't want to show "User ID" to
user.

How can I do this?
How can I hide "User ID" in HTML source?
Is it possible?

And one more,
Can I hide a record field from query result?
(Ex. Name | Age | Height | Weight | ...
I want to hide age field from query result. But it is necessary to execute other program. So, I have to query it)

Thanks in adavance.
:>)
ASKER CERTIFIED SOLUTION
Avatar of finik
finik

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lmh99
lmh99

ASKER

But, I can read User ID in HTML source.

I want to hide user ID in HTML source.

Thanks in advance again.
:)
Well, it has to be somewhere.
Or maybe I don't understand your question in a first place :)
Anyway, in order to for a CGI to get a parameter, it has to be in the form either as a button/checkbox/pulldown/whatever (visible for a user), or hidden (as I showed earlier). There is no way of hiding parameter from html, but to make it available to the processing cgi.
There is, however, an option of keeping it in the cookies, if you are interested,
I can show you how I recently did it
in one of my projects.
Avatar of lmh99

ASKER

Thanks!
I'm interested in your project.
Well, here it goes:

use CGI; # :)

When you CGI (on of your CGI's) get's the UID from the user
it first takes it, of course:

$login = $query->param('login');

Then, whenever you want to write a cookie to a user
you make smth like:

$cookie = $query->cookie(-name=>'rrs_login',
                         -value=>$login,
                         -expires=>'+10m');
# Where rrs_login is the name of the cookie, and +10m is 10 minutes
to remember it. Since the cookie sent to a browser in the header,
you will need to do all this before sending the header to the user.
Now, you can send it to user:

print $query->header(-cookie=>$cookie,
                         -expires=>'now',
                         -Pragma=>'no cache');

That way, the rrs_login cookie is saved in the user's browser, and other CGI
can access it through:

$login_from_cookie = $query->cookie('rrs_login');

Anyway, that was short, you can read all about it in the CGI.pm documentation (the one I learned it from :):
http://stein.cshl.org/WWW/software/CGI/cgi_docs.html

good luck, but remember, users can always switch cookies off in their
browsers or use some weird non-netscape-non-ie-neverheardofcookies browser(tm), so take it into consideration.