Write a php script that says welcome back to the user

Assignment Help PHP Web Programming
Reference no: EM13896375

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.

<form action = "./lesson3.php" method = "get">
First name: <input type = "text" name = "firstname">
Last name: <input type = "text" name = "lastname">
<input type = "submit">
</form>

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.

Reference no: EM13896375

Questions Cloud

What maximum height can the glass : A 25 cm tall glass of 12 cm diameter and weighing 2.0 N is pushed on at a height h above the table. If the coefficient of frictionμ_k= 0.30 between the glass and table,at what maximum height h can the glass be pushed if it is not to tip over?
Discuss nature of political competition : Discuss nature of political competition between party and presidential candidates
Determine the number of production lines pennys should have : Penny's Pies is a small specialty supplier to a national coffee-house chain. Based on the information provided in the table, determine the number of production lines Penny's should have.
How come in free fall feel weightless : How come in free fall you feel weightless even though gravity is pulling down on you?
Write a php script that says welcome back to the user : 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 ..
The collision is perfectly elastic : 1. A ball of mass 0.544 kg is moving east with a speed of 3.90 m/s and collides head-on with a 0.272 kg ball at rest. Assume that the collision is perfectly elastic. After the collision, the 0.544 kg ball moves at 1.3 m/s.  What is the speed of the 0..
Explain the development of executive power : Explain the development of executive power
A brick is initially 11.96 cm high : A brick is initially 11.96 cm high and an aluminum can is initially 11.97 cm high. By how much must their temperatures be raised in order for the brick and the can to have exactly the same height?
Which food provides the greater energy per serving : One food product has an energy content of 170 kcal per serving, and another has 280 kJ per serving. Which food provides the greater energy per serving?

Reviews

Write a Review

PHP Web Programming Questions & Answers

  Design a dynamic database using mangodb html and php

design a dynamic database using mangodb html and php. database should be designed to have the subsequent static

  Create an online order form using html

Create an online order form using HTML and process it using PHP for the university bookstore

  1 create a narrative that describes the site to your

1. create a narrative that describes the site to your prospective client.2. create a storyboard diagram depicting the

  Create the html web pages

Create the HTML web pages that you plan to use in the Express Book Shop assignment. Submit a screenshot for each web page

  Pastico corporation hears through the grapevine that its

pastico corporation hears through the grapevine that its employees are unhappy with the working conditions and wages

  What problems in viewing html files without a web server

What are the problems in viewing HTML files without a web server

  For many years the acme company carried on business as a

for many years the acme company carried on business as a manufacturer of consumer products. in 1988 it embarked on

  Write php script using conditional operator-ternary operator

Code the program using conditional operator. You can use ternary operator for this problem or a combination of ternary and conditional operators.

  Prepare an ajax enabled web form

Prepare an AJAX enabled web form utilising a ListView control that will allow logged-in staff to list, edit, delete, insert magazine details for magazines from a selected magazine category.

  Question 1aa design pattern can be classified by its scope

question 1aa design pattern can be classified by its scope which specifies whether the pattern applies primarily to

  Web application development

Create a simple Web Application that collects gradings under a number of criteria, and then calculates an aggregate mark

  What is the goal of your website

What is the goal of your website? What do you want people to learn, believe, or do after interacting with your website? Is your purpose narrow and specific enough that you can adequately achieve it in a small- scale project

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd