Question

In: Computer Science

Create a new PHP document (Unit Objective 1) Write a comment similar to the following: "This...

  1. Create a new PHP document (Unit Objective 1)
  2. Write a comment similar to the following: "This is my first PHP document, which displays some data in the web browser"(Unit Objective 1)
  3. Assign your name as a string value into the variable labeled myName (Unit Objective 2)
  4. Assign 53870 numeric value into the variable named randomNumber (Unit Objective 2)
  5. Assign the name of the web browser and operating system of the user accessing the file into the variable named userAgent (Unit Objective 2)
  6. Assign the file name of the currently running script into the variable named fileName (Unit Objective 3)
  7. Assign the IP address from which the user is viewing the current page into the variable named ipAddress (Unit Objective 3)
  8. Use echo command in order to display some informative descriptions followed by the values of myNem, randomNumber, userAgent, fileName, and ipAddress variables in the web browser. Each informative description and the value pair whould be displayed on a separate line (Unit Objective 4)
  9. Save the file as myFirstPHP.php
  10. Create a folder within the public_html folder in your account in people.ysu.edu, name this folder as "e_commerce".
  11. Create another folder within the "e_commerce" folder you just created, and name this folder as "Assignment_1", and upload "myFirstPHP.php" file into the "Assignment_1" folder.
  12. Attach "myFirstPHP.php" file to your response to this assignment, and submit it.

Solutions

Expert Solution

`Hey,

Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

Below is the myFirstPHP.php file which you can submit.

<?php
   echo '<p>This is my first PHP document</p>';
   $myName = "Sam";
   echo $myName;
   $randomNumber = 53870 ;
   echo $randomNumber;
   if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$useragent = "Windows";
   echo $useragent;
   } else {
$useragent = "other OS";
   }
   $browser = new BrowserDetection();
   echo 'You are using ', $browser->getBrowser(), ' version ', $browser->getVersion();
  
   // to get the client IP address
$ipaddress = '';
if (getenv('HTTP_CLIENT_IP'))
$ipaddress = getenv('HTTP_CLIENT_IP');
else if(getenv('HTTP_X_FORWARDED_FOR'))
$ipaddress = getenv('HTTP_X_FORWARDED_FOR');
else if(getenv('HTTP_X_FORWARDED'))
$ipaddress = getenv('HTTP_X_FORWARDED');
else if(getenv('HTTP_FORWARDED_FOR'))
$ipaddress = getenv('HTTP_FORWARDED_FOR');
else if(getenv('HTTP_FORWARDED'))
$ipaddress = getenv('HTTP_FORWARDED');
else if(getenv('REMOTE_ADDR'))
$ipaddress = getenv('REMOTE_ADDR');
else
$ipaddress = 'UNKNOWN';
echo $ipaddress;

?>

Kindly revert for any queries

Thanks.


Related Solutions

Create a new PHP document (Unit Objective 1) Write a comment similar to the following: "This...
Create a new PHP document (Unit Objective 1) Write a comment similar to the following: "This is my first PHP document, which displays some data in the web browser"(Unit Objective 1) Assign your name as a string value into the variable labeled myName (Unit Objective 2) Assign 53870 numeric value into the variable named randomNumber (Unit Objective 2) Assign the name of the web browser and operating system of the user accessing the file into the variable named userAgent (Unit...
PHP    1. Create a new PHP document (nit Objective 1)    2. Write a comment...
PHP    1. Create a new PHP document (nit Objective 1)    2. Write a comment similar to the following: "This is my first PHP document, which displays some data in the web browser"(Unit Objective 1)    3. Assign your name as a string value into the variable labeled myName (Unit Objective 2)    4. Assign 53870 numeric value into the variable named randomNumber (Unit Objective 2) 5. ssign the name of the web browser and operating system of the...
PHP Question - Subject: PHP File Handling and Uploads INSTRUCTIONS: Objective: • Create a sticky HTML...
PHP Question - Subject: PHP File Handling and Uploads INSTRUCTIONS: Objective: • Create a sticky HTML form. • Submit form for processing. • Sanitize and validate form data. • Upload a profile image. • Add a record to a text file. • Display form results with content from another text file and the uploaded image. Description: This assignment deals with file management. It requires the use of 3 new files and 1 new directory. You will create the new file-uploads.php...
PHP Question - Subject: PHP File Handling and Uploads INSTRUCTIONS: Objective: • Create a sticky HTML...
PHP Question - Subject: PHP File Handling and Uploads INSTRUCTIONS: Objective: • Create a sticky HTML form. • Submit form for processing. • Sanitize and validate form data. • Upload a profile image. • Add a record to a text file. • Display form results with content from another text file and the uploaded image. Description: This assignment deals with file management. It requires the use of 3 new files and 1 new directory. You will create the new file-uploads.php...
PHP Question: Subject: Managing Persistence. Objective: • Create a login script. • Strengthen passwords. • Authenticate...
PHP Question: Subject: Managing Persistence. Objective: • Create a login script. • Strengthen passwords. • Authenticate users. • Create sessions. • Create cookies. • Manage persistence. Description: All dynamic sites need a way to manage access to resources. Many dynamic sites use back-end databases that can contain sensitive information that needs to be securely managed. At the same time, sites want to be inviting to guests. Managing the access to sensitive information is a critical function. Requirements: Update site for...
1. PHP OOP Create a complete PHP enabled website that defines and uses a PineApple class...
1. PHP OOP Create a complete PHP enabled website that defines and uses a PineApple class in PHP. The class has following members. Properties $color: string type $taste: string type $weight: number type Standard constructor, with 3 parameters Member functions eat(): no return, no parameter, print a short paragraph in English to describe how to eat a pineapple. grow(): no return, no parameter, print a short paragraph in English to describe how to grow a pineapple plant. display(): no return,...
1. Create a Word document in the Documents library. Write a small “summary or review” of...
1. Create a Word document in the Documents library. Write a small “summary or review” of an interesting “technology article” – The topics can be anything related to recent news in technology “Example: Launching of new gadgets of Apple, or Artificial Intelligence and its uses, Amazon Web Services etc” please include workcited
PHP Question: Subject: Functions and Arrays. INSTRUCTIONS: Objective: • Write functions. • Use server-side includes. •...
PHP Question: Subject: Functions and Arrays. INSTRUCTIONS: Objective: • Write functions. • Use server-side includes. • Create and utilize a numeric array. • Create and utilize an associative array. Requirements: Create a script file called functions.php, where you will be adding functions. priceCalc() function: • 2 parameters: price and quantity. • Create a numeric array of discounts with the following values: 0,0,.05,.1,.2,.25. • Get the discount percent from the array using the quantity as the index. If the quantity is...
create a document in microsoft word or excel document which has the following: Fictitious names and...
create a document in microsoft word or excel document which has the following: Fictitious names and addresses of 10 folks including name, address and phone number. Recreate the bike table, which includes bike name, part number and hourly rate Please limit your submission to no more than 2 pages.
Imagine that the State of Kentucky want s to create a new lottery similar to the...
Imagine that the State of Kentucky want s to create a new lottery similar to the PowerBall and Mega Millions that has better odds of winning. Kentucky assumes better odds of winning would draw more entries from both Kentucky and surrounding states because of the better odds of winning millions of dollars. Assume Kentucky plans to use 50 white balls and 30 red balls. In this mythical lottery, what is the probability with one entry of matching the five white...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT