lisa92222 0 Newbie Poster

Hello, can you pls correct my answer to this question for the Python CGI part because Im really not sure if im doing it right. Thanks a lot!

11628

Python CGI part
----------------
#!/bin/python

import cgi,string


def generate_page():
      print "<HTML>\n"
    print "\t<TITLE>Welcome</TITLE>\n"
    print "</HEAD>\n"
        print "<BODY BGCOLOR = white>\n"
        <a href="url">McGill web page</a> //for link
        <img src="bob.png" width="10" height="20">
        print "\t<H3>Please, enter your name and age.</H3>\n"


def test(passwd):

    shift=3
    passwd_file = open('password.txt', 'r')
    line = passwd_file.readline()
    passwd_file.close()

    for char in passwd_file:
    x=ord(char)

    if char.isalpha():
    x=x+shift

    return passwd_file




def main():
    print "Contetn-type:text/html\n"
    form=cgi.FieldStorage()
    if form.has_key("username") and form.has_key("password") and form   ["username"].value!="" and form["password].value!="":
        print 'Error: FILL OUT THE FORM'

    elif (form['newname'].value)=name and (form['password'].value)=pass :

        generate_page()

    else:
        print 'Error: Username and/or password dont match.'
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.