ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have the following problem. I have my script /usr/lib/cgi-bin/login.cgi
and two page in /var/www, home.html and welcome.html.
When I log in /var/www/home.html with email and password, then login.cgi to extract exact user informations from mysql. Now I'd like start welcome.html page from login.cgi and passing user informations trought parameters.
How can I solve this problem?
a) it's easy,
... and ...
b) how you *send* the parameters depends on whether you're using "GET" or "POST"
... and ...
c) how you *read* the parameters depends entirely on what language you're using for your CGI script.
b) how you *send* the parameters depends on whether you're using "GET" or "POST"
I'm using GET in home.html. When I log in home.html with email and password, then login.cgi extract users information. I'd like that login.cgi to start welcome.html and to pass this information to home.html. What method or functions I must use in cgi script?
Quote:
c) how you *read* the parameters depends entirely on what language you're using for your CGI script.
I'm using perl for cgi script and html/css for web pages.
CAVEAT:
"CGI" is by definition "server-side". If you have a website on the Internet, how *much* you can do is limited by what your ISP allows you to do....
PS:
By default, CGI.pm forms use "POST". You can use the "-method" option to explicitly specify "GET" or "POST".
What you are attempting to do is create a 'session'. The concept of sessions is not part of HTTP, and so 'cookies' were invented to support the notion of holding transient values between page loads, so that it becomes possible to do what you are trying to do. You can also pass information between pages by embedding such information in hidden fields in HTML pages. Your CGI will have to grab the values in the hidden fields, and regenerate it as necessary when it builds new pages that are sent to the browser. In Perl and PHP, there are modules available that assist in the creation of sessions using CGI. For Perl, on CPAN, search for 'CGI session'. I don't do PHP, but I have it on good authority that it is similarly straightforward to establish sessions.
--- rod.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.