Internet Technology and its Applications


Published on

A subject named "Internet Technology and its Applications" subject's introduction taught as part of B.E.IV (Computer), 8th semester students, VNSGU, Surat, Gujarat State, India.

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Internet Technology and its Applications

  1. 1. Internet Technology & its Applications Prof. Ami Tusharkant Choksi CKPCET, Surat.
  2. 2. What is Internet Technology? <ul><li>Technology with internet can provide applications, information for internet users. </li></ul><ul><li>First thing come to our minds with internet is web. i.e. www (world wide web) </li></ul>
  3. 3. Applications <ul><li>integration of e-business models with front and back office </li></ul><ul><li>development of an intranet for your employees </li></ul><ul><li>development of an extranet for your customers </li></ul><ul><li>development of a web shop </li></ul><ul><li>implementation of content management systems </li></ul><ul><li>e-mail marketing </li></ul><ul><li>implementation of online payment systems </li></ul>
  4. 4. History of World Wide Web[1] <ul><li>“ A global hypertext space is created in which any network-accessible information could be referred to by a single Universal Document Identifier which was later called WorldWideWeb , a point and click hypertext editor which ran on the NeXT machine”. - Tim Berners-Lee </li></ul>
  5. 5. Requirements To run WWW Programs <ul><li>HTML (HyperText Markup Language) </li></ul><ul><li>URL (Universal Resource Locator) </li></ul><ul><li>HTTP (Hyper Text Transfer Protocol) </li></ul><ul><li>Web Server (Apache, Tomcat, GlassFish, WebLogic, etc.) </li></ul><ul><li>Web application programming languages ( P re H ypertext P rocessor, Java Servlet, J ava S erver P ages, C ommon G ateway I nterface/perl, A ctive S erver P ages, JScipt/JavaScript, VBScript, e X tensible M arkup L anguage ) </li></ul>
  6. 6. What's server side and client side progg. Languages? <ul><li>Programs which runs on server is called server side progg . </li></ul><ul><li>Programs which runs on client is called client side progg . </li></ul>
  7. 7. Server Side Progg. vs. Client Side Progg. <ul><li>Server Side Progg. </li></ul><ul><li>Programs which runs on server </li></ul><ul><li>Compiler/Interpreter for programs needed at client </li></ul><ul><li>PHP, JSP, ASP, Java Servlet, CGI/perl etc. </li></ul><ul><li>Slower </li></ul><ul><li>Applications: Authentication, Authorization </li></ul><ul><li>Client Side Progg. </li></ul><ul><li>Programs which runs on client </li></ul><ul><li>Compiler/Interpreter for programs needed at client </li></ul><ul><li>JavaScript, Jscript, Vbscript, HTML, XML </li></ul><ul><li>Faster </li></ul><ul><li>Applications: Validation of forms done </li></ul>
  8. 8. P re H ypertext P rocessor <ul><li>Opensource product </li></ul><ul><li>Form handling, file processing, and database access </li></ul><ul><li>Server side scripting language </li></ul><ul><li>PHP processor has two modes: </li></ul><ul><ul><li>copy (XHTML) </li></ul></ul><ul><ul><li>interpret (PHP) </li></ul></ul><ul><li>Purely Interpreted </li></ul><ul><li>PHP can be used as </li></ul><ul><ul><li>Server-side scripting </li></ul></ul><ul><ul><li>Command line scripting </li></ul></ul><ul><ul><li>Writing desktop applications </li></ul></ul>
  9. 9. Simple PHP Program (first.php) <ul><li><html> </li></ul><ul><li><body> </li></ul><ul><li><?php </li></ul><ul><li>echo “hi and welcome to the world of PHP”; </li></ul><ul><li>phpinfo(); </li></ul><ul><li>?> </li></ul><ul><li></body> </li></ul><ul><li></html> </li></ul>
  10. 10. Configure Apache For PHP
  11. 11. /etc/httpd/conf/httpd.conf <ul><li>#Use for PHP 5.x: </li></ul><ul><li>LoadModule php5_module modules/ </li></ul><ul><li>AddHandler php-script php </li></ul><ul><li># Add index.php to your DirectoryIndex line: </li></ul><ul><li>DirectoryIndex index.html index.php </li></ul><ul><li>AddType text/html php </li></ul><ul><li>AddType application/x-httpd-php .php </li></ul><ul><li>AddType application/x-httpd-php-source .phps </li></ul><ul><li>Add input/output filters (older versions of Apache, in new versions following code will give error of “an unknown filter was not added: PHP” ) </li></ul><ul><li><Files *.php> </li></ul><ul><li>SetOutputFilter PHP </li></ul><ul><li>SetInputFilter PHP </li></ul><ul><li>LimitRequestBody 9524288</Files> </li></ul>
  12. 12. /etc/httpd/conf/httpd.conf <ul><li>If with user's home directory we want to access </li></ul><ul><li><IfModule mod_userdir.c> </li></ul><ul><li>#UserDir disabled </li></ul><ul><li># To enable requests to /~user/ to serve the user's public_html </li></ul><ul><li># directory, remove the &quot;UserDir disabled&quot; line above, and uncomment the following line instead: UserDir public_html </li></ul><ul><li></IfModule> </li></ul>
  13. 13. /etc/httpd/conf/httpd.conf <ul><li><Directory /home/*/public_html> </li></ul><ul><li>AllowOverride FileInfo AuthConfig Limit </li></ul><ul><li>Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec </li></ul><ul><li><Limit GET POST OPTIONS> </li></ul><ul><li>Order allow,deny </li></ul><ul><li>Allow from all </li></ul><ul><li></Limit> </li></ul><ul><li><LimitExcept GET POST OPTIONS> </li></ul><ul><li>Order deny,allow </li></ul><ul><li>Deny from all </li></ul><ul><li></LimitExcept> </li></ul><ul><li></Directory> </li></ul>
  14. 14. Deploy program on webserver <ul><li>Restart apache web server </li></ul><ul><li>/etc/rc.d/init.d/httpd restart </li></ul><ul><li>OR </li></ul><ul><li>Service httpd restart </li></ul><ul><li>Login as ami(user) </li></ul><ul><li>mkdir public_html </li></ul><ul><li>Put first.php in /home/ami/public_html dir </li></ul><ul><li>chmod -R o+rx /home/ami/* </li></ul><ul><li>chmod o+rx /home/ami </li></ul><ul><li>chmod o+rx /home </li></ul><ul><li>Check in browser </li></ul><ul><li>http://localhost/~ami/first.php </li></ul>
  15. 15. If u have root previllages <ul><li>In /etc/httpd/conf/httpd.conf check for DocumentRoot </li></ul><ul><li>Generally DocumentRoot is /var/www/html </li></ul><ul><li>Put the first.php file in /var/www/html dir </li></ul><ul><li>Set permission of first.php as o+rx </li></ul><ul><li>Run in browser as http://localhost/first.php </li></ul>
  16. 16. Comments in PHP <ul><li>// this is a comment </li></ul><ul><li># shell script like comment </li></ul><ul><li>/* </li></ul><ul><li>C and java-like comments </li></ul><ul><li>*/ </li></ul>
  17. 17. Primitives, Operations, and Expressions <ul><li>- No type declarations of variable </li></ul><ul><li>- Variable can be used as $var </li></ul><ul><li>- An unassigned (unbound) variable has the value, NULL </li></ul><ul><li>- The unset function sets a variable to NULL </li></ul><ul><li>- The IsSet function is used to determine whether a variable is NULL </li></ul><ul><li>- error_reporting(15); - prevents PHP from using unbound variables </li></ul><ul><li>- list predefined variables, including the environment variables of the host OS with phpinfo() in a script </li></ul>
  18. 18. <ul><li>There are eight primitive types: </li></ul><ul><li>- Four scalar types: Boolean, integer, double, and string </li></ul><ul><li>- Two compound types: array and object </li></ul><ul><li>- Two special types: resource and NULL </li></ul><ul><li>- Integer & double are like those of other languages </li></ul><ul><li>- Strings </li></ul><ul><li>- Characters are single bytes </li></ul><ul><li>- String literals use single or double quotes </li></ul>
  19. 19. <ul><li>- Single-quoted string literals (as in Perl) </li></ul><ul><li>- Embedded variables are NOT interpolated </li></ul><ul><li>- Embedded escape sequences are NOT recognized </li></ul><ul><li>- Double-quoted string literals (as in Perl) </li></ul><ul><li>- Embedded variables ARE interpolated </li></ul><ul><li>- Boolean - values are true and false (case insensitive) </li></ul><ul><li>- 0 and &quot;&quot; and &quot; 0 &quot; are false; others are true </li></ul>
  20. 20. Operators <ul><li>As in 'C' language e.g.+, -, *, /, % </li></ul><ul><li>String Functions </li></ul><ul><li>strlen , strcmp , strpos , substr , as in C </li></ul><ul><li>chop – remove whitespace from the right end </li></ul><ul><li>trim – remove whitespace from both ends </li></ul><ul><li>ltrim – remove whitespace from the left end </li></ul><ul><li>strtolower , strtoupper </li></ul>
  21. 21. Type Conversion <ul><li>$a = (int)$b; </li></ul><ul><li>intval($total) </li></ul><ul><li>settype($total, &quot; integer &quot; ) </li></ul><ul><li>The type of a variable can be determined with gettype or is_type </li></ul><ul><li>gettype($total) - it may return &quot; unknown &quot; </li></ul><ul><li>is_integer($total) – a predicate function </li></ul><ul><li>- echo/print/prinf used for print </li></ul>
  22. 22. Control Statements <ul><li>Control Expressions </li></ul><ul><li>- Relational operators - same as JavaScript, </li></ul><ul><li>(including === and !== ) </li></ul><ul><li>- Boolean operators - same as Perl (two sets, && </li></ul><ul><li>and and , etc.) </li></ul><ul><li>- Selection statements </li></ul><ul><li>- if , if - else , elseif </li></ul><ul><li>- switch - as in C </li></ul><ul><li>- The switch expression type must be integer, </li></ul><ul><li>double, or string </li></ul><ul><li>- while - just like C </li></ul><ul><li>- do - while - just like C </li></ul><ul><li>- for - just like C </li></ul>
  23. 23. <ul><li>-foreach (array_expression as $value) </li></ul><ul><li>statement </li></ul><ul><li>foreach (array_expression as $key => $value) </li></ul><ul><li>statement </li></ul><ul><li>- break - in any for , foreach , while , do - while , or </li></ul><ul><li>switch </li></ul><ul><li>- continue - in any loop </li></ul><ul><li>- Alternative compound delimiters – more readability </li></ul><ul><li>if(...): </li></ul><ul><li>... </li></ul><ul><li>endif; </li></ul>
  24. 24. Arrays <ul><li>An array in PHP is an ordered map. </li></ul><ul><li>A map is a type that associates values to keys. </li></ul><ul><li>list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue,etc. </li></ul><ul><li>$arr = array(1, 2, 3, 4, 5);//simple list </li></ul><ul><li>Can be accessed with foreach </li></ul><ul><li>foreach ($arr as $i){ </li></ul><ul><li>echo $i; } </li></ul>
  25. 25. <ul><li>$arr = array(5 => 1, 12 => 2);//hash list </li></ul><ul><li>foreach ($arr as $key => $value) { </li></ul><ul><li>$colors[$key] = strtoupper($value); </li></ul><ul><li>} </li></ul><ul><li>Sorting an array </li></ul><ul><li>sort($arr); </li></ul><ul><li>print_r($arr); </li></ul>
  26. 26. Sorting Arrays <ul><li>rsort - To sort the values of an array into reverse order </li></ul><ul><li>- ksort - To sort the elements of an array by the keys, maintaining the key/value relationships </li></ul><ul><li>e.g., </li></ul><ul><li>$list(&quot;Fred&quot; => 17, &quot;Mary&quot; => 21, &quot;Bob&quot; => 49, &quot;Jill&quot; => 28); </li></ul><ul><li>ksort($list); </li></ul><ul><li>// $list is now (&quot;Bob&quot; => 49, &quot;Fred&quot; => 17, &quot;Jill&quot; => 28, &quot;Mary&quot; => 21) </li></ul><ul><li>- krsort </li></ul><ul><li>- To sort the elements of an array by the keys into reverse order </li></ul>
  27. 27. User Defined Functions <ul><li>Syntactic form : </li></ul><ul><li>function function_name ( formal_parameters ) { </li></ul><ul><li>… } </li></ul><ul><li>- General Characteristics </li></ul><ul><li>- Functions need not be defined before they are called (in PHP 3, they must) </li></ul><ul><li>- Function overloading is not supported </li></ul><ul><li>- If you try to redefine a function, it is an error </li></ul><ul><li>- Functions can have a variable number of parameters </li></ul><ul><li>- Default parameter values are supported </li></ul><ul><li>- Function definitions can be nested </li></ul><ul><li>- Function names are NOT case sensitive </li></ul><ul><li>- The return function is used to return a value; </li></ul><ul><li>If there is no return , there is no returned value </li></ul>
  28. 28. Example <ul><li><?php </li></ul><ul><li>$sum=add(15,20); </li></ul><ul><li>echo &quot;sum : $sum <br> &quot;; </li></ul><ul><li>function add($no1,$no2) </li></ul><ul><li>{ </li></ul><ul><li>return ($no1+$no2); </li></ul><ul><li>} </li></ul><ul><li>?> </li></ul>
  29. 29. Form Handling <ul><li>$_GET and $_POST variables </li></ul><ul><li>$_GET[“varname”]; </li></ul><ul><li>$_POST[“varname”]; </li></ul>
  30. 30. References <ul><li>[1] Tim Berners-Lee, “The World Wide Web: A very short personal history”, </li></ul><ul><li>[2] PHP manual, </li></ul><ul><li>[3] </li></ul>