How to set Cookie in CGI

The CGI, written in

C has the following statement
printf ("Set-Cookie:username =% s; path=/\ r\ n", username);
can be set successfully and can be read at the front end.
but if I want to set two values, I try the following methods:
printf ("Set-Cookie:username =% s; password =% s; path=/\ r\ n", username, password);
or
printf ("Set-Cookie:username =% s; path=/\ r\ n", username);
printf ("Set-Cookie:password =% s; path=/\ r\ n", password);

).

neither of these methods works, so how to set it

May.24,2021

has been solved. Just add expires after Set-Cookie, but you can't find the reason. You must bring expires?.


because you didn't say what the so-called "no" is, I guess it's because if you don't set expires, the cookie you set will be cleared after you close the conversation.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35e24-2bfd4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35e24-2bfd4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?