Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <?php
- /*echo $_SERVER['SSL_CLIENT_S_DN_CN'];
- echo $_SERVER['SSL_PROTOCOL'];
- echo "hallo";
- echo $_SERVER['PHP_SELF'];*/
- 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") {
- echo "Hi! You are (hopefully) Veronica, Marte, Ida Malene or a member of the staff. Good for you";
- ?>
- <h1>Welcome!</h1>
- <h2> Add user </h2>
- <form name="input" action="signup.php" method="post">
- <input type="hidden" name="Add" value="1">
- <p>
- Username <input type="text" name="username" value="">
- </p>
- <p>
- Password <input type="password" name="password" value="">
- </p>
- <p>
- <input type="submit" name="AddUser">
- </p>
- </form>
- <h2> Delete user </h2>
- <form name="input" type="2" action="signup.php" method="post">
- <input type="hidden" name="Delete" value="2">
- <p>
- Username <input type="text" name="username" value="">
- </p>
- <p>
- <input type="submit" name="DeleteUser" >
- </p>
- </form>
- <?
- echo "<table border='1'>
- <tr>
- <th>Username</th>
- </tr>";
- $con1 = new mysqli("localhost","gr13","gr13ttm4135", "dbgr13");
- $result = mysqli_query($con1,"SELECT username FROM clients");
- while($row = mysqli_fetch_row($result)) {
- echo "<tr>";
- echo "<td>" . $row['Username'] . "</td>";
- echo "</tr>";
- }
- echo "</table>";
- mysqli_close($con1);
- ?>
- <?
- $con2 = new mysqli("localhost","gr13","gr13ttm4135", "dbgr13");
- if (!$con2) {
- die('Could not connect: ' . mysqli_error());
- }
- else {
- if ($_SERVER['REQUEST_METHOD'] == "POST" && !empty($_POST['username']) && !empty($_POST['password'])) {
- $username = $_POST['username'];
- #$password = $_POST['password'];
- $pwd = sha1($_POST['password']);̈́
- $newuser = $con2->query("INSERT INTO clients (username, password) VALUES ('$username', '$pwd')");
- #$checkuser = is_user_available($connection , $username);
- #if($checkuser>0){
- # add_user($connection, $username, $password);
- #}else{
- # echo "I'm sorry but the username you specified has already been taken. Please pick another one.";
- #}
- }
- #$un = $_POST['username'];̈́
- /*if($_POST[Add]==1) {
- $user = (
- #$newuser = $con2->query("INSERT INTO clients (Username, Password) VALUES ("+$_POST['username']+", '$pwd')");
- echo hallooo;
- #$newuser = $con2->query("INSERT INTO clients (username, password) VALUES ('teste', 'testseteste')");
- #$newuser = "INSERT INTO clients (username,password) VALUES ('test', 'blabla')";
- #<input type="submit" name="Delete" value="">mysqli_query($con2,$newuser);
- }*/
- #else ($_POST[Delete]==2) {
- # $deletequery = "DELETE FROM clients WHERE username=$_POST['username']";
- # mysqli_query($con2,$deletequery);
- #}
- }
- mysqli_close($con2);
- }
- else{
- echo "Loser, you do not have permission to enter this site ;-D";
- }
- #Må ha noe som legger det inn i databasen, og som sletter det.
- ?>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement