Advertisement
Guest User

PHP basics

a guest
Jan 23rd, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. PHP Basics
  2. ==========
  3. Server Side Scripting Language
  4.  
  5. <?php
  6. xxxx
  7. xxxx
  8. xxxx
  9. xxxx
  10. ?>
  11.  
  12. <?php ---> Start of PHP code
  13. ?> ---> End of php code
  14. echo "Hello Guys"
  15. $var --> var is name of variable
  16. $hack --> Hack is name of variable
  17. $ ---> used to declare a variable
  18. $_POST
  19. $_GET
  20.  
  21. =========
  22. CALL.html
  23. =========
  24. <html>
  25. <head>
  26. <title>Calculator</title>
  27. </head>
  28. <body>
  29. <form action="calc.php" method="post" attribute="post">
  30. First Value : <input type="text" id="first" name="first"><br>
  31. Second Value : <input type="text" id="second" name="second"><br>
  32. <input type="radio" name="group1" id="add" value="add" checked="true">ADD<br>
  33. <input type="radio" name="group1" id="subtract" value="subtract">SUBTRACT<br>
  34. <button type="submit" id="answer" value="answer">Calculate</button>
  35. </form>
  36. </body>
  37. </html>
  38.  
  39. ========
  40. calc.php
  41. ========
  42. <html>
  43. <head>
  44. <title>Calculator</title>
  45. </head>
  46. <body>
  47. <p>
  48. The Answer is:
  49. <?php
  50. $first=$_POST['first'];
  51. $second = $_POST['second'];
  52. if($_POST['group1'] == 'add')
  53. {
  54. $ans=$first+$second;
  55. echo $ans;
  56. }
  57. if($_POST['group1'] == 'subtract')
  58. {
  59. $ans=$first-$second;
  60. echo $ans;
  61. }
  62. ?>
  63. </p>
  64. </body>
  65. </html>
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. don.html
  74. =========
  75. <html>
  76. <head>
  77. <title>Me Hu DON</title>
  78. </head>
  79. <body>
  80. <h1>Hackers</h1>
  81. <h2>Mr. Ravi Raman</h2>
  82. <p>I am Naval Oficer.<br>
  83. I am an executive Officer.<br>
  84. I am 35 years old.<br>
  85. I am communication specialist.<br>
  86. </p>
  87. <a href="https://en.wikipedia.org/wiki/Black_hat">
  88. <h3>Mr. Madhu</h3>
  89. </a>
  90. <h4>Mr. Hothi</h4>
  91. <img src="spidy.jpg" width="500"></img>
  92. <h5>Mr. Devdas</h5>
  93. <iframe src="http://www.lucideus.com"></iframe><br><br><br><br><br><br><br><br>
  94. <form action="sec.php" method="POST">
  95. Username :<input type="text" id="user" name="users"><br><br>
  96. Password :<input type="password" id="pass" name="passes"><br><br>
  97. <input type="submit" value="Login">
  98. </form>
  99.  
  100.  
  101. </body>
  102. </html>
  103.  
  104. sec.php
  105. =======
  106. <html>
  107. <head>
  108. <title>SuperHero</title>
  109. </head>
  110. <body>
  111. <h1>This Is My Fav. SuperHero</h1>
  112. <img src="shakti.jpg">
  113. <?php
  114. $username=$_POST['users'];
  115. $password=$_POST['passes'];
  116. if($username == "admin")
  117. {
  118. echo "Welcome to password protected area admin";
  119. if($password="passes")
  120. {
  121. echo "Welcome admin";
  122. }
  123. else
  124. {
  125. echo "Wrong password";
  126. }
  127. }
  128. else
  129. {
  130. echo "Wrong username";
  131. }
  132. ?>
  133. </body>
  134. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement