170 likes | 320 Views
Lesson 18. CGI Setup. CGI Scripts/ Program. Server. Browser. Request. Http reply. Database. <HTML> <BODY> <A href=http://www.onlineshop.com/cgi-bin/hello1.cgi> Click here to view the record of your previous transactions </A> <p> <A href=http://www.onlineshop.com/cgi-bin/hello2.cgi>
E N D
CGI Setup CGI Scripts/ Program Server Browser Request Http reply Database
<HTML> <BODY> <A href=http://www.onlineshop.com/cgi-bin/hello1.cgi> Click here to view the record of your previous transactions </A> <p> <A href=http://www.onlineshop.com/cgi-bin/hello2.cgi> List of IT Books for sale </A> </BODY> </HTML>
Perl example – hello2.cgi print "<head>\n"; print "</head>\n"; print "<body>\n"; print "<h1>IT Books</h1>\n"; print "<b>Description of available books</b><br>"; &SetOracle; &RunSQL("Select * from ITBOOKS"); &StopOracle; print "</body></html>\n";
Select Statement Select author,publisher from ITBOOKS where coursename=‘e-commerce’
<HTML> <BODY> <H3>To Register Please Enter The Following Information:</H3> <FORM NAME="regForm" ACTION="http://www.onlineshop.com/hello.asp" METHOD="POST"> Name: <INPUT TYPE="TEXT" NAME="Name" maxlength="25"> <P> Address: <INPUT TYPE="TEXT" NAME="userAdd" maxlength="50"> <P> Password: <INPUT TYPE="Password" NAME="userPassword" maxlength="15"> <P> Email: <INPUT TYPE="TEXT" NAME="email" maxlength="15"> <P> <INPUT TYPE="submit" NAME="Go" VALUE="Register!"> <INPUT TYPE="RESET" VALUE="Reset!"> </FORM> </BODY> </HTML>
Insert Statement INSERT INTO Register(Name,Address,Password,Email) VALUES(Request.form("Name"), Request.form("Address"), Request.form("Password"), Request.form("Email"))
Server Side Scripts • Active Server Pages (.asp) • Java Server pages (.jsp) • Hypertext Preprocessor (.php)
Intrinsic Objects of ASP • Response Object • Request Object • Server Object • Application Object • Session Object • ObjectContext Object • ASPError Object
<%@Language="VBSCRIPT"%> <%option explicit%> <%Dim lastname Dim firstname Dim myage lastname="Ali" firstname="Imran" myage=30 %> <html> <head><title>It is easy</title></head> <body> My name is <%=firstname%> <%=lastname%> and my age is <%Response.Write myage%> </body> </html>
… <FORM NAME="regForm" ACTION="regcheck.asp" METHOD="POST" onSubmit="returncheckValues()"> Name: <INPUT TYPE="TEXT" NAME="userName" maxlength="25"> <P> Login: <INPUT TYPE="TEXT" NAME="userlogin" maxlength="15"> <P> <INPUT TYPE="submit" NAME="Go" VALUE="Register!"> <INPUT TYPE="RESET" VALUE="Reset!"> </FORM> …
regcheck.asp <%@Language="VBSCRIPT"%> <%option explicit%> <%Dim loginname Dim name loginname=Request.Form("userlogin") name=Request.Form("username") %> <html> <head><title>It is easy</title></head> <body> My name is <%Response.Write name%> and I am going to use <%Response.Write loginname%> as my login </body> </html>
<%@Language="VBSCRIPT"%> <%option explicit%> <HTML> <Body> Test1 <% Dim myString="ecommerce" %> <%If Time>=#12:00 AM# and Time<=#12:00 PM# then%> <h3>Good Morning Pakistan</h3> <%else%> <h3>Hello Everyone <p> <% Dim j For j=1 to 3 response.write myString response.write "<p>" Next %></h3> <% end if %> </Body> </HTML>