Flag This Hub

Programming.a.baby - (Pmg) Server Script Languages (Hello world body)

By


Programming - Article 3

What are

Server Script Languages are Programming languages that work inside a Web Server when a web page is requested, this way, they are very secure since the user cannot see the programming script code behind it, all that he sees is a delivery Html Web Page with some attachments and images.

Some of the famous Server Script Languages:

  • Perl (1987) Unix (Cgi) Language
  • Asp (1989) MS tech using VBScript or JScript
  • Php (1995) Linux (Cgi) Language
  • Asp.net (2002) MS tech using C# or Java

Code Sample 1

<html>

<body>

 <div>
  Hello World
 </div>

</body>

</html> 

Code Sample 2

<html>

<body>

 <div>
  <?php
  echo "Hello World";
  ?>
 </div>

</body>

</html>

Web Page Output 1


Hello World


How a Server Script Language Works

Imagine that:

  • you have a html web page with the name "abc.html"
  • lodged in some server named "mywebhost" and that
  • you possess a domain called "www.mydomain.com" pointed to your Web Host

When some user in the Internet using a Web Browser like "Internet Explorer, FireFox...etc" writes the following name in the address bar "www.mydomain.com/abc.html" it will reach you page, and since it's only a Html document, the server "mywebhost" will deliver this as it is without any treatment.

But now if your Page is not only a Html document, "abc.pl, abc.asp, abc.php, abc.aspx...etc" if there are some Server-side Scripts that need an "software interpreter application", this will change the way you and your Internet users seeing the web page

Samples

  1. Take a look on the Code Sample 1 where i made a simple Html web page document
  2. In the Code Sample 2 i added a small piece of PHP script

When a Internet User write the address "www.mydomain.com/abc.html"

  • he will see in the web page exactly what you are seeing in the "Web Page Output 1"
  • If the User edit your source code, he will see what is in the "Code Sample 1"
  • You and the people with access to your physic web documents are the only that can see the code like it is in the "Code Sample 2"

...


Various Code Samples

In the following Samples you will learn how using different Server Script Languages, you can:

  1. Declare the Script
  2. To give a string value to a Variable
  3. To give a Intact number value to a variable
  4. Make a comment inside the code "this is a comment"
  5. To tell the server to write the Variables and some strings

Perl Code Sample (page.pl)

#!/usr/bin/perl

$username = "Paul"
$age = 35

#This is a Comment!

print "content-type: text/html \n\n";
print "Hello, ";
print username
print " your age is "
print age

Asp Code Sample (page.asp)

<%Language = "VBScript"%>

<%
username = "Paul"
age = 35

'This is a comment

Response.Write "Hello, " & username & " your age is " & age
%>
 

Php Code Sample (page.php)

<?php

$username = "Paul"
$age = 35

//This is a comment

Echo "Hello, " . $username . " your age is  " . $age

?>
 

Asp.Net Code Sample (page.aspx)

<%
 username = "Paul"
 age = 35
%>

<%--
 This is a Comment

 lbl3.Text= "Hello, " & username & " your age is " & age
 --%>
 

<form runat="server">
<h3><asp:label id="lbl3" runat="server" /></h3>
</form>

Comments

No comments yet.

Submit a Comment
Members and Guests

Sign in or sign up and post using a hubpages account.



    Like this Hub?
    Please wait working