IntroductION to SERVER-SIDE WEB PROGRAMMING

Slides:



Advertisements
Similar presentations
Chapter 25 Perl and CGI (Common Gateway Interface)
Advertisements

PHP I.
JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
Session 1 & 2BBK P1 Module5-May-2007 : [‹#›] PHP: The Basics.
Introducing JavaScript
Website Design.
Authoring Languages and Web Authoring Software 4.01 Examine web page development and design.
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
Learning Web development. 3(+1) Tier architecture PHP script Remote services Web Server (Apache, IIS) Browser (IE, FireFox, Opera) Desktop (PC or MAC)
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Guide To UNIX Using Linux Third Edition
JavaScript, Third Edition
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 1 of…
PHP Server-side Programming. PHP  PHP stands for PHP: Hypertext Preprocessor  PHP is interpreted  PHP code is embedded into HTML code  interpreter.
4.01B Authoring Languages and Web Authoring Software 4.01 Examine webpage development and design.
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
Introduction to scripting
 2004 Prentice Hall, Inc. All rights reserved. Chapter 25 – Perl and CGI (Common Gateway Interface) Outline 25.1 Introduction 25.2 Perl 25.3 String Processing.
PHP Workshop ‹#› PHP: The Basics. PHP Workshop ‹#› What is it? PHP is a scripting language commonly used on web servers. –Stands for “PHP: Hypertext Preprocessor”
1 Chapter Two Using Data. 2 Objectives Learn about variable types and how to declare variables Learn how to display variable values Learn about the integral.
Introduction to PHP. PHP PHP is the Hypertext Pre-processor –Script language –Embedded into HTML –Runs as Apache module –Can use DB (MySQL, Oracle, Microsoft.
August Chapter 1 - Essential PHP spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science and Technology.
Chapter 4 – The Building Blocks Data Types Literals Variables Constants.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
INTERNET APPLICATION DEVELOPMENT For More visit:
COP 3813 Intro to Internet Computing Prof. Roy Levow PHP.
School of Computing and Information Systems CS 371 Web Application Programming PHP - Basics Serving up web pages.
Nael Alian Introduction to PHP
IST 210: PHP BASICS IST 210: Organization of Data IST210 1.
CH2 – Using Data. Constant Something which cannot be changed Data Type Format and size of a data item Intrinsic Data Types Pg. 47 – Table 2-1 Basic ones.
CPS120: Introduction to Computer Science
DHTML AND JAVASCRIPT Genetic Computer School LESSON 5 INTRODUCTION JAVASCRIPT G H E F.
Introduction to PHP A user navigates in her browser to a page that ends with a.php extension The request is sent to a web server, which directs the request.
Open Source Software Unit – 3 Presented By Mr. R.Aravindhan.
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Introduction to PHP Advanced Database System Lab no.1.
What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server PHP supports.
Data TypestMyn1 Data Types The type of a variable is not set by the programmer; rather, it is decided at runtime by PHP depending on the context in which.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Programming Fundamentals. Overview of Previous Lecture Phases of C++ Environment Program statement Vs Preprocessor directive Whitespaces Comments.
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
Creating PHP Pages Chapter 6 PHP Variables, Constants and Operators.
4.01B Authoring Languages and Web Authoring Software 4.01 Examine webpage development and design.
CHAPTER 2 PROBLEM SOLVING USING C++ 1 C++ Programming PEG200/Saidatul Rahah.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP Basics.
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
Variables in C Topics  Naming Variables  Declaring Variables  Using Variables  The Assignment Statement Reading  Sections
CMSC 104, Version 8/061L09VariablesInC.ppt Variables in C Topics Naming Variables Declaring Variables Using Variables The Assignment Statement Reading.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
Web Database Programming Using PHP
Chapter 6 JavaScript: Introduction to Scripting
Web Database Programming Using PHP
Introduction to Scripting
PHP Introduction.
Introduction to C++ Programming
WEB PROGRAMMING JavaScript.
PHP.
Introduction to Primitive Data types
Web DB Programming: PHP
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
An Introduction to JavaScript
PHP an introduction.
Introduction to Primitive Data types
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

IntroductION to SERVER-SIDE WEB PROGRAMMING ACM 511 IntroductION to SERVER-SIDE WEB PROGRAMMING ACM 262 Course Notes

Web Development Environment Authoring Web pages is not a particularly difficult task now-a-days. Many standard desktop software packages come equipped with built-in features to convert word processing documents, spreadsheets, databases, and the like to coded documents that are ready for access across the Web. Special Web page authoring packages such as Microsoft FrontPage and Adobe Dreamweaver permit creation of Web pages with drag-and-drop ease. In most of these cases it is not even necessary to know or to be aware of the special HTML(HyperText Markup Language) coding that takes place behind the scenes. If you know the XHTML language, then you can author your Web pages with a simple text editor, usually gaining a great deal more control over their structure and formatting than is possible with drag-and-drop methods. In addition, you have the ability to easily integrate existing XHTML code, Java applets, multimedia plug-ins, and browser scripting languages to bring a modicum of user interactively to your pages. ACM 365 Course Notes

Web Development Environment Web "development," as contrasted with Web page "authoring," goes well beyond the use of markup codes and a few plug-ins or scripting techniques to make attractive and informative Web pages. The term pertains to the use of special strategies, tools, and methods for producing Web pages and Web sites characterized as three-tier, client/server, and information processing systems. Web technologies are used to produce not just simple personal or promotional Web sites containing informative, interesting, or entertaining material for public consumption. Rather, they are becoming important means for supporting the foundational "business processes" of modern organizations -- the underlying operational and management-support functions. The technical infrastructures for supporting these purposes are roughly classified into three types of Web-based systems, termed: intranets , internets, and extranets. ACM 365 Course Notes

Web Development Environment ACM 365 Course Notes

Information Processing Model The input function permits users to interact with the system, requesting processing options, controlling information access, and specifying delivery methods. Plus, the user can become the source of the data which the system processes and which it maintains in its repositories of stored information. The processing function refers to the data manipulation activities and the processing logic needed to carry out the work of the system. The term implies that the system can be "programmed" to perform the arithmetic and logical operations necessary to manipulate input data and to produce output information. The output function delivers the results of processing to the user in a correct, timely, and appropriately formatted fashion. The storage function ensures the currency and integrity of processed information, maintaining it over the long term and permitting it to be added to, changed, or deleted in systematic fashion. In the final analysis, stored information becomes the primary content of Web pages. ACM 365 Course Notes

PHP http://www.sedh.gr/tutorials/web_dev/PHP/default.htm http://phptester.net/ ACM 365 Course Notes

PHP XML tag style Short style <? PHP Code Block ?> Tag style <?php PHP Code Block ?> Short style <? PHP Code Block ?> Tag style <script language="php"> PHP Code Block </script> ACM 365 Course Notes

Mixing HTML and PHP ACM 365 Course Notes

Displaying Content The echo and print statements appear in the following format: echo - used to output one or more strings.  echo "Text to be displayed" print - used to output a string. In some cases the print statement offers greater functionality than the echo statement. These will be discussed in later tutorials. For now print can be considered an alias for echo.  print "Text to be displayed“   With both the echo and print statements, it is necessary to use a <p> or <br/> tag to create paragraphs or line breaks. ACM 365 Course Notes

Displaying Content ACM 365 Course Notes

Instruction Terminator ACM 365 Course Notes

Commenting your code // - simple PHP comment # - alternative simple PHP comment /*...*/ - multi-line comment blocks. Comments are ignored by the PHP parser. ACM 365 Course Notes

Commenting your code ACM 365 Course Notes

Scalar Variables Variables are temporary place holders used to represent values used in a PHP script. PHP includes two main types of variables: scalar and array. Scalar variables contain only one value at a time , and array variables contain a list of values. PHP scalar variables contain the following types: Integers - whole numbers or numbers without decimals. (1, 999, 325812841)  Floating-point numbers (also known as floats or doubles) - Numbers that contain decimals. (1.11, 2.5, .44)  Strings - text or numeric information. String data is always specified with quotes ("Hello World", "478-477-5555")  Boolean - used for true or false values PHP variables of all types begin with the "$" sign. Variable names can contain letters, numbers, and the (_) underscore character. Variables cannot, however, begin with numbers. In PHP variable names are case sensitive. ACM 365 Course Notes

Scalar Variables Legal Variable Names  $myvar  $F_Name  $address1  $my_string_variable  Illegal Variable Names  Myvar  $&62##  $username = "jdoe" $first_name = "John" $Last_Name = "Doe" ACM 365 Course Notes

Scalar Variables ACM 365 Course Notes

Scalar Variables ACM 365 Course Notes

Scalar Variables Variable Concatenation The dot operator can also be used to join strings and variables ACM 365 Course Notes

Scalar Variables Interpolation PHP also supports a process known as interpolation - replacing a variable with its contents within a string. ACM 365 Course Notes

Array Variables While a PHP scalar variable stores a single value, an array variable can be used to store a set or sequence of values. PHP supports numerically indexed arrays and associative arrays. An array in PHP is actually an ordered map. A map is a type that maps values to keys. Array variables consist of two parts - an index and an element. The array index, sometimes referred to as the array key, is a value used to identify or access array elements. The array index is placed in square brackets. Most arrays use numeric indices that typically start with 0 or 1. In PHP associative arrays can use string indices. Both types of arrays are created using the array() construct. ACM 365 Course Notes

Array Variables Numerically Indexed Arrays $my_array = array('red', 'green', 'blue') This code creates a numerically indexed array called $my_array. The array is assigned three elements - red, green, and blue. Each element is identified by a numeric index. $my_array[0] = 'red' //index 0 corresponds to element red $my_array[1] = 'green' // index 1 corresponds to element green $my_array[2] = 'blue' // index 2 corresponds to element blue ACM 365 Course Notes

Array Variables ACM 365 Course Notes

Array Variables Associative Arrays Associative arrays allow you to use more useful index values. With numerically indexed arrays, index values are created automatically beginning with 0. Associative arrays permit numeric and string index values. The symbol between the index and values (=>) is an equal sign immediately followed by a greater than symbol. $members = array('FName' => John, 'LName' => Smith, 'Age' => 50) In this example, the array members contain three elements, however the string indices - FName, LName, and Age are used. $members['FName'] = 'John' //index FName corresponds to element John $members['LName'] = 'Smith' // index LName corresponds to element Smith $members['Age'] = '50' // index Age corresponds to element 50 ACM 365 Course Notes

Array Variables ACM 365 Course Notes

Array Variables Array Functions count() - the count function is used to count the number of elements in an array.  sort() - the sort function is used to sort the elements of an existing array. shuffle() - the shuffle function is used to randomize the elements of a given array. sizeof() - the sizeof function is an alias of the count() function. array_slice($array_name,offset, length) - the array_slice function is used to extract a chuck of an existing array.$array_name is the name of the array to slice, offset denotes the position where the slice will begin, length indicates the number of elements that will be sliced from the array. array_merge($array_name, $array_name) - the array_merge function is used to combine or merge two or more existing arrays. The names of the arrays are separated by commas. ACM 365 Course Notes

Array Variables ACM 365 Course Notes

Constants A constant, like a variable, is a temporary placeholder in memory that holds a value. Unlike variables, the value of a constant never changes. When a constant is declared, the define() function is used and requires the name of the constant and the value you want to give the constant. Constants can be assigned the following types of data: Integers - whole numbers or numbers without decimals. (1, 999, 325812841)  Floating-point numbers (also known as floats or doubles) - Numbers that contain decimals. (1.11, 2.5, .44)  Strings - text or numeric information. String data is always specified with quotes ("Hello World", "478-477-5555") ACM 365 Course Notes

Constants PHP constants unlike variables do not begin with the "$" sign. Constant names are usually uppercase. Constant names can contain letters, numbers, and the (_) underscore character. Constants cannot, however, begin with numbers. Declaring constants is demonstrated below: define("STRING_CONSTANT", "This is my string.");  define("NUMERIC_CONSTANT", 5); ACM 365 Course Notes

Constants ACM 365 Course Notes

Operators 3 examples ACM 365 Course Notes

Operators ACM 365 Course Notes

Operators ACM 365 Course Notes

Operators ACM 365 Course Notes

Strings Single Quoted Strings Single quotes provide the easiest method for working with strings. Using this method, strings are surrounded by single quotes (''). If single quotes are needed as part of the display, they must be escaped with the backslash ("\") character. While single quotes provide an easy method for working with strings, single quotes do not support the use of interpolation. Double Quoted Strings PHP strings can also be displayed using double quotes (""). If PHP strings are enclosed in double quotes, it is possible to take advantage of interpolation. With double quoted strings, PHP also supports more escape characters ACM 365 Course Notes

Strings ACM 365 Course Notes

Strings strlen(string) - determines the length of a string.  ltrim(string) - strips whitespace from the beginning of a string. rtrim(string) - strips whitespace from the end of a string. strpbrk(string, char) - Searchs the string for the character (char). Returns false or string beginning with the character found. strtoupper(string) - converts string to uppercase. strtolower(string) - converts string to lowercase. strrev(string) - reverses a string. eregi(string pattern, string subject) - Performs a case insensitive expression match. Searches subject for a match to the regular expression given in pattern. ACM 365 Course Notes

Strings ACM 365 Course Notes