Home » Web Design

Category Archives: Web Design

Web Design – Final Exam

You need to be registered and logged in to take this quiz. Log in

Web Design – Week 10 Quiz

You need to be registered and logged in to take this quiz. Log in

Web Design – Week 10 – Assignments

Web Design Online Class

assignment

Week 10 Objectives

Remember, we cannot use PHP code straight with the WordPress posts or pages. This is why we need a plugin, in order to write PHP code in our posts/pages.

Assignment:

  • Download and install the plugin PHP Code for posts found Found here.
  • Attempt to review some PHP examples, and create at least one php script.
    • Some PHP examples can be found here.
  • Complete Week 10 Quiz

 

Quiz:
Week 10 Quiz

Web Development – PHP Code for Identifying End User

Client IP Demo

Your IP address : 54.92.197.82
Your hostname : ec2-54-92-197-82.compute-1.amazonaws.com

——————-

There is no Forwarding IP found.

——————-

If we look at the php code to identify the IP, we see the following.

$ip = $_SERVER[‘REMOTE_ADDR’];
echo “<h2>Client IP Demo</h2>”;
echo “Your IP address : ” . $ip;
echo “<br>Your hostname : “. gethostbyaddr($ip) ;

Breaking the code down:

$ip = $_SERVER[‘REMOTE_ADDR’];

The Server information is first placed in the variable $ip.

echo “<h2>Client IP Demo</h2>”;

The echo is simply sending out the string as header 2 size.

echo “Your IP address : ” . $ip;

This echo gives the string “Your IP Address :” The provided value in variable $ip is then given to us.

echo “<br>Your hostname : “. gethostbyaddr($ip) ;

The main value provided here is the host name, from the parameter “gethostbyaddr” for the variable $ip.

Web Design – PHP Code – Server Date_Time

This sample is using the Plugin “PHP Code for posts”. The link is found here.

php-serverdate_time
Note this plugin works similar to Watu Quizzes. You create your PHP code within the plugin, which provides you “snippets”, or shortcodes. You then past the short code in your WordPress post or page.

Current date and local time on this server is 2018-02-21 (Wed) 18:53:09

The outcome of this initial php code is above, php snippet=2.

.

$timestamp = time();

The function time() provides us the time value, which is placed in the variable $timestamp.
The time server is listening on TCP/UDP port 13 and sends an ASCII string (one line, no format defined)

$datum = date(“Y-m-d (D) H:i:s”,$timestamp);

The $datum is our variable for the full date and time.
date() is the function, while the parameters Y-m-d gives us our year-month-day.

 

echo “Current date and local time on this server is $datum <br>\n”

The echo is the easier part of identifying what is going on.
This provides our string, “Current date and local time on this server is
While the $datum is the variable containing the value of the date/time

 

An expanded explanation of the parameters/format within the DAYTIME are below.

  JJJJJ – the Julian Date is : 53746
YR-MO-DA – the Date is : 2006-01-11
HH:MM:SS – the Time in UTC is : 21:28:49
TT – Indication whether USA is on Standard Time (ST) or Daylight Saving Time (DST) : 00 (Standard Time)
L – Leap second at the end of the month (0: no, 1: +1, 2: -1) : 0
H – Health of the server (0: healthy, >0: errors) : 0
msADV – time code advanced in milliseconds to compensate network delays : 266.1
UTC(NIST) – the originator of this time code : UTC(NIST)
OTM – on-time marker : *

Web Design – Testing Echo Hello World Snippet

This sample is using the Plugin “PHP Code for posts”. The link is found here.

php-helloworldsnippet

Note this plugin works similar to Watu Quizzes. You create your PHP code within the plugin, which provides you “snippets”, or shortcodes. You then past the short code in your WordPress post or page.

PHP is Fun!

Hello world!
I'm about to learn PHP!
This string was made with multiple parameters.

The outcome of this initial php code is above, php snippet=1.

