Write a php script that says welcome back to the user if


1. Write a script that prints out the following text to the screen exactly as shown:

"Hey", he said, "You still owe me \‘$5'\ from \\\ that $50 I lent "last week"".

2. Write a script that uses a loop to write the values 1 to 1000, one value per line. Inside the loop skip printing number 250, and determine if the next number to be written is 500. If it is, stop the loop.

3. Write a PHP script that uses an array called $array to store the values of firstname and lastname that are sent by the following form.


First name:
Last name:

Write the code to add those values from the form to the end of the $array array. Then use a foreach loop to print out the values from $array.

4. Write a PHP script that opens a text file called "lesson04.txt" for appending (or creates it if it does not yet exist); if there is a problem opening/creating the file, terminate the PHP script. Write the text "\nCOMP2920 will be fun\n" to the text file, and close the file.

5. Write a regular expression that matches only the following:

A street address that has the following pattern (in the following order):

An optional # sign                                                                                   e.g. "#"

1 to 5 digits (optional - apartment number)                                               e.g. "100"

an optional dash, which has an optional space on either side of it                e.g. " - "

1 to 5 digits (street number)                                                                    e.g. "7777"

"th" or "st" or "nd" or "rd" (optional)                                                         e.g. "th"

At least one space                                                                                  e.g. " "

"Street" or "street" or "Avenue" or "avenue" or "Ave" or "ave"                   e.g. "Street"

Examples that meet the criteria:
"#100 - 7777th Street"
"100-7777 ave"

Examples that do not meet the criteria:
"abc100 - 7777 ave"
"100-7777 ave XYZ"

$regex = "

6. Write a PHP script that says "Welcome back" to the user if they have visited the site in the past 10 minutes. If the user has NOT visited in the past 10 minutes, tell them "Welcome to my Web site" and store a cookie that will remember them for 10 minutes. Use a cookie called "tenminutes".

7. Write a script that checks for the existence of a session variable called "lastname". If the variable does not exist, tell the user "farewell" and terminate the script. If the variable does exist, print its value to the screen and create a session variable called "logged", and set its value to true. Write all of the code necessary to make the script work.

8. It is not easy to test graphics without using a reference guide. Instead, describe your favourite and least favourite parts of this course. Any thoughtful reply will earn top marks. Incomplete or unhelpful comments can earn zero marks.

9. I have created a database account on a host called "blah.com". You can connect to the host with username "tony" and password "comp1920".

The database is called "information". There is a table in this database called "names" with the following fields:
- firstname varchar(40)
- lastname varchar(40)
- middlename varchar(40)
- nickname varchar(40)
- username varchar(40)

Write a PHP script that connects to the database server, or dies if it cannot connect. Select the "information" database. Insert a record into the database.

10. Continuing from question 9 (do not repeat that code here), write a script to list all of the records in the "names" table of the "information" database, sorted by nickname.

11. Your instructor likes to learn new things, too.

What is the meaning of life? Tell your instructor anything that makes him *think*. Any attempt at an honest answer will score full marks. Your instructor has learned lots of interesting things from students.

Solution Preview :

Prepared by a verified Expert
PHP Web Programming: Write a php script that says welcome back to the user if
Reference No:- TGS01189573

Now Priced at $50 (50% Discount)

Recommended (91%)

Rated (4.3/5)

A

Anonymous user

3/12/2016 2:12:40 AM

1. Make a script that prints out the subsequent text to the screen exactly as exposed: "Hey", he said, "You still owe me \‘$5'\ from \\\ that $50 I lent "last week"". 2. Make a script that utilizes a loop to write the values 1 to 1000, one value per line. Inside the loop skip printing number 250, and find out if the next number to be written is 500. If it is, stop the loop. 3. Write a PHP script that utilizes an array called $array to store the values of 1st name and last name that are sent via the subsequent form.