Protocols and web:

  • Question: Change the file permission of this file to 700 and try to access it through the browser. What happens? Why?

When you change the file permission to 700 and try to visit the file, it will not give us access to the file. To change the permission to 700 means, that the only one who can access/see/edit it, is the one with permission. So not the public.

  • Question: When clicking a link on you website, the browser reports a “404 Not found“. What problem could cause this and how can you solve it? Is this problem occurring on client or server side?

When getting a 404 error code, it means that the server is responding but that the file can not be found. This can ex be an link error. 

  • Question: Your website returns a “403 Forbidden” page when visitors try to access it. What could cause this and how can you solve it? Is this problem occurring on client or server side?

When we receive a ”403 Forbidden” error code it means that we do not have access or permission to se the file. This is a server side problem and could maybe be solved by changing the permission code to 755, which would allow people to see the file.

border

 

Web languages

  • I am extending on the index.html from Exercise W3, but I upload it to a new folder called lecture2. Now i will can access it with the url: lyl.dk/lecture2/index.html.
  • I start using styling inside the html. I changed the headline color, the background color of the content and the paragraph text.css
<!DOCTYPE html>
<html>
<head>
        <title>Introduction to Web Technology</title>
<style type=”text/css”>
h1{color:red;}
p {color:white;}
#content {background-color: black;}
</style>
</head>
<body>
    <div id=”content”>
           <h1>My Website</h1>
           <p>Ah! A first paragraph on my new website.</p>
     </div>
</body></html>

  • I add a javescript funktion. This loads an alert popup that tells us that the page has loaded. I upload the file as helloJavascript.html to the lecture2 folder i filezilla. Now it can be reached by the url: http://lyl.dk/lecture2/hellojavascript.htmljava
<!DOCTYPE html>
<html>
<head>
<title>Introduction to Web Technology</title>
<style type=”text/css”>
h1{color:red;}
</style>
<script>
           function load(){alert(“Page is loaded”);}
    </script>
  </head>
<body onload=”load()”>
<h1>My Website</h1>
<p>Ah! A first paragraph on my new website.</p>
</body>
</html>

  • Now it’s time for a little php. I created a new file, called hello.php and type the following html and php code into the file.php
<!DOCTYPE html>
<html>
<head>
<style type=”text/css”>
h1{color:red;}
</style>
<title>Introduction to Html.</title>
</head>
<body>
<h1>Hello <?php echo $_GET[“name”];?></h1>
</body>
</html>
  • I use the request type: $_get, which receives value from the URL.
  • Other types would be $_post, $_put, $_head etc.
  • As php is a server side languages, it cant be view locally.
  • So I upload the hello.php file to the lecture2 folder in filezilla.
  • If i visit the url: lyl.dk/lecture2/hello.php, it will now only shows a Hallo.
  • To get a Hallo ”name” you can enter a value in the url like ?name=”value” and the it wil echo: Hallo ”value”.
  • This can, for example, be used to send information back and forward between webpageTo get my name i write url: lyl.dk/lecture2/hello.php?name=mette.