Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

Php session 3 Important topics

958 Aufrufe

Veröffentlicht am

important PHP topics covered by simple description

Veröffentlicht in: Bildung
  • Als Erste(r) kommentieren

  • Gehören Sie zu den Ersten, denen das gefällt!

Php session 3 Important topics

  1. 1. ENG / Mohamed Saad pamicloud.com  Include Statement  Code Reuse  Require Statement  Case Study 
  2. 2. Include PHP Statement Include statement are used to include the contents of one PHP file within another PHP file. Contents are treated as PHP Code. Include Statement Syntax Include ‘header.php’ Include (‘header.php’); 
  3. 3.
  4. 4.  <!DOCTYPE html>  <html xmlns="http://www.w3.org/1999/xhtml">  <head>  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  <meta name="viewport" content="width=device-width, initial-scale=1.0">  <meta name="description" content="Free Learning Session , learn wherever you are whenever you want.keep learning">  <meta name="author" content="pamicloud.com">  <title>Home | PamiCloud</title>  <!---------------------------------------------------------------------------------->  <link rel="shortcut icon" href="imgs/pami.png">  <link rel="apple-touch-icon-precomposed" sizes="144x144" href="img/pami.png">  <link rel="apple-touch-icon-precomposed" sizes="114x114" href="img/pami.png">  <link rel="apple-touch-icon-precomposed" sizes="72x72" href="img/pami.png">  <link rel="apple-touch-icon-precomposed" href="img/pami.png">  </head>  <body>  <h1>Welcome to Pami Cloud dot com</h1> 
  5. 5. <?php include "header.php"?> <hr /> <img src="imgs/pami.png" title="pamicloud.com" alt="pamicloud" /><br /> <h3><a href="http://pamicloud.com">pamicloud</a>< /h3> </body> </html>
  6. 6. From Header.php 
  7. 7.  <?php include "header.php"?>  <hr />  <img src="imgs/pami.png" title="pamicloud.com" alt="pamicloud" /><br />  <h3><a href="http://pamicloud.com">pamicloud</a></h3>  <form action="process.php" method="post">  <input type="text" name="username">  </form>  <hr>  <h1>submit to same page</h1>  <form action="process.php" method="post">  Username : <input type="text" name="username"><br>  <input type="submit" name="login">  </form>  <?php  if(isset($_POST['login'])){  //process  echo $_POST['username'];  print_r($_POST);  }  ?>  </body>  </html> 
  8. 8.  Can not include any file at all…!?  The behavior of these functions is affected by settings in php.ini. allow_url_fopen "1" allow_url_include "0" 
  9. 9.  Can not include any file at all…!?  The behavior of these functions is affected by settings in php.ini. ini_set("allow_url_fopen", "On"); php_value allow_url_fopen On 
  10. 10. Sets the value of the given configuration option. The configuration option will keep this new value during the script's execution, and will be restored at the script's ending. <?php echo ini_get('display_errors'); if (!ini_get('display_errors')) { ini_set('display_errors', '1'); } echo ini_get('display_errors'); ?> ini_get() - Gets the value of a configuration option. 
  11. 11. Sets the value of the given configuration option. The configuration option will keep this new value during the script's execution, and will be restored at the script's ending. <?php echo ini_get('display_errors'); if (!ini_get('display_errors')) { ini_set('display_errors', '1'); } echo ini_get('display_errors'); ?> ini_get() - Gets the value of a configuration option. 
  12. 12. Gets all configuration options 
  13. 13. <a href=“http://yourdomain.com?user=saad”> Print user name</a> <?php If ( isset ($_GET[‘user’]) ) {echo ($_GET[‘user’];} ?> 
  14. 14. <a href=“http://yourdomain.com?user=saad&pass=asdfg”> Print user data</a> <?php If ( isset ($_GET[‘user’]) ) {print_r($_GET);} ?> 
  15. 15. URL have specific syntax rules. Only :  Uppercase & lowercase Characters.  Underscores.  Tildes  Hyphens  Decimal digits Spaces should be removed Pami Cloud-> Pami+Cloud 
  16. 16.  Used in Comparison Operator .  It`s mean true or false.  We already know  String.  Integer.  Float. TRUE or false Not case sensitive All upper or all lower 
  17. 17.  The special data type is used for variables that have no data assigned to them.  A variable can be NULL if:  No value assigned to it.  The variable has been unset $X == NULL Correct syntax to Compare with NULL 
  18. 18.  PHP a weak-typed language meaning it does not require data type.  Value will determine variable data type.  Type juggling process or automatic type conversion. Juggling Process Called Type Casting 
  19. 19.  Error:  Handling.  Reporting.  Control Operator. 
  20. 20.  Error:  Handling.  Reporting.  Control Operator. 
  21. 21.  Php.ini directive error_reporting is used to set which type of error PHP have to catch .  (predefined config constants)  E_ERROR(int)  Run time - Fatal error , can not be recovered.  E_WAENING  Run time – execution of the script is completed.  E_PARSE  Compile time – parse errors 
  22. 22.  PHP provide an error control operator @, which is used to supress errors generated by expressions.  It`s Un-array operator.  $php_errormsg variable stores last error 
  23. 23.  Php.ini directive error_reporting is used to set which type of error PHP have to catch .  (predefined config constants)
  24. 24.
  25. 25.  Register_globals is a configuration directive that automatically creates global variables.  $_GET[‘name’] however if register_globals was set to on php automatically create variable with global scope called $name;  But it`s Deprecated from php since ver 5.3.0. 
  26. 26.  MeanTurned off by default. 
  27. 27.  Equality: ==  in Equality :!=  Identity :===TRUE if have same Key/Value of the same type  Not-identity :!==  The Union operator + used to append any mew key/value pairs in the end of the array. 
  28. 28.  Var var are variable that can be defined dynamically with PHP scripts.  Example $x=“user” $$x = $user 
  29. 29. By the way  
  30. 30. Is that Real 
  31. 31.  __LINE__ :current exe line number.  __FILE__ :absolute path to script being exe.  __DIR__ :absolute directory of script been exe.  __FUNCTION__ :name of the function currently exe. 
  32. 32.  PHP Provide the exit() construct which can used to terminate the execution of a script.  Die() is just another name 
  33. 33.  Location HTTP Header: header(“Location: http://cx.com”); You must call header function before any generated output 
  34. 34. Case Study
  35. 35. Case Study
  36. 36. Case Study Solution From PHP Configuration directives php.ini: Turn Output buffer on , It`s off by default. Output_buffering=On
  37. 37. Case Study Solution At the first beginning of your code: Ob_start();
  38. 38. ThankYou End of PHP SESSION 4 ENG / Mohamed Saad pamicloud.com 

×