Guest User

Untitled

a guest
Jan 13th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.22 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Injection</title>
  4. <style>
  5. * { font-family: verdana; font-size: 10pt; COLOR: gray; }
  6. b { font-weight: bold; }
  7. table { border: 1px solid gray;}
  8. td { text-align: center; padding: 25;}
  9. .form {margin: 20 20 20 20;padding:25 25 25 25;}
  10. </style>
  11. </head>
  12. <body>
  13. <br /><br /><br /><br />
  14. <form method="post" action="./injection-old.php">
  15. Name: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" size="20" maxlength="30" name="name"><br /><br />
  16. Age:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" size="20" maxlength="30" name="age"><br /><br />
  17. eMail&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" size="20" maxlength="30" name="email"><br /><br />
  18. Comments:<input type="text" size="20" maxlength="200" name="comments"><br /><br />
  19.  
  20. <input type="submit" value="Submit Comments">
  21. </form>
  22. <br /><br />
  23.  
  24. <form method="post" action="./injection.php">
  25. <h4>View details by name</h4>
  26. Name: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" size="20" maxlength="100" name="namequery"><br /><br />
  27. <br /><br />
  28.  
  29. <input type="submit" value="Submit Comments">
  30. </form>
  31.  
  32. </body>
  33. </html>
  34.  
  35.  
  36. <?php
  37.  
  38. $DBhost = "localhost";
  39. $DBuser = "scorpio_vijay";
  40. $DBpass = "shruthi";
  41. $DBName = "scorpio_test";
  42.  
  43. $conn = mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");
  44.  
  45. @mysql_select_db("$DBName") or die("Unable to select database $DBName");
  46.  
  47. $name = $_REQUEST['name'];
  48. $age = $_REQUEST['age'];
  49. $comments = $_REQUEST['comments'];
  50. $email = $_REQUEST['email'];
  51.  
  52. $query = "INSERT INTO injection VALUES('','$name','$age','$email','$comments')";
  53.  
  54. $result = mysql_query($query,$conn);
  55.  
  56. mysql_close();
  57.  
  58. echo $name;
  59. echo $age;
  60. echo $comments;
  61.  
  62. ?>
  63.  
  64.  
  65.  
  66. <?php
  67.  
  68. $DBhost = "localhost";
  69. $DBuser = "scorpio_vijay";
  70. $DBpass = "shruthi";
  71. $DBName = "scorpio_test";
  72.  
  73. $conn = mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");
  74.  
  75. @mysql_select_db("$DBName") or die("Unable to select database $DBName");
  76.  
  77. $name = $_REQUEST['namequery'];
  78.  
  79. $query = "SELECT * FROM injection WHERE name = '$name'";
  80.  
  81. $result = mysql_query($query);
  82.  
  83. $numofrows = mysql_num_rows($result);
  84.  
  85. ?>
  86.  
  87. <html>
  88. <head>
  89. </head>
  90. <body>
  91.  
  92. <table>
  93.     <tr>
  94.         <th>Sno</th>
  95.         <th>Name</th>
  96.         <th>Age</th>
  97.         <th>eMail</th>
  98.         <th>Comments</th>
  99.     </tr>
  100. <?php
  101.     while($row = mysql_fetch_row($result))
  102.         {
  103.             echo "<tr>";
  104.  
  105.             foreach($row as $cell)
  106.                 echo "<td>$cell</td>";
  107.  
  108.             echo "</tr>\n";
  109.         }
  110.        
  111.     mysql_free_result($result);
  112. ?>
  113.     </table>
  114.     </body>
  115.     </html>
  116.  
  117.  
  118.  
  119. <html>
  120. <head>
  121. <title>XSS</title>
  122. <style>
  123. * { font-family: verdana; font-size: 10pt; COLOR: gray; }
  124. b { font-weight: bold; }
  125. table { border: 1px solid gray;}
  126. td { text-align: center; padding: 25;}
  127. .form {margin: 20 20 20 20;padding:25 25 25 25;}
  128. </style>
  129. </head>
  130. <body>
  131. <br /><br /><br /><br />
  132. <form method="get" action="./xss-attack.php">
  133.  
  134. <h4>Comments</h4><br />
  135. <textarea rows="10" cols="50" name="xsscomments"></textarea><br /><br />
  136.  
  137. <input type="submit" value="Submit Comments">
  138. </form>
  139.  
  140. <br /><br />
  141.  
  142.  
  143. </body>
  144. </html>
  145.  
  146.  
  147. <?php
  148. setcookie("Ramanathan","Alex Pandian",time()+3600);
  149.  
  150. if($_REQUEST['xsscomments']){
  151. $xsscomments = $_REQUEST['xsscomments'];
  152. echo $xsscomments;
  153. }
  154. ?>
Add Comment
Please, Sign In to add comment