Internet Programming (PHP)

1

2

3 4

5

6

7

8

9

Write a PHP program to read a flat file student.dat that has student details as rno, name, m1, m2, m3 as marks of 3 subjects. Display the data from the file in a tabular format. Also display total and percentage of each student Write PHP script to design a form to accept two strings (one smaller than the other) from the user. Find whether the smaller string appears at the start of the larger string. Provide a textbox to accept the string that will replace all occurrences of smaller string present in the larger string. Write a PHP script for the following: Design a form to accept two numbers from the user. Give options to choose an arithmetic operation (Use Radio Button). Display the result on the next form. Use the concept of default parameters Write a PHP program to read a directory name and 2 letters. Display the file names in that directory beginning with the either of the given 2 letters. Use regular expressions if required Write a PHP program to read a flat file transaction.date that has the details as tranctionid, accno, amount, type, date. Type attribute can have the value as CR or DR that is debit or credit. Display the transaction details in tabular format for the date given by the user. Also display the total credit and total debit on that day. Consider the following entities and their relationships Movie(movieno, moviename, releaseyear) Actor(actorno, name) Movie and Actor are related with many-to-many relationship with attribute rate in number of Rs. Create a RDB in 3 NF for the above and solve following Create HTML Form having 2 Buttons and write PHP script to: a) Print the name of the movies in which actor has acted. Accept actor name from user. b) Update the release year of a movie. Accept movie name from user. Write a PHP script to define an interface shape which has two methods as area() and volume(). Define a constant PI. Create classes cylinder and cube which implement this interface and calculate area and volume Write a PHP program to read a directory name and extension. Display the files with specified extension from that directory. Write necessary class and member function definitions for a cricket player object. The program should accept details from user (max :10) (player_code, name, runs, innings_played, no_of_times_out). The program should contain following menu. a) Enter details of players. b) Display average runs of a single player. c) Average runs of all players.

d) Display the list of players in sorted order as per runs(use function overloading) e) Exit Write a PHP script to read book.xml file and print specific content of the file using DOMDocument Parser Book.xml file should contain following information with at least five records with values 10

Book Info

- Book No

,Book Name ,Author Name ,Price ,Year

(Note : Examiners can change the Book info file to student info, teacher info etc.) Consider the following entities and their relationships BillMaster(billno, custname, billdate, netbillamt) BillDetails(itemname, qty, rate, total discount) BillMaster and BillDetails are related with one-to-many relationship. Create a RDB in 3 NF for the above and solve following Write PHP script to print the bill in follwing format Accept the Bill number from user. BillNo :

BillDate :

11 Customer Name : SrNo

Particular

Quantity

Rate

Total

Gross Amount : Total Discount : Net Bill : Write PHP program to define an interface shape which has two methods as area() and volume(). Define a constant PI. Create classes cylinder and sphere which implements this 12 interface and calculate area and volume. Display the results. Derive a class square from a class rectangle. Also define a class circle. Create a interface shape with a method findarea(). Implement this interface in all the classes. Include 13 appropriate data members and constructors in all classes. Write a PHP program to accept details of a square, circle and rectangle and display the area Design a page to accept two numbers along with buttons GCD and LCM. Write the PHP function as getgcd() and getlcm() that will return the gcd or lcm of given 2 numbers. Use 14 include construct to include the file of these functions and calculate the GCD and LCM of the numbers given by user.

Write script to create XML file as “mymovies.xml”. The element details of this XML file are as follows:

15

………… …………. ………... …………… Store the details of at least 5 movies. Process mymoves.xml file and produce well formatted tabular output. (Note : Examiners can change xml file and give relevant data )

Write a PHP script for the following: Design a form to accept a string. Write a function to count the total number of vowels from the string. Show the occurrences of each vowel from 16 the string. Check whether the given string is palindrome or not without using built-in functions (Use Radio buttons and the concept of function.) Write a script to create XML file “cricket.xml”. The element details of “circket.xml” are as

17

……………. …………... ………….. ………….. …………... Store the details of at least 5 palyers. Link the cricket.xml file to the CSS and get well formatted output

Write a PHP program to Create a class account (accno, cust_name). Derive two classes from account as saving_acc (balance, min_amount) and current_acc(balance, min_amount). Display a menu a) Saving Account b) Current Account 18 For each of this display a menu with the following options. 1. Create account 2. Deposit 3. Withdrawal

Write an Ajax program to print teacher information from the mysql table: Teacher Teacher(no, name , suject, research area) 19 (Note : Examiner can change mysql table) Write a menu driven program to perform the following operations on an associative array. a) Add defined value to the array b) Remove specified element from the array 20 c) Display the elements of the array d) Exit 21

Write a PHP script to keep track of number of times a web page has been accessed.

Write PHP script to validate email address according to user specification, send mail and give proper error message if email address is not according to specification Write a PHP program to create an associative array of 10 elements. Accept each element from the user and delete a specified element. Display the array before and after deletion. Also, 23 display proper error message if the element is not found in the array. 22

