Skip to content
This repository was archived by the owner on Sep 23, 2022. It is now read-only.

Commit a373726

Browse files
author
nerdofcode
committed
Added logout and new things
1 parent b5af410 commit a373726

3 files changed

Lines changed: 50 additions & 14 deletions

File tree

index.php

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,36 @@
22
<!Doctype html>
33
<?php
44
session_start();
5+
if($_SESSION['status']=="1"){
6+
header("Location: /options.php");
7+
$_SESSION['logged_in']="1";
8+
}
9+
10+
11+
512
?>
613
<html>
714
<head>
815
<title>Custom Admin Panel</title>
916
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
1017
</head>
1118
<body>
12-
<h1>Custom Admin Panel</h1><hr>
13-
<form name="form" action="" method="post" >
19+
<h1 style="text-align:center;">Admin Panel</h1><hr>
20+
<form name="form" id="form" action="" method="post" >
1421
Username:&ensp;<input type="text" name="UID" id="UID" required><br>
1522
Password:&ensp; <input type="password" name="passwd" id="passwd" required><br>
16-
<input type="submit" value="Submit">
23+
<input type="submit" value="Submit" onClick="">
1724
</form>
1825

19-
26+
<script>
27+
$(document).ready(function(){
28+
$('#form').submit(function(){
29+
$('#UID').fadeOut();
30+
$('#passwd').fadeOut();
31+
})
32+
33+
});
34+
</script>
2035

2136
</body>
2237

logout.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
session_start();
3+
if($_SESSION['status']=="1"){
4+
echo "You have been logged out<br>";
5+
echo "<br>!!!NOTICE!!!<br><br>Your saved inputs have been destroyed<br>";
6+
//DESTROY SESSION STUFF
7+
session_unset();
8+
session_destroy();
9+
}
10+
?>
11+
<script>
12+
alert("You have been logged out...");
13+
window.location = "index.php";
14+
15+
</script>

options.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,32 @@
33
session_start();
44
$status = $_SESSION['status'];
55
if($status == "1"){
6-
}else if($status != "1"){
6+
if($_SESSION['logged_in']=="1"){
7+
echo "<p style=\"color:red;\"><b>You are already logged in!!!</b></p>";
8+
$_SESSION['logged_in']="0";
9+
}}else if($status != "1"){
710
header("Location: /404.php");}
8-
911
?>
1012
<html>
1113
<head>
1214
<title>Admin Panel</title>
1315
</head>
1416
<body>
17+
<h1 style="text-align: center;">Admin Panel</h1>
18+
<a href="logout.php">Logout</a><hr>
1519
<p>Below is version v.000001 of admin panel by NerdOfCode</p>
1620
<p>You can execute shell commands seperately from Mysql commands</p>
1721
<form action="" name="query" id="query" method="post">
1822
SHELL: &nbsp;&nbsp;&ensp;&nbsp;&nbsp;<input type="text" id="query_box" name="query_box" placeholder="Ex: whoami"></input><br><br>
19-
DBNAM: &nbsp;&nbsp;&nbsp;<input type="text" id="mysql_get" name="mysql_get" placeholder="ex: custom"></input><br><br>
20-
HOST : &ensp;&ensp;&ensp;<input type="text" id="host" name="host" placeholder="localhost"></input><br><br>
21-
USER : &nbsp;&ensp;&ensp;&nbsp;<input type="text" id="user" name="user"></input><br><br>
22-
PASS : &ensp;&nbsp;&ensp;&ensp;<input type="password" id="pass" name="pass"></input></br><br>
23-
QUERY: &ensp;&nbsp;&nbsp;<input type="text" id="myquery" name="myquery" placeholder="SELECT * FROM test;"></input><br><br>
23+
DBNAM: &nbsp;&nbsp;&nbsp;<input type="text" id="mysql_get" name="mysql_get" placeholder="ex: custom" value="<?php echo $_SESSION[udb];?>"></input><br><br>
24+
HOST : &ensp;&ensp;&ensp;<input type="text" id="host" name="host" placeholder="localhost" value="<?php echo $_SESSION['host'];?>"></input><br><br>
25+
USER : &nbsp;&ensp;&ensp;&nbsp;<input type="text" id="user" name="user" value="<?php echo $_SESSION['mysql_user'];?>"></input><br><br>
26+
PASS : &ensp;&nbsp;&ensp;&ensp;<input type="password" id="pass" name="pass" value="<?php echo $_SESSION['mysql_pass'];?>"></input></br><br>
27+
QUERY: &ensp;&nbsp;&nbsp;<input type="text" id="myquery" name="myquery" placeholder="SELECT * FROM test;" value="<?php echo $_SESSION['query'];?>"></input><br><br>
2428
<button type="Submit" value="Submit">Submit</button>
29+
2530
</form>
31+
2632
</body>
2733

2834
<?php
@@ -31,11 +37,11 @@
3137
$pass=$_POST['pass'];
3238
$query=$_POST['myquery'];//Commands
3339
$host=$_POST['host'];
40+
//Set all current values as session variables below
41+
$_SESSION['saved_info']="1";$_SESSION['udb']="$udb";$_SESSION['mysql_user']="$user";$_SESSION['mysql_pass']="$pass";$_SESSION['query']="$query";$_SESSION['host']="$host";
3442

3543

36-
37-
38-
$db = mysqli_connect($host,$user,$pass,$udb) or die("Error connection to MySQL failed");
44+
$db = mysqli_connect($host,$user,$pass,$udb) or die("<p style=\"color:red;\"><b>Error: </b> connection to MySQL failed. Please re-enter information and try again.</p>");
3945
mysqli_query($db, $query) or die("Unable to access MYSQL");
4046
$result = mysqli_query($db, $query);
4147
$row = mysqli_fetch_array($result);

0 commit comments

Comments
 (0)