echo “<h2>PHP is Fun!</h2>”;
echo “Hello world!<br>”;
echo “I’m about to learn PHP!<br>”;
echo “This “, “string “, “was “, “made “, “with multiple parameters.”;

The echo is PHP code to send out or display to the end user. In our above code, we see PHP is simply displaying the HTML and string values within the double quotes.

Web Design – Week 9 Assignments

Web Design Online Class

assignment

Week 9 Objectives
• Overview of PHP Link found here

 

Assignment:

  • Complete Week 9 Quiz

 

Quiz:
Week 9 Quiz

Web Design – Week 9 – Quiz

You need to be registered and logged in to take this quiz. Log in

Web Design – PHP Intro

PHP 

php

History of PHP

The first version of what came to be known as PHP was created in 1995 by a man named Rasmus Lerdof. At this time, HTML (Hyper Text Markup Language) was the only means to create a webpage. Rasmus was looking for something to work along with HTML, yet provide him more power and remain easy to create the content in his web pages. Adopting the Perl language, he created scripts to handle his web pages. He called this new technology “Personal Home Page/Forms Interpreter”. This was later shortened down to “PHP/FI”, and later came to be known simply as “PHP”.  Not until 1997, with the PHP version 3, did we see an explosion of the use of PHP.

 

How does PHP work?

Recall the html files or posts/pages in your website are only files. When a user clicks to view your webpage, the file is transmitted to the users PC’s browser. That browser then interprets the view of the webpage, based off the html, javascript, ECT. (This is why we see HTML code to define how each possible browser should interpret the page)

PHP works differently. Rather than sending a PHP file over to the web browser (it would not know how to interpret it), PHP is a preprocess module. What this means is, PHP is a scripting language within the web server. When a user requests your webpage, having PHP on the server, that request passes into the PHP pre-process module. The script creates then content (file) to be sent to the user.

So, rather than a simple file being passed to the web browser, PHP creates the file prior of sending to the web browser.

 

How does PHP look?

 

Below is a simple HTML code, with PHP embedded in the body. “<?php”  tells the webserver, this is PHP.

<html>
<head>
<title>A PHP Example</title>
</head>
<body>

<?php
echo ‘<p>This line of HTML was generated by a PHP script embedded into an HTML document</p>’;
?>

</body>
</html>

 

The PHP module would interpret the php code, prior to sending out to the web browser. The web browser will never see “<?php”.

 

<html>
<head>
<title>A PHP Example</title>
</head>
<body>

<p>This line of HTML was generated by a PHP script embedded into an HTML document</p>

</body>
</html>

The web browser will only receive the above information.

Usability of PHP?

PHP scripting is executed in the web server before providing the content to the end user. Note Javascript scripting is executed in the end users web browser. PHP is more efficient when providing information to the end user.

Let’s give a scenario to better understand this.

A large database resides on the web server, containing inventory. The end user is requesting a search for specific information on that database.

Use of Javascript:

  • End user sends the information
  • Javascript sends end user it’s code
  • End user web browser translates the code
  • The request is resent to pull the database information
  • The requested information is sent to the end user

Use of PHP:

  • End user sends the information
  • PHP translates the code on the web server, with database
  • The requested information  is sent to the end user

In this crude example, we see PHP falls between at static HTML page, and JavaScript. But more importantly PHP’s design is different than Javascript, by processing on the web server, prior to sending the content.

Web Design – Week 8 – Quiz

Please enter your email:

1. Provide your name for the quiz.

2. This week we find out SEO stands for

 
 
 

3. Page Authority views

 
 
 

4. I provided a link to Rohit Palit article covering domain authority.

How many words did that article have?

 
 
 

5. Some improvements covered to increase page/domain authority were:

 
 
 

6. Two Stanford PHD students noticed if the web page had a lot of

key words, it didn’t mean the page was relevant. Rather if the page was

cited often (back links). They created Google off this concept.

Who were they?

 
 
 

Question 1 of 6