Perl/cgi and an Access Database Please use speaker notes for additional information!

Slides:



Advertisements
Similar presentations
SMART WEB USER GUIDE Log-in and Password Directory Search Sending Pages Changing Pager Status Assigning Pager Coverage, Referral, and Page Block Reviewing.
Advertisements

AN INTRODUCTION TO PL/SQL Mehdi Azarmi 1. Introduction PL/SQL is Oracle's procedural language extension to SQL, the non-procedural relational database.
A Short Tutorial for Dandelion Confluence. In Confluence, you can do more than working with your collaborators on editing documents... Our system allows.
CGI Programming Part 2. Input Tags Many different ways of getting data from the user. The tag is used most often. has a type attribute –Specifies the.
Implementing Session Support COEN 351. State Maintenance Client Side Mechanisms  Cookies Client needs to allow cookies Cookie handling done by browser.
Chapter 4B: More Advanced PL/SQL Programming
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
DBM Databases Please use speaker notes for additional information!
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
How to using MS Access database in Perl/CGI Web Programming Wei Sun.
JAVASCRIPT HOW TO PROGRAM -2 DR. JOHN P. ABRAHAM UTPA.
© Yanbu University College YANBU UNIVERSITY COLLEGE Management Science Department © Yanbu University College Module 6:WEB SERVER AND SERVER SIDE SCRPTING,
Set 5: Perl and Database Connections
1 HTML and CGI Scripting CSC8304 – Computing Environments for Bioinformatics - Lecture 10.
E-Volunteer AGENCY ADMINISTRATION
MAIL MERGE Designing Documents with. Terms Mail Merge: A process that inserts variable information into a standardized document to produce a personalized.
Information & Decision Management Dept West Texas A&M University
CGI and Perl - Basics Please use speaker notes for additional information!
Perl Web Page – Just Enough Pepper. Web site Set up the top of your script to indicate perl and plain text #!/usr/bin/perl print "Content-type:text/plain\n\n";
PHP meets MySQL.
Return to the Word 2007 web page Lesson 5: Using Mail Merge.
Building PERL Scripts on a Windows system* *and running those scripts on an Apache server!
Data files using cgi/perl Please use speaker notes for additional information!
1. CLICK “CONTACTS” (BOTTOM LEFT CORNER OF SCREEN) 2. SELECT “NEW CONTACT GROUP”
SYST Web Technologies SYST Web Technologies Databases & MySQL.
Mail with Perl/CGI Please use speaker notes for additional information!
Execute Workflow. Home page To execute a workflow navigate to My Workflows Page.
9 1 DBM Databases CGI/Perl Programming By Diane Zak.
Final Project Implementation of Basic Authentication.
Stored procedures1 Stored procedures and functions Procedures and functions stored in the database.
1 Basic Perl CGI Programming. 2 Issues How and when your program is invoked. Generating Response –HTTP Headers –HTML (or whatever document type you want)
ASP.NET The Clock Project. The ASP.NET Clock Project The ASP.NET Clock Project is the topic of Chapter 23. By completing the clock project, you will learn.
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
Databases On The Web with perl Archie Warnock
Intro to DatabasesClass 4 SQL REVIEW To talk to the database, you have to use SQL SQL is used by many databases, not just MySQL. SQL stands for Structured.
Creating PHPs to Insert, Update, and Delete Data CS 320.
Perl for People Singer XJ Wang Learning Center Available At:
Perl CGI What is "CGI"? Common Gateway Interface A means of running an executable program via the Web. Perl have a *very* nice interface to create CGI.
CSC3530 Software Technology Tutorial One Assignment overview & HTML basics.
CIS4368: Advanced DatabaseSlide # 1 PL/SQL Dr. Peeter KirsSpring, 2003 PL/SQL.
7 1 User-Defined Functions CGI/Perl Programming By Diane Zak.
Database Management COP4540, SCS, FIU Oracle PL/SQL (Ch 10.5)
Functions Please use speaker notes for additional information!
Introduction to CGI/Perl Please use speaker notes for additional information!
Sending data, forms and variables Please use speaker notes for additional information!
Why my iPhone sucks: Screen Scraping the O2 Website Simon Lewis -
Controlling Web Site Access Using Logins CS 320. Basic Approach HTML form a php page that collects the username and password  Sends them to second PHP.
>> PHP: Insert Query & Form Processing. Insert Query Step 1: Define Form Variables Step 2: Make DB Connection Step 3: Error Handling Step 4: Define the.
Project: search.cgi cs149 - PERL programming Submitted by: Sheshagiri Pai Instructor and Guide: Professor Jon Degallier Date: 05/22/2006.
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
CPTG286K Programming - Perl Chapter 1: A Stroll Through Perl Instructor: Denny Lin.
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Intermediate Perl Programming Class Four Instructor:
IF statements - selection Please use speaker notes for additional information!
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Intermediate Perl Programming Class Three Instructor:
 2001 Prentice Hall, Inc. All rights reserved. Chapter 7 - Introduction to Common Gateway Interface (CGI) Outline 7.1Introduction 7.2A Simple HTTP Transaction.
Producing a Mail Merged Letter Step 1 Create an Access database for Names and Addresses you can use the ‘Customers’ template in Group Work. Enter the necessary.
Students’ Registration for the MultiMedia Festival Students’ Registration for the MultiMedia Festival A Project on Perl Submitted by: Jayati Das Guided.
CS 330 Class 8 Homework A pattern that contains a word with an optional period A pattern that contains Fred with a space (not Freddy) See regexp.txt guest4.htm.
File Handle and conditional Lecture 2. File Handling The Files associated with Perl are often text files: e.g. text1.txt Files need to be “opened for.
NIMAC for Accessible Media Producers: February 2013 NIMAC 2.0 for AMPs.
QUIZ MODULE. You can Add the quiz title or heading Select the to and form date for the quiz Description of quiz Prize being offered – If you have any.
Sending data with CGI/Perl Please use speaker notes for additional information!
University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Introduction to Web Technologies.
1 After completing this lesson, you will be able to: Create and edit hyperlinks in worksheets. Save worksheets and workbooks as Web pages. Send workbooks.
CS120 The Information Era TOPICS: CGI-Scripts 4/18/05
CGI I: Basics Web Programming.
AOL Customer Services For Instant Help Give a Ring on: Fix AOL Error 66 Dcvs.
Get an UTEID.
Please insert Title Please insert sub-title 1
CGI I: Basics Web Programming.
Presentation transcript:

Perl/cgi and an Access Database Please use speaker notes for additional information!

BCC Students BCC Student List The CIS Department is publishing a newsletter to keep students up-to-date with changes that are being made. This page will give you the opportunity to sign up for the newsletter or remove your name from the newsletter list. Student Name: Student Major: Student Option: address:

#!/usr/bin/perl #bccstudentsA.cgi - add and remove names from CIS mailing list print "Content-type: text/html\n\n"; use CGI qw(:standard -debug); use CGI::Carp qw(fatalsToBrowser); use Win32::ODBC; use strict; #declare variables my ($button, $name, $major, $option, $ , $dbh, $sqlstmt, %dbrow); my ($ErrNum, $ErrText, $ErrConn); #assign values to variables $button = param('button'); $name = param('name'); $major = param('major'); $option = param('option'); $ = param(' '); if ($button eq "Add me to the CIS Mailing List") { add(); } elsif ($button eq "Remove me from the CIS Mailing List") { remove(); } elsif ($button eq "View my information") { view() } exit;

#*****user-defined functions***** sub view { #declare variable my $msg = ""; #open database, read and display the record, close database $dbh = new Win32::ODBC("general") or die( "Failed trying to connect: " ); $sqlstmt = "SELECT * FROM table WHERE = '$ '" ; $dbh->Sql("$sqlstmt"); $dbh->FetchRow(); %dbrow = $dbh->DataHash(); if ( ! $dbrow{ ' ' } == "" ) { #create Web page Print_Pg_Hdr(); print "Name: $dbrow{ 'name' } \n"; print "Major: $dbrow{ 'major' } \n"; print "Option: $dbrow{ 'option' } \n"; print " $dbrow{ ' ' } \n"; print " \n"; } else { $msg = "$ is not on our list. "; Print_Pg_Hdr(); print "$msg \n"; print " \n"; } $dbh->Close(); } #endview Note that I have defined Print_Pg_Hdr which is a user- defined function that I can execute.

$sqlstmt = "SELECT * FROM table WHERE = '$ '" ; $dbh->Sql("$sqlstmt"); $dbh->FetchRow(); %dbrow = $dbh->DataHash(); if ( ! $dbrow{ ' ' } == "" ) { #create Web page Print_Pg_Hdr(); print "Name: $dbrow{ 'name' } \n”; print "Major: $dbrow{ 'major' } \n"; print "Option: $dbrow{ 'option' } \n"; print " $dbrow{ ' ' } \n"; print " \n"; } else { $msg = "$ is not on our list. "; Print_Pg_Hdr(); print "$msg \n"; print " \n"; } $dbh->Close(); } #endview

sub add { #declare variable my $msg = ""; #open database, add record, close database $dbh = new Win32::ODBC("general") or die( "Failed trying to connect: " ); $sqlstmt = "INSERT INTO table VALUES ('$ ', '$name', '$major', '$option');"; $dbh->Sql("$sqlstmt"); ($ErrNum, $ErrText, $ErrConn) = $dbh->Error(); if ($ErrNum) { if ($ErrNum == -1605) { $msg = "$ is already on our list. "; } else { $msg = "Undefined Database error while trying to INSERT $ . "; } Print_Pg_Hdr(); print "$msg \n"; print " \n"; } else { #create Web page Print_Pg_Hdr(); print "You are on our list to receive your newsletter at $ . \n"; print " \n"; } $dbh->Close(); } #end add Note the punctuation when inserting SQL into Perl.

sub remove { #declare variables my $msg = ""; #open database $dbh = new Win32::ODBC("general") or die( "Failed trying to connect: " ); $sqlstmt = "SELECT * FROM table WHERE = '$ '" ; $dbh->Sql("$sqlstmt"); $dbh->FetchRow(); %dbrow = $dbh->DataHash(); if ( ! $dbrow{ ' ' } == "" ) { $sqlstmt = "DELETE FROM table WHERE = '$ ';"; $dbh->Sql("$sqlstmt"); #create Web page $msg = $ . " has been deleted from our mailing list."; Print_Pg_Hdr(); print "$msg \n"; print " \n"; } else { $msg = "$ is not on our list."; Print_Pg_Hdr(); print "$msg \n"; print " \n"; } $dbh->Close(); } #end remove

sub Print_Pg_Hdr { print " \n"; print " CIS Newsletter Mailing List \n"; print " \n"; print " CIS Newsletter Mailing List \n"; } #end Print_Pg_Hdr