Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.41 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. // 1. printing something
  5.  
  6. // function pr($printThis){
  7. //  echo $printThis;
  8. // }
  9.  
  10. // pr("I am Just a String");
  11.  
  12. // 2. returing something
  13. // function firstFunc( $name  ) {
  14. //  return $name;
  15. // }
  16.  
  17. // echo firstFunc( "hamza" );
  18.  
  19.  
  20. // function add($x , $y, $z) {
  21. //  return $x + $y + $z;
  22.  
  23. // }
  24.  
  25. // echo add( 4 , 5 , 1);
  26.  
  27.  
  28. // 3. doing something in background
  29.  
  30.  
  31. // function returnBool(){
  32. //  return true;
  33. // }
  34.  
  35. // function isUserOk ( $username , $password ) {
  36.  
  37. //  $dbUsername = "thejini3";
  38. //  $dbPassword = "1234";
  39.  
  40. //  // if( $username == $dbUsername && $password == $dbPassword ) {
  41. //  //  return true;
  42. //  // } else {
  43. //  //  return false;
  44. //  // }
  45.  
  46.  
  47. //  return ( $username == $dbUsername && $password == $dbPassword ) ? true : false;
  48. // }
  49.  
  50.  
  51. // if ( isUserOk( "thejini3" , "1234" ) ) {
  52. //  echo "login success";
  53. // } else {
  54. //  echo "login error";
  55. // }
  56.  
  57. // $name = "outside func";
  58.  
  59. // function scopeTest(){
  60.  
  61. //  global $name;
  62.  
  63. //  return $name;
  64. // }
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71. ?>
  72.  
  73.  
  74.  
  75. <?php
  76.  
  77.  
  78.     if(isset($_POST["submitButton"])) {
  79.  
  80.  
  81.         $name = $_POST["myName"];
  82.  
  83.         // echo $name;
  84.  
  85.         if( userExist( $name ) ) {
  86.             echo "login success";
  87.         }
  88.  
  89.     }
  90.  
  91.  ?>
  92.  
  93.  
  94. <form action="" method="post">
  95.  
  96.     <input type="text" name="myName">
  97.     <input type="submit" name="submitButton">
  98.  
  99. </form>
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108. <!-- // Normal Syntex
  109. // 100% - 200% Object Oriented Programming -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement