Hey everyone:
Well today I started playing with html but I can't figure out how to require like a password or registration code to go into certain pages.
I need to be able to require somesort of login requirement to protect the page since I'm posting programs I wrote in C for a college class. I also want to be able to collect a list of email addresses corresponding to different codes so my old teacher can know whos looking at them so I'm not just cheating for other people and dont get into any trouble.
Any suggestions? I really don't know how to go about it. Ive tried just about every CGI posting around and its just outside of my knowledge.
Any help would be greatly apprecated. Thanks!
My horrible failures thus far...
Code:
<h1>Programs</h1>
<h2>Password/Registration Required</h2>
<blockquote>
<h3>Registration Number</h3>
<form method="post" action="clearing.cgi">
<p>Enter Registration Code Here: <input type="text" name="regisnum" size="10" value="Regis$
<input type="submit" name="Regis" action="clearing.cgi" value="Submit">
</form>
Code:
#include <stdio.h>
void passed (void);
int main(int argc, char *argv[])
{
char *regisnum;
char *password;
char Buffer[10];
int InputLength = atoi( getenv("INPUT_LENGTH") );
fread( Buffer, InputLength, 1, stdin );
if((regisnum = argv[1]) == "100")
{
printf("Admitted");
printf("\n<HTML><BODY><A HREF="regis/regis.html">Redirecting</A>");
printf("</BODY></HTML>\n");
passed();
}
else if ((password = argv[1]) == "100")
{
printf("Admitted");
passed();
}
else
printf("Password or Registration Number is not valid!");
return 0;
}
void passed(void)
{
printf("Content-type: text/html\n\n");
printf("<HTML><HEAD><TITLE>Processing</TITLE></HEAD><BODY>\n");
// printf("<h1><A HREF="regis/regis.html" target="_self">Redirecting</A></h1>\n\n");
printf( "</BODY></HTML>\n");
}