In PHP create login form with a username and password. Once the user logs in, the second form should be displayed to accept user details as (name, city, phone_no). If the user does not 24 enter information within a specified time limit, then expire his session and give a warning message Write Ajax program to read contact.dat file and print the contents of the file in tabular form when the user clicks on the Print button 25 Contact.dat file contains srno, name, residence number, mobile number, context/relation (Enter atleast 5 records in the Contact.dat file) (Note : Examiners may change the contact.dat to emp.dat,dept.dat and provide proper structure of the file) Write a PHP script to change the preferences of your web page like font style, font size, font color, background color using cookie. Display selected settings on next web page and actual 26 implementation (with new settings) on third web page. Consider the following entities and their relationships Doctor(docno, docname, address,city,area) Hospital(hospno, hospname, hospcity) Doctor and Hospital related with many-to-many relationship. 27 Create a RDB in 3 NF for the above and solve following Write PHP script to print the doctors visiting to the Hospital in tabular format. Accept hospital name from user.

Internet Programming (PHP)

Slip – 1 Consider the following entities and their relationships Doctor (doc_no, doc_name, address, city, area) Hospital (hosp_no, hosp_name, hosp_city) Doctor and Hospital are related with many-many relationship Create a RDB in 3 NF for the above and solve following queries in Oracle / Postgresql. Using above database, write a PHP script which accepts hospital name and print information about doctors visiting / working in that hospital in tabular format. Slip – 2 Consider the following entities and their relationships Movie (movie_no, movie_name, release_year) Actor (actor_no, name) Relationship between movie and actor is many – many with attribute rate in Rs. Create a RDB in 3 NF for the above and solve following queries in Oracle / Postgresql. Using above database, write a PHP script which a. accepts actor name and display all movie names in which he has acted, b. accept movie name and list all actors in that movie Slip - 3 Consider the following entities and their relationships Item (item_no, Item_name, qty) Supplier(supp_no, supp_name, address, city, phoneno) Item and Supplier are related with many–many relationship with rate and discount as the attribute of relationships. Create a RDB in 3 NF for the above and solve following queries in Oracle / Postgresql. Using above database, write a PHP script, Create a login form, after validating user name and password give option to 1) Add item 2) Search for an item by name Slip – 4 Write a PHP. Create a flat file of student information - Studentno, name, mark1, mark2 , mark3. Read this file and print the marklist in tabular form. Marklist will contain Studentno, name mark1, mark2 , mark3 and percent for all the students. (Minimum 5 student records should be added).

Slip – 5 Write a PHP script to Accept the Dir name and print the contents of that dir.

Slip – 6 Write a PHP script to create a form that accept the users full name and their email addresses. Use case conversion function to capitalize the first letter of each name, user submits and print result back to browser. Check that the user’s email address contains the @ symbol. Slip – 7 Write PHP script : to create xstring.inc file to include int=xstrstr($s1,$s2) search first occurrence of $1 in $2. Int = xstr_rev($s, $n) n is the position and s is the string. Reverse S from position n (Without using built in functions) Slip – 8 Write a PHP script to create xstring.inc file to include int = xstrcat($S1,$S2) int = x_replace($S1, $S2, position) Replace $S1 with $S2 from position (Without using built in functions ) Slip – 9 Write a PHP script for the following Create a login form with username and password, using http authentication. Once the user logs in the 2nd form should be displayed to accept user details (name, city, phoneno). Display the accepted user details on the next form. Slip – 10 Consider the following entities and their relationships. Employee (Emp_no, Emp_name, Basic_sal) Dept (Dept_no, Dept_name) Employee and Dept are related with many–one relationship. Create a RDB in 3 NF for the above and solve following queries in Oracle / Postgresql Using above database write a PHP script for the following to display the employees earning salary greater than user define salary. (accept salary from user).

Slip – 11 Write a PHP script to accept user preference like background colour, text font, login message. On the next page display login message using the preferences. Slip – 12 Write a PHP script that enables the user to construct his own web form with the capabilities to choose control & then allow the user to submit the form & display the selected controls on next page. Slip – 13 Write a PHP script, which accepts customer info (name,address, phone number) on the first form. Once accepted, on the 2nd form accept sale transaction details like code, name, qty , rate per unit, for five items. Display the bill in tabular format in the next form. (Use of arrays & cookies required). Slip – 14 Write a PHP script for the following Accept a string from the user . provide 3 options : replace , search & concat. (radio buttons). Also provide 2 text boxes. In case replace is selected, provide the replace string & string to be replaced with. For search , provide the search string in one box. For concat, same as search. (use built-in string functions) Slip – 15 Write a PHP script for the following Accept area-wise donation information (state name, area (north, south, east, west), donation amount). Print area-wise donation % for each area (use of arrays or classes required). Slip – 16 Write a PHP script for the following Create a form called shape (rectangle/square/circle) display the area of the selected shape (use the concept of classes & inheritance) Slip – 17 Write a PHP script for the following Accept a string from the user & check whether it’s a palindrome (implement operations using array built-in functions) .

stack

Slip – 18 Write a PHP script for the following Display a reference page of information about an object’s properties, methods & inheritance tree (for each class declared)Define your own classes as required. (One level of inheritance sufficient) Slip – 19 Write a PHP script for the following Create a form to accept customer info (name, address, phone number). Once the customer info is accepted, accept product info in next form (product name, quantity, rate). Display the bill for the customer in the next form. Bill should contain the customer information & the info of the products entered. (Use of sessions required) Slip - 20

Write a PHP script for creating a self-processing page for a form. The form should allow the user to enter the following attributes: Username, user city preference(pune/Mumbai/Chennai/kolkata),user birth date, occupation, sex. If any of the values is not entered by the user, the page is presented again with a message specifying the attributes that are empty. Any form attributes that the user already entered, are set to the values the user entered. The text of submit button changes from “create” to “continue”, when the user is correcting the form. Display the details entered by the user on the next form.