Download Server-side Scripting and more Exams System Programming in PDF only on Docsity!
Server-side Scripting
Slides courtesy of Xenia Mountrouidou
URLs and web servers
Usually when you type a URL in your browser:^
Your computer looks up the server's IP address usingDNS
Your browser connects to that IP address and requeststhe given file
The web server software (e.g. Apache) grabs that filefrom the server's local file system
The server sends back its contents to you
2
http://server/path/file
URLs and web servers (cont.)
Some URLs actually specify programs that the webserver should
run
, and then send their output back
to you as the result:^
The above URL tells the server
facebook.com
to run the
program
home.php
and send back its output
4
http://
www.facebook.com/home.php
Server-Side vs. Client-Side What are they and what are their differences? Scripting Languages
By Lories Slockbower
Types of Scripting Languages
Server-side Scripting Language^
Can use huge resources of the server Complete all processing in the server and send plain pages to the client Reduces client-side computation overhead
Client-side Scripting Language^
Does not involve server processing Complete application is downloaded to the client browser Client browser executes it locally Are normally used to add functionality to web pages e.g. different menustyles, graphic displays or dynamic advertisements
Different Scripting Languages
Active Server Pages (ASP)^
Server side scripting language
Developed by Microsoft
Good at connecting to Microsoft databases
Runs only on Microsoft servers
Perl^
Old UNIX language
Found on all Windows and Linux servers
Can handle text manipulation tasks
Excellent web scripting language
Different Scripting Languages
CGI (Common Gateway Interface)^
Server-side solution Needs to launch separate instance of application for each web request Allows direct interaction with users
ASP.NET^
Server-side technology to create faster, reliable and dynamic webpages Supports .NET framework languages (C#, VB.NET, JScript.NET) Provides flexibility to designers and developers to work separately
Different Scripting Languages
VBScript^
Microsoft’s scripting language Client side Scripting language Very easy to learn Includes the functionality of Visual Basic
JavaScript^
Client-side Scripting language Easy to use programming language Enhance dynamics and interactive features of a web page Allows to perform calculation, write interactive games, add specialeffects, customize graphic selections, create security passwords
What is server-side scripting?
Server-side scripting is amethod of programmingfor the web that runssoftware on the serverrather than the browseror installed plugins tocreate dynamic webpages.
Server-Side Scripting
Server-side pages are programs written using oneof many web programming languages/frameworks^
examples: PHP, Java/JSP, Ruby on Rails, ASP.NET,Python, Perl
14
Advantages of server-side scripting
User does not need to downloadplugins like Java or Flash
User can create one template forthe entire website
The site can use a contentmanagement system which makesediting simpler.
Generally quicker to load thanclient-side scripting
User is able to include external filesto save coding
Scripts are hidden from view so it’smore secure. Users only see theHTML output.
Disadvantages of server-sidescripting
The scripts can be used byattackers to access the server.They do this by changing theURL to something that takesadvantage of a hole insecurity. System administratorsmust keep all server-sidescripting updated and use anapplication firewall to preventthis.
Scripting software must beinstalled on the contentmanagement system tools inorder to store the dynamicdata.
What is client-side scriptinglanguage?
Client-side scripts
are placed within
an HTML document in the user’s webbrowser rather than the web serverto allow greater interactivity in adocument.
For example – client-side
scripting could check the user’s formfor errors before submitting it
Enables web pages to changecontent according to user input andother variables, including the time ofday. Can also be stored in aseparate file that is referenced tothe documents that use it.
How does it work?
Usually, JavaScript codestarts with the tag <scriptlanguage="JavaScript">and ends with the tag.
Files are first sent to theuser’s computer by theweb server which executesthe script and displays thedocument.
The client-side script mayalso include browserdirections based oncertain user functions suchas clicking buttons.
Frequently, you can seethe the source card byviewing the file thatcontains the script.