1 / 15

NMD202 Web Scripting

NMD202 Web Scripting. Week9. What we will cover today. Solution exercise last week Ajax and PHP Exercises PHP Ajax Frameworks Exercises Assignment 1. Exercise. Create a username/password table and use it to store usernames and password hashes.

Télécharger la présentation

NMD202 Web Scripting

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. NMD202 Web Scripting Week9

  2. What we will cover today Solution exercise last week Ajax and PHP Exercises PHP Ajax Frameworks Exercises Assignment 1

  3. Exercise Create a username/password table and use it to store usernames and password hashes. Use http://md5-hash-online.waraxe.us/ to create hashes Use cookies and sessions to confirm authentication. Use a salt to harden your hashes (don’t forget to include the salt when calculating hashes for the user table)

  4. Ajax and PHP What is AJAX?

  5. Ajax and PHP Technique that allows exchanging small amounts of data with the server "behind the scenes" so that entire web pages do not have to be reloaded each time there is a need to fetch data from the server.

  6. Ajax and PHP

  7. AJAX and PHP var xmlHttp=null; try { xmlHttp = new XMLHttpRequest(); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { document.getElementById("ajax_output").innerHTML = xmlHttp.responseText; } } xmlHttp.open("get","pages/index.html"); xmlHttp.send(null);

  8. Ajax and PHP Check example at: http://learnline.cdu.edu.au/units/webscripting/classmaterials/source/ajax/

  9. Exercise Build a Filter on the student list that filters the list of students based on the student name. ie: user inserts ‘L’ all users starting with L will be displayed. Tip: Use a Like statement

  10. PHP Ajax Frameworks Frameworks Make PHP Ajax development very simple Some you don't even have to write any PHP Most use PHP Object Oriented Features

  11. PHP Ajax Frameworks Ajax Agent Simple Framework that handles simple Ajax Calls http://ajaxagent.org

  12. PHP Ajax Frameworks Ajax Agent 1-Include agent.php file 2-Initialize Agent ($agent->init(); ) this will write all necessary javascript to handle Ajax Calls 3- Call the agent – agent.call(url,phpFunction,callBackFunction,[list of variables]); url – URL where the php functions is located, leave empty for current page phpFunction – Server side functions to be called by ajax callBackfunction – Client Side function to run after ajax request has finished [list of variables] - Optional variables to pass to the server side function (comma separated)

  13. PHP Ajax Frameworks Ajax Agent Check Example at: http://learnline.cdu.edu.au/units/webscripting/classmaterials/source/ajaxAgent/

  14. Exercise Rewrite last exercise using Ajax Agent

  15. Assignment 1

More Related