Advertisement
Guest User

Untitled

a guest
Jul 30th, 2017
488
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. <html>
  2.  
  3. <?php
  4. /*echo $_SERVER['SSL_CLIENT_S_DN_CN'];
  5. echo $_SERVER['SSL_PROTOCOL'];
  6. echo "hallo";
  7. echo $_SERVER['PHP_SELF'];*/
  8.  
  9. if ((($_SERVER['SSL_CLIENT_S_DN_CN'] == "veroniwa@stud.ntnu.no" || $_SERVER['SSL_CLIENT_S_DN_CN'] == "idamalo@stud.ntnu.no"|| $_SERVER['SSL_CLIENT_S_DN_CN'] == "martetar@stud.ntnu.no") && $_SERVER['SSL_CLIENT_I_DN_CN'] == "Student CA") || $_SERVER['SSL_CLIENT_I_DN_CN'] == "Staff CA") {
  10. echo "Hi! You are (hopefully) Veronica, Marte, Ida Malene or a member of the staff. Good for you";
  11. ?>
  12.  
  13. <h1>Welcome!</h1>
  14.  
  15. <h2> Add user </h2>
  16. <form name="input" action="signup.php" method="post">
  17. <input type="hidden" name="Add" value="1">
  18. <p>
  19. Username <input type="text" name="username" value="">
  20. </p>
  21. <p>
  22. Password <input type="password" name="password" value="">
  23. </p>
  24. <p>
  25. <input type="submit" name="AddUser">
  26. </p>
  27. </form>
  28.  
  29. <h2> Delete user </h2>
  30. <form name="input" type="2" action="signup.php" method="post">
  31. <input type="hidden" name="Delete" value="2">
  32. <p>
  33. Username <input type="text" name="username" value="">
  34. </p>
  35. <p>
  36. <input type="submit" name="DeleteUser" >
  37. </p>
  38. </form>
  39.  
  40. <?
  41. echo "<table border='1'>
  42. <tr>
  43. <th>Username</th>
  44. </tr>";
  45.  
  46. $con1 = new mysqli("localhost","gr13","gr13ttm4135", "dbgr13");
  47. $result = mysqli_query($con1,"SELECT username FROM clients");
  48.  
  49. while($row = mysqli_fetch_row($result)) {
  50. echo "<tr>";
  51. echo "<td>" . $row['Username'] . "</td>";
  52. echo "</tr>";
  53. }
  54. echo "</table>";
  55.  
  56. mysqli_close($con1);
  57. ?>
  58.  
  59. <?
  60. $con2 = new mysqli("localhost","gr13","gr13ttm4135", "dbgr13");
  61. if (!$con2) {
  62. die('Could not connect: ' . mysqli_error());
  63. }
  64. else {
  65. if ($_SERVER['REQUEST_METHOD'] == "POST" && !empty($_POST['username']) && !empty($_POST['password'])) {
  66. $username = $_POST['username'];
  67. #$password = $_POST['password'];
  68. $pwd = sha1($_POST['password']);̈́
  69. $newuser = $con2->query("INSERT INTO clients (username, password) VALUES ('$username', '$pwd')");
  70. #$checkuser = is_user_available($connection , $username);
  71.  
  72. #if($checkuser>0){
  73. # add_user($connection, $username, $password);
  74. #}else{
  75. # echo "I'm sorry but the username you specified has already been taken. Please pick another one.";
  76. #}
  77. }
  78. #$un = $_POST['username'];̈́
  79. /*if($_POST[Add]==1) {
  80. $user = (
  81.  
  82. #$newuser = $con2->query("INSERT INTO clients (Username, Password) VALUES ("+$_POST['username']+", '$pwd')");
  83. echo hallooo;
  84. #$newuser = $con2->query("INSERT INTO clients (username, password) VALUES ('teste', 'testseteste')");
  85. #$newuser = "INSERT INTO clients (username,password) VALUES ('test', 'blabla')";
  86. #<input type="submit" name="Delete" value="">mysqli_query($con2,$newuser);
  87. }*/
  88. #else ($_POST[Delete]==2) {
  89. # $deletequery = "DELETE FROM clients WHERE username=$_POST['username']";
  90. # mysqli_query($con2,$deletequery);
  91. #}
  92.  
  93. }
  94.  
  95. mysqli_close($con2);
  96. }
  97. else{
  98. echo "Loser, you do not have permission to enter this site ;-D";
  99. }
  100.  
  101. #Må ha noe som legger det inn i databasen, og som sletter det.
  102. ?>
  103.  
  104.  
  105. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement