mirror of
https://github.com/cydrobolt/polr.git
synced 2024-11-12 21:22:28 +01:00
get rid of root ucp stuff
This commit is contained in:
parent
fa414e7288
commit
f7d4feb53e
@ -1,25 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once 'req.php';
|
|
||||||
require_once 'polrauth.php';
|
|
||||||
$polrauth = new polrauth();
|
|
||||||
$baseval = $mysqli->real_escape_string($_POST['baseval']);
|
|
||||||
$userinfo = $polrauth->islogged();
|
|
||||||
if(!is_array($userinfo)) {
|
|
||||||
//not logged in
|
|
||||||
die('401 Unauthorized (not logged in)');
|
|
||||||
}
|
|
||||||
$role = $userinfo['role'];
|
|
||||||
$user = $mysqli->real_escape_string($userinfo['username']);
|
|
||||||
$date = $mysqli->real_escape_string(time());
|
|
||||||
|
|
||||||
if($role!='adm') {
|
|
||||||
die('401 Unauthorized (not admin)');
|
|
||||||
}
|
|
||||||
|
|
||||||
//if all works out
|
|
||||||
$orig = $mysqli->real_escape_string(sqlfetch('redirinfo', 'rurl', 'baseval', $baseval));
|
|
||||||
$query = "UPDATE redirinfo SET rurl='disabled', etc2='Disabled by {$user} on UNIXDATE {$date}', etc='{$orig}' WHERE baseval='{$baseval}';";
|
|
||||||
$result = $mysqli->query($query) or die('error');
|
|
||||||
|
|
||||||
echo 'success';
|
|
||||||
die(); //all works out :)
|
|
@ -1,30 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once 'req.php';
|
|
||||||
require_once 'polrauth.php';
|
|
||||||
$polrauth = new polrauth();
|
|
||||||
$baseval = $mysqli->real_escape_string($_POST['baseval']);
|
|
||||||
$userinfo = $polrauth->islogged();
|
|
||||||
if(!is_array($userinfo)) {
|
|
||||||
//not logged in
|
|
||||||
die('401 Unauthorized (not logged in)');
|
|
||||||
}
|
|
||||||
$role = $userinfo['role'];
|
|
||||||
$user = $mysqli->real_escape_string($userinfo['username']);
|
|
||||||
$date = $mysqli->real_escape_string(time());
|
|
||||||
|
|
||||||
if($role!='adm') {
|
|
||||||
die('401 Unauthorized (not admin)');
|
|
||||||
}
|
|
||||||
|
|
||||||
$curr = $mysqli->real_escape_string(sqlfetch('redirinfo', 'rurl', 'baseval', $baseval));
|
|
||||||
if($curr!='disabled') {
|
|
||||||
die('already enabled, error');
|
|
||||||
}
|
|
||||||
//if all works out
|
|
||||||
$orig['url'] = $mysqli->real_escape_string(sqlfetch('redirinfo', 'etc', 'baseval', $baseval));
|
|
||||||
|
|
||||||
$query = "UPDATE redirinfo SET rurl='{$orig['url']}', etc2='Reenabled by {$user} on UNIXDATE {$date}', etc='' WHERE baseval='{$baseval}';";
|
|
||||||
$result = $mysqli->query($query) or die('error');
|
|
||||||
|
|
||||||
echo 'success';
|
|
||||||
die(); //all works out :)
|
|
132
ucp.php
132
ucp.php
@ -1,132 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once 'req.php';
|
|
||||||
require_once 'headerpage.php';
|
|
||||||
require_once 'polrauth.php';
|
|
||||||
$auth = new polrauth();
|
|
||||||
$isadmin = $auth->isadminli();
|
|
||||||
if (!is_array($auth->islogged())) {
|
|
||||||
echo "<h3>You must login to access this page.</h3><br><a href='index.php'>Home</a>";
|
|
||||||
require_once 'footer.php';
|
|
||||||
die(); //END NOT LOGGED IN PORTION
|
|
||||||
} else {
|
|
||||||
$userinfo = $auth->islogged();
|
|
||||||
function fetchurls($lstart = 0) {
|
|
||||||
global $userinfo;
|
|
||||||
global $mysqli;
|
|
||||||
$sqr = "SELECT `baseval`,`rurl`,`date` FROM `redirinfo` WHERE user = '{$mysqli->real_escape_string($userinfo['username'])}' LIMIT {$lstart} , 50;";
|
|
||||||
$res = $mysqli->query($sqr);
|
|
||||||
$links = mysqli_fetch_all($res, MYSQLI_ASSOC);
|
|
||||||
|
|
||||||
$linkshtml = '<table class="table table-hover"><tr><th>Link ending</th><th>Long Link</th><th>Date (EST - NA)</th><th>PW-Protected</th></tr>';
|
|
||||||
foreach ($links as $link) {
|
|
||||||
$linkshtml = $linkshtml . "<tr><td>" . $link['baseval'] . '</td>'
|
|
||||||
. "<td>" . substr($link['rurl'], 0, 170) . '</td>'
|
|
||||||
. "<td>" . $link['date'] . '</td>'
|
|
||||||
. "<td>" . 'N/A' . '</td></tr>';
|
|
||||||
}
|
|
||||||
$linkshtml = $linkshtml . "</tr></table>";
|
|
||||||
return $linkshtml;
|
|
||||||
}
|
|
||||||
|
|
||||||
$linkshtml = fetchurls();
|
|
||||||
echo "<script src='ucptabs.js'></script>";
|
|
||||||
echo "<h3>Polr Dashboard</h3><br>";
|
|
||||||
echo '<ul class="nav nav-tabs" id="tabsb">
|
|
||||||
<li class="active"><a href="#home" data-toggle="tab">Home</a></li>
|
|
||||||
<li><a href="#links" data-toggle="tab">My links</a></li>
|
|
||||||
<li><a href="#messages" data-toggle="tab">Messages</a></li>
|
|
||||||
<li><a href="#settings" data-toggle="tab">Settings</a></li>';
|
|
||||||
if ($isadmin == true) {
|
|
||||||
echo '<li><a href="#adminpanel" data-toggle="tab">Admin Panel</a></li>';
|
|
||||||
|
|
||||||
function fetchurlsadmin($lstart = 0, $limit = 360) {
|
|
||||||
global $mysqli;
|
|
||||||
$sqr = "SELECT `baseval`,`rurl`,`date`,`user`,`ip` FROM `redirinfo` LIMIT {$lstart} , {$limit};";
|
|
||||||
$res = $mysqli->query($sqr);
|
|
||||||
$links = mysqli_fetch_all($res, MYSQLI_ASSOC);
|
|
||||||
$linkshtml = '<table class="table table-hover"><tr><th>Link ending</th><th>Long Link</th><th>Date (EST - NA)</th><th>Link Owner</th><th>IP</th><th>PW-Protected</th><th>Disable/Enable</th></tr>';
|
|
||||||
foreach ($links as $link) {
|
|
||||||
$linkshtml = $linkshtml . "<tr><td>" . $link['baseval'] . '</td>'
|
|
||||||
. "<td>" . substr($link['rurl'], 0, 170) . '</td>'
|
|
||||||
. "<td>" . $link['date'] . '</td>'
|
|
||||||
. "<td>" . $link['user'] . '</td>'
|
|
||||||
. "<td>" . $link['ip'] . '</td>'
|
|
||||||
. "<td>" . 'N/A' . '</td>';
|
|
||||||
if ($link['rurl'] == 'disabled') {
|
|
||||||
$linkshtml = $linkshtml . '<td><span class=' . $link['baseval'] . '><input type="button" value="Enable" onClick="doenable(\'' . $link['baseval'] . '\');" class="btn btn-sm btn-success enablelink" id="' . $link['baseval'] . '" />' . '</span></td></tr>';
|
|
||||||
} else {
|
|
||||||
$linkshtml = $linkshtml . "<td>" . '<span class=' . $link['baseval'] . '><input type="button" value="Disable" onClick="dodisable(\'' . $link['baseval'] . '\');" class="btn btn-sm btn-danger disablelink" id="' . $link['baseval'] . '" />' . '</span></td></tr>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$linkshtml = $linkshtml . "</tr></table>";
|
|
||||||
return $linkshtml;
|
|
||||||
}
|
|
||||||
|
|
||||||
function fetchusersadmin($lstart = 0) {
|
|
||||||
global $mysqli;
|
|
||||||
$sqr = "SELECT `username`,`email`,`valid` FROM `auth` LIMIT {$lstart} , 360;";
|
|
||||||
$res = $mysqli->query($sqr);
|
|
||||||
$links = mysqli_fetch_all($res, MYSQLI_ASSOC);
|
|
||||||
$usershtml = '<table class="table table-hover"><tr><th>Username</th><th>Email</th><th>Activated?</th></tr>';
|
|
||||||
foreach ($links as $link) {
|
|
||||||
$usershtml = $usershtml . "<tr><td>" . $link['username'] . '</td>';
|
|
||||||
$usershtml = $usershtml . "<td>" . $link['email'] . '</td>';
|
|
||||||
$usershtml = $usershtml . "<td>" . $link['valid'] . '</td></tr>';
|
|
||||||
}
|
|
||||||
$usershtml = $usershtml . "</tr></table>";
|
|
||||||
return $usershtml;
|
|
||||||
}
|
|
||||||
|
|
||||||
$usersadmin = fetchusersadmin();
|
|
||||||
$linksadmin = fetchurlsadmin();
|
|
||||||
}
|
|
||||||
if (!$isadmin) {
|
|
||||||
// Shown to users
|
|
||||||
$status = file_get_contents('https://raw.githubusercontent.com/Cydrobolt/polr/notices/unotices'); // fetch notices from Github
|
|
||||||
if (strlen($status)<4) {
|
|
||||||
$msges = '<div class="tab-pane" id="messages"><br><b>There are <span style="color:green">no new messages</span>.</b></div>';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$msges = '<div class="tab-pane" id="messages"><br>'.$status.'</div>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ($isadmin == true) {
|
|
||||||
$status = file_get_contents('https://raw.githubusercontent.com/Cydrobolt/polr/notices/anotices'); // fetch notices from Github
|
|
||||||
if (strlen($status)<4) {
|
|
||||||
$msges = '<div class="tab-pane" id="messages"><br><b>There are <span style="color:green">no new messages</span>.</b></div>';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$msges = '<div class="tab-pane" id="messages"><br>'.$status.'</div>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
echo '</ul>';
|
|
||||||
echo '<div class="tab-content">
|
|
||||||
<div class="tab-pane active" id="home"><br><h2>Welcome to '.$wsn.' user dashboard. Powered by <a href="//github.com/cydrobolt/polr">Polr</a>; Made with <3, <code>$ bash</code>, and lots of <code>git push</code>es</div>
|
|
||||||
<div class="tab-pane" id="links"><br>' . $linkshtml . '</div>
|
|
||||||
|
|
||||||
'.$msges.'
|
|
||||||
<div class="tab-pane" id="settings"><br><b>Settings:</b><br><br><form action="ucp-settings.php" method="POST">
|
|
||||||
Current Password: <input type="password" name="cpw" /><br>New Password: <input type="password" name="npw" />
|
|
||||||
<br><br>Theme: <select name="theme"><option value="cosmo">Aurora (Default)</option><option value="flatly">Light Slopes</option>
|
|
||||||
<option value="yeti">Metro Shift</option><option value="darkly">Dark Slopes</option></select><br><input type="hidden" value="setchg" name="setchg" />
|
|
||||||
<br><br><input type="submit" class="btn-success btn-lg" disabled="disabled"/>
|
|
||||||
</form></div>';
|
|
||||||
if ($isadmin == true) {
|
|
||||||
$sessiondump = "";
|
|
||||||
foreach ($_SESSION as $sevar) {
|
|
||||||
$sessiondump = $sessiondump . '<br>' . $sevar;
|
|
||||||
}
|
|
||||||
echo '<div class="tab-pane" id="adminpanel"><br>Polr Links - Limited @ 360:' . $linksadmin . '<br>Polr Users - Limited @ 360:' . $usersadmin. '<script src="ucpjs.js"></script>';
|
|
||||||
if ($debug==1) {
|
|
||||||
'<br>Debug Variables: <br>Default IP Fetch: ' . $ip . '<br>X-Forwarded-For:' . @$headers['X-Forwarded-For'] . '<br>Forwarded-For' . @$headers['forwarded-for'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
echo '</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
//require_once 'footerpage.php';
|
|
56
ucpjs.js
56
ucpjs.js
@ -1,56 +0,0 @@
|
|||||||
function dodisable(baseval) {
|
|
||||||
//var baseval = $(this).attr('id');
|
|
||||||
var basevalr = baseval;
|
|
||||||
console.log('Baseval: '+basevalr);
|
|
||||||
console.log(this);
|
|
||||||
var request = $.ajax({
|
|
||||||
url: "ucp-disablelink.php",
|
|
||||||
type: "POST",
|
|
||||||
data: {baseval: basevalr},
|
|
||||||
dataType: "html"
|
|
||||||
});
|
|
||||||
$("."+baseval).html('<span><i class="fa fa-spinner"></i></span>');
|
|
||||||
request.done(function(msg) {
|
|
||||||
if(msg=='success') {
|
|
||||||
$("."+baseval).html(' <span style="color:green"><i class="fa fa-check"></i>Disabled</span>');
|
|
||||||
}
|
|
||||||
else if(msg=='error') {
|
|
||||||
$("."+baseval).html(' <span style="color:orange"><i class="fa fa-ban"></i>Error, try again (reload page).</span>');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$("."+baseval).html(' <span style="color:red"><i class="fa fa-ban"></i>Error. Perhaps you were logged out or do not<br /> have sufficient permissions.</span>');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
request.fail(function(jqXHR, textStatus) {
|
|
||||||
$('#status').html(' <span style="color:red"><i class="fa fa-exclamation-circle"></i> An error occured. Try again</span>' + textstatus);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function doenable(baseval) {
|
|
||||||
//var baseval = $(this).attr('id');
|
|
||||||
var basevalr = baseval;
|
|
||||||
console.log('Baseval: '+basevalr);
|
|
||||||
console.log(this);
|
|
||||||
var request = $.ajax({
|
|
||||||
url: "ucp-enablelink.php",
|
|
||||||
type: "POST",
|
|
||||||
data: {baseval: basevalr},
|
|
||||||
dataType: "html"
|
|
||||||
});
|
|
||||||
$("."+baseval).html('<span><i class="fa fa-spinner"></i></span>');
|
|
||||||
request.done(function(msg) {
|
|
||||||
if(msg=='success') {
|
|
||||||
$("."+baseval).html(' <span style="color:green"><i class="fa fa-check"></i>Enabled</span>');
|
|
||||||
}
|
|
||||||
else if(msg=='error') {
|
|
||||||
$("."+baseval).html(' <span style="color:orange"><i class="fa fa-ban"></i>Error, try again (reload page).</span>');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$("."+baseval).html(' <span style="color:red"><i class="fa fa-ban"></i>Error. Perhaps you were logged out or do not<br /> have sufficient permissions.</span>');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
request.fail(function(jqXHR, textStatus) {
|
|
||||||
$('#status').html(' <span style="color:red"><i class="fa fa-exclamation-circle"></i> An error occured. Try again</span>' + textstatus);
|
|
||||||
});
|
|
||||||
}
|
|
10
ucptabs.js
10
ucptabs.js
@ -1,10 +0,0 @@
|
|||||||
/*
|
|
||||||
$('#tabsb a[href="#home"]').tab('show');
|
|
||||||
$('#tabsb a[href="#links"]').tab('show');
|
|
||||||
$('#tabsb a[href="#messages"]').tab('show');
|
|
||||||
$('#tabsb a[href="#settings"]').tab('show');
|
|
||||||
$('#tabsb a[href="#adminpanel"]').tab('show');
|
|
||||||
*/
|
|
||||||
$(document).ready(function() {
|
|
||||||
$('#tabsb').tab();
|
|
||||||
});
|
|
Loading…
Reference in New Issue
Block a user