mirror of
https://github.com/Neetpone/ponepaste.git
synced 2025-03-12 06:30:07 +01:00
Merge branch 'main' of https://github.com/aftercase/punishedponepaste into main
This commit is contained in:
commit
943c392508
36 changed files with 530 additions and 47853 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
tmp/temp.tdata
|
||||
sitemap.xml
|
||||
|
|
@ -15,71 +15,12 @@
|
|||
|
||||
// PHP <5.5 compatibility
|
||||
require_once('../includes/password.php');
|
||||
define('IN_ADMIN', 1);
|
||||
require_once('common.php');
|
||||
|
||||
session_start();
|
||||
$query = $conn->query('SELECT user FROM admin LIMIT 1');
|
||||
$adminid = $query->fetch()['user'];
|
||||
|
||||
if (isset($_SESSION['login'])) {
|
||||
// Do nothing
|
||||
} else {
|
||||
header("Location: .");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (isset($_GET['logout'])) {
|
||||
if (isset($_SESSION['login']))
|
||||
unset($_SESSION['login']);
|
||||
|
||||
session_destroy();
|
||||
header("Location: .");
|
||||
exit();
|
||||
}
|
||||
|
||||
$date = date('jS F Y');
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
require_once('../config.php');
|
||||
$con = mysqli_connect($dbhost, $dbuser, $dbpassword, $dbname);
|
||||
|
||||
if (mysqli_connect_errno()) {
|
||||
$sql_error = mysqli_connect_error();
|
||||
die("Unable connect to database");
|
||||
}
|
||||
|
||||
$query = "SELECT @last_id := MAX(id) FROM admin_history";
|
||||
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$last_id = $row['@last_id := MAX(id)'];
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM admin_history WHERE id=" . Trim($last_id);
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$last_date = $row['last_date'];
|
||||
$last_ip = $row['ip'];
|
||||
}
|
||||
|
||||
if ($last_ip == $ip) {
|
||||
if ($last_date == $date) {
|
||||
|
||||
} else {
|
||||
$query = "INSERT INTO admin_history (last_date,ip) VALUES ('$date','$ip')";
|
||||
mysqli_query($con, $query);
|
||||
}
|
||||
} else {
|
||||
$query = "INSERT INTO admin_history (last_date,ip) VALUES ('$date','$ip')";
|
||||
mysqli_query($con, $query);
|
||||
}
|
||||
|
||||
|
||||
$query = "SELECT * FROM admin";
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$adminid = Trim($row['user']);
|
||||
$password = Trim($row['pass']);
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
@ -183,24 +124,21 @@ while ($row = mysqli_fetch_array($result)) {
|
|||
<th>IP</th>
|
||||
</tr>
|
||||
<?php
|
||||
$rec_limit = 10;
|
||||
$query = "SELECT count(id) FROM admin_history";
|
||||
$retval = mysqli_query($con, $query);
|
||||
$rec_limit = 10;
|
||||
|
||||
$row = mysqli_fetch_array($retval);
|
||||
$rec_count = Trim($row[0]);
|
||||
$query = $conn->query('SELECT COUNT(*) FROM admin_history');
|
||||
$row = $query->fetch(PDO::FETCH_NUM);
|
||||
$rec_count = $row[0];
|
||||
|
||||
$sql = "SELECT * FROM admin_history ORDER BY `id` DESC LIMIT $rec_limit";
|
||||
$result = mysqli_query($con, $sql);
|
||||
$query = $conn->prepare('SELECT ip, last_date FROM admin_history ORDER BY `id` LIMIT ?');
|
||||
$query->execute([$rec_limit]);
|
||||
|
||||
// Loop through each record
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
// Populate and display result data in each row
|
||||
while ($row = $query->fetch()) {
|
||||
echo '<tr>';
|
||||
echo '<td>' . $row['last_date'] . '</td>';
|
||||
echo '<td>' . $row['ip'] . '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</tr>';
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
102
admin/ads.php
102
admin/ads.php
|
@ -13,69 +13,32 @@
|
|||
* GNU General Public License in GPL.txt for more details.
|
||||
*/
|
||||
|
||||
session_start();
|
||||
define('IN_ADMIN', 1);
|
||||
require_once('common.php');
|
||||
|
||||
if (isset($_SESSION['login'])) {
|
||||
// Do nothing
|
||||
updateAdminHistory($conn);
|
||||
|
||||
$row = $conn->query('SELECT text_ads, ads_1, ads_2 FROM ads LIMIT 1')->fetch();
|
||||
|
||||
if ($row) {
|
||||
$text_ads = trim($row['text_ads']);
|
||||
$ads_1 = trim($row['ads_1']);
|
||||
$ads_2 = trim($row['ads_2']);
|
||||
} else {
|
||||
header("Location: .");
|
||||
exit();
|
||||
$text_ads = '';
|
||||
$ads_1 = '';
|
||||
$ads_2 = '';
|
||||
}
|
||||
|
||||
if (isset($_GET['logout'])) {
|
||||
if (isset($_SESSION['login']))
|
||||
unset($_SESSION['login']);
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$text_ads = trim($_POST['text_ads']);
|
||||
$ads_1 = trim($_POST['ads_1']);
|
||||
$ads_2 = trim($_POST['ads_2']);
|
||||
|
||||
session_destroy();
|
||||
header("Location: .");
|
||||
exit();
|
||||
}
|
||||
|
||||
$date = date('jS F Y');
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
require_once('../config.php');
|
||||
$con = mysqli_connect($dbhost, $dbuser, $dbpassword, $dbname);
|
||||
|
||||
if (mysqli_connect_errno()) {
|
||||
$sql_error = mysqli_connect_error();
|
||||
die("Unable connect to database");
|
||||
}
|
||||
|
||||
$query = "SELECT @last_id := MAX(id) FROM admin_history";
|
||||
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$last_id = $row['@last_id := MAX(id)'];
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM admin_history WHERE id=" . Trim($last_id);
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$last_date = $row['last_date'];
|
||||
$last_ip = $row['ip'];
|
||||
}
|
||||
|
||||
if ($last_ip == $ip) {
|
||||
if ($last_date == $date) {
|
||||
|
||||
} else {
|
||||
$query = "INSERT INTO admin_history (last_date,ip) VALUES ('$date','$ip')";
|
||||
mysqli_query($con, $query);
|
||||
}
|
||||
} else {
|
||||
$query = "INSERT INTO admin_history (last_date,ip) VALUES ('$date','$ip')";
|
||||
mysqli_query($con, $query);
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM ads WHERE id='1'";
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$text_ads = Trim($row['text_ads']);
|
||||
$ads_1 = Trim($row['ads_1']);
|
||||
$ads_2 = Trim($row['ads_2']);
|
||||
$conn->prepare('UPDATE ads SET text_ads = ?, ads_1 = ?, ads_2 = ? WHERE id = 1')->execute([$text_ads, $ads_1, $ads_2]);
|
||||
$msg = '<div class="paste-alert alert3">
|
||||
Ads saved
|
||||
</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
|
@ -117,29 +80,6 @@ while ($row = mysqli_fetch_array($result)) {
|
|||
<!-- Start Menu -->
|
||||
<?php include 'menu.php';?>
|
||||
<!-- End Menu -->
|
||||
|
||||
<?php
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$ads_1 = Trim($_POST['ads_1']);
|
||||
$ads_2 = Trim($_POST['ads_2']);
|
||||
$text_ads = Trim($_POST['text_ads']);
|
||||
|
||||
$query = "UPDATE ads SET text_ads='$text_ads', ads_1='$ads_1', ads_2='$ads_2' WHERE id='1'";
|
||||
mysqli_query($con, $query);
|
||||
|
||||
if (mysqli_errno($con)) {
|
||||
$msg = '<div class="paste-alert alert6">
|
||||
' . mysqli_error($con) . '
|
||||
</div>';
|
||||
|
||||
} else {
|
||||
$msg = '<div class="paste-alert alert3">
|
||||
Ads saved
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Start Ads -->
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
|
49
admin/common.php
Normal file
49
admin/common.php
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
if (!defined('IN_ADMIN')) {
|
||||
die();
|
||||
}
|
||||
|
||||
require_once('../config.php');
|
||||
|
||||
function updateAdminHistory($conn) {
|
||||
$last_date = null;
|
||||
$last_ip = null;
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
$date = date('jS F Y');
|
||||
|
||||
$query = $conn->query('SELECT ip, last_date FROM admin_history ORDER BY ID DESC LIMIT 1');
|
||||
|
||||
if ($row = $query->fetch()) {
|
||||
$last_date = $row['last_date'];
|
||||
$last_ip = $row['ip'];
|
||||
}
|
||||
|
||||
if ($last_ip !== $ip || $last_date !== $date) {
|
||||
$conn->prepare('INSERT INTO admin_history (ip, last_date) VALUES (?, ?)')->execute([$date, $ip]);
|
||||
}
|
||||
}
|
||||
|
||||
session_start();
|
||||
|
||||
if (!isset($_SESSION['login'])) {
|
||||
header('Location: .');
|
||||
exit();
|
||||
}
|
||||
|
||||
if (isset($_GET['logout'])) {
|
||||
if (isset($_SESSION['login']))
|
||||
unset($_SESSION['login']);
|
||||
|
||||
session_destroy();
|
||||
header("Location: .");
|
||||
exit();
|
||||
}
|
||||
|
||||
$conn = new PDO(
|
||||
"mysql:host=$db_host;dbname=$db_schema;charset=utf8",
|
||||
$db_user,
|
||||
$db_pass,
|
||||
$db_opts
|
||||
);
|
||||
|
||||
|
|
@ -12,67 +12,14 @@
|
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License in GPL.txt for more details.
|
||||
*/
|
||||
session_start();
|
||||
define('IN_ADMIN', 1);
|
||||
require_once('common.php');
|
||||
|
||||
if (isset($_SESSION['login'])) {
|
||||
// Do nothing
|
||||
} else {
|
||||
header("Location: .");
|
||||
exit();
|
||||
}
|
||||
updateAdminHistory($conn);
|
||||
|
||||
if (isset($_GET['logout'])) {
|
||||
if (isset($_SESSION['login']))
|
||||
unset($_SESSION['login']);
|
||||
$query = $conn->query('SELECT * FROM site_info');
|
||||
|
||||
session_destroy();
|
||||
header("Location: .");
|
||||
exit();
|
||||
}
|
||||
|
||||
$date = date('jS F Y');
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
require_once('../config.php');
|
||||
$con = mysqli_connect($dbhost, $dbuser, $dbpassword, $dbname);
|
||||
|
||||
if (mysqli_connect_errno()) {
|
||||
$sql_error = mysqli_connect_error();
|
||||
die("Unable connect to database");
|
||||
}
|
||||
|
||||
$query = "SELECT @last_id := MAX(id) FROM admin_history";
|
||||
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$last_id = $row['@last_id := MAX(id)'];
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM admin_history WHERE id=" . Trim($last_id);
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$last_date = $row['last_date'];
|
||||
$last_ip = $row['ip'];
|
||||
}
|
||||
|
||||
if ($last_ip == $ip) {
|
||||
if ($last_date == $date) {
|
||||
|
||||
} else {
|
||||
$query = "INSERT INTO admin_history (last_date,ip) VALUES ('$date','$ip')";
|
||||
mysqli_query($con, $query);
|
||||
}
|
||||
} else {
|
||||
$query = "INSERT INTO admin_history (last_date,ip) VALUES ('$date','$ip')";
|
||||
mysqli_query($con, $query);
|
||||
}
|
||||
|
||||
|
||||
$query = "SELECT * FROM site_info";
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
if ($row = $query->fetch()) {
|
||||
$title = Trim($row['title']);
|
||||
$des = Trim($row['des']);
|
||||
$baseurl = Trim($row['baseurl']);
|
||||
|
@ -85,10 +32,11 @@ while ($row = mysqli_fetch_array($result)) {
|
|||
$ga = Trim($row['ga']);
|
||||
$additional_scripts = Trim($row['additional_scripts']);
|
||||
}
|
||||
$query = "SELECT * FROM captcha WHERE id='1'";
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$query = "SELECT * FROM captcha WHERE id = '1'";
|
||||
$result = $conn->query('SELECT * FROM captcha WHERE id = 1');
|
||||
|
||||
if ($row = $result->fetch()) {
|
||||
$cap_e = $row['cap_e'];
|
||||
$mode = $row['mode'];
|
||||
$mul = $row['mul'];
|
||||
|
@ -98,18 +46,16 @@ while ($row = mysqli_fetch_array($result)) {
|
|||
$recaptcha_secretkey = $row['recaptcha_secretkey'];
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM site_permissions WHERE id='1'";
|
||||
$result = mysqli_query($con, $query);
|
||||
$result = $conn->query("SELECT * FROM site_permissions WHERE id='1'");
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
if ($row = $result->fetch()) {
|
||||
$disableguest = Trim($row['disableguest']);
|
||||
$siteprivate = Trim($row['siteprivate']);
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM mail WHERE id='1'";
|
||||
$result = mysqli_query($con, $query);
|
||||
$result = $conn->query("SELECT * FROM mail WHERE id='1'");
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
if ($row = $result->fetch()) {
|
||||
$verification = Trim($row['verification']);
|
||||
$smtp_host = Trim($row['smtp_host']);
|
||||
$smtp_username = Trim($row['smtp_username']);
|
||||
|
@ -119,6 +65,85 @@ while ($row = mysqli_fetch_array($result)) {
|
|||
$auth = Trim($row['auth']);
|
||||
$socket = Trim($row['socket']);
|
||||
}
|
||||
|
||||
/* Update the configuration if necessary */
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if (isset($_POST['manage'])) {
|
||||
$query = $conn->prepare(
|
||||
'UPDATE site_info SET title = ?, des = ?, baseurl = ?, keyword = ?, site_name = ?, email = ?, twit = ?, face = ?, gplus = ?, ga = ?, additional_scripts = ? WHERE id = 1'
|
||||
);
|
||||
$query->execute([
|
||||
trim($_POST['title']),
|
||||
trim($_POST['des']),
|
||||
trim($_POST['baseurl']),
|
||||
trim($_POST['keyword']),
|
||||
trim($_POST['site_name']),
|
||||
trim($_POST['email']),
|
||||
trim($_POST['twit']),
|
||||
trim($_POST['face']),
|
||||
trim($_POST['gplus']),
|
||||
trim($_POST['ga']),
|
||||
trim($_POST['additional_scripts'])
|
||||
]);
|
||||
|
||||
$msg = '<div class="paste-alert alert3" style="text-align: center;">
|
||||
Configuration saved
|
||||
</div>';
|
||||
}
|
||||
|
||||
if (isset($_POST['cap'])) {
|
||||
$query = $conn->prepare(
|
||||
'UPDATE captcha SET cap_e = ?, mode = ?, mul = ?, allowed = ?, color = ?, recaptcha_sitekey = ?, recaptcha_secretkey = ? WHERE id = 1'
|
||||
);
|
||||
$query->execute([
|
||||
trim($_POST['cap_e']),
|
||||
trim($_POST['mode']),
|
||||
trim($_POST['mul']),
|
||||
trim($_POST['allowed']),
|
||||
trim($_POST['color']),
|
||||
trim($_POST['recaptcha_sitekey']),
|
||||
trim($_POST['recaptcha_secretkey'])
|
||||
]);
|
||||
$msg = '<div class="paste-alert alert3" style="text-align: center;">
|
||||
Captcha settings saved
|
||||
</div>';
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['permissions'])) {
|
||||
$query = $conn->prepare('UPDATE site_permissions SET disableguest = ?, siteprivate = ? WHERE id = 1');
|
||||
$query->execute([
|
||||
trim($_POST['disableguest']),
|
||||
trim($_POST['siteprivate'])
|
||||
]);
|
||||
|
||||
$msg = '<div class="paste-alert alert3" style="text-align: center;">
|
||||
Site permissions saved.
|
||||
</div>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['smtp_code'])) {
|
||||
$query = $conn->prepare(
|
||||
'UPDATE mail SET verification = ?, smtp_host = ?, smtp_port = ?, smtp_username = ?, smtp_password = ?, socket = ?, protocol = ?, auth = ? WHERE id = 1'
|
||||
);
|
||||
|
||||
$query->execute([
|
||||
trim($_POST['verification']),
|
||||
trim($_POST['smtp_host']),
|
||||
trim($_POST['smtp_port']),
|
||||
trim($_POST['smtp_user']),
|
||||
trim($_POST['socket']),
|
||||
trim($_POST['auth']),
|
||||
trim($_POST['protocol'])
|
||||
]);
|
||||
$msg = '
|
||||
<div class="paste-alert alert3" style="text-align: center;">
|
||||
Mail settings updated
|
||||
</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
@ -165,104 +190,7 @@ while ($row = mysqli_fetch_array($result)) {
|
|||
<div class="col-md-12">
|
||||
<div class="panel panel-widget">
|
||||
<div class="panel-body">
|
||||
<?php
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
if (isset($_POST['manage'])) {
|
||||
$site_name = mysqli_real_escape_string( $con, Trim($_POST['site_name']) );
|
||||
$title = mysqli_real_escape_string( $con, Trim($_POST['title']) );
|
||||
$baseurl = mysqli_real_escape_string( $con, Trim($_POST['baseurl']) );
|
||||
$des = mysqli_real_escape_string( $con, Trim($_POST['des']) );
|
||||
$keyword = htmlentities(Trim($_POST['keyword']));
|
||||
$email = mysqli_real_escape_string( $con, Trim($_POST['email']) );
|
||||
$twit = htmlentities(Trim($_POST['twit']));
|
||||
$face = htmlentities(Trim($_POST['face']));
|
||||
$gplus = htmlentities(Trim($_POST['gplus']));
|
||||
$ga = htmlentities(Trim($_POST['ga']));
|
||||
$additional_scripts = mysqli_real_escape_string( $con, $_POST['additional_scripts'] );
|
||||
|
||||
$query = "UPDATE site_info SET title='$title', des='$des', baseurl='$baseurl', keyword='$keyword', site_name='$site_name', email='$email', twit='$twit', face='$face', gplus='$gplus', ga='$ga', additional_scripts='$additional_scripts' WHERE id='1'";
|
||||
mysqli_query($con, $query);
|
||||
|
||||
if (mysqli_errno($con)) {
|
||||
$msg = '<div class="paste-alert alert6" style="text-align: center;">
|
||||
' . mysqli_error($con) . '
|
||||
</div>';
|
||||
} else {
|
||||
$msg = '<div class="paste-alert alert3" style="text-align: center;">
|
||||
Configuration saved
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
if (isset($_POST['cap'])) {
|
||||
$cap_e = Trim($_POST['cap_e']);
|
||||
$mode = Trim($_POST['mode']);
|
||||
$mul = Trim($_POST['mul']);
|
||||
$allowed = Trim($_POST['allowed']);
|
||||
$color = Trim($_POST['color']);
|
||||
$recaptcha_sitekey = Trim($_POST['recaptcha_sitekey']);
|
||||
$recaptcha_secretkey = Trim($_POST['recaptcha_secretkey']);
|
||||
|
||||
$query = "UPDATE captcha SET cap_e='$cap_e', mode='$mode', mul='$mul', allowed='$allowed', color='$color', recaptcha_sitekey='$recaptcha_sitekey', recaptcha_secretkey='$recaptcha_secretkey' WHERE id='1'";
|
||||
mysqli_query($con, $query);
|
||||
|
||||
if (mysqli_errno($con)) {
|
||||
$msg = '<div class="paste-alert alert6" style="text-align: center;">
|
||||
' . mysqli_error($con) . '
|
||||
</div>';
|
||||
} else {
|
||||
$msg = '<div class="paste-alert alert3" style="text-align: center;">
|
||||
Captcha settings saved
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['permissions'])) {
|
||||
$disableguest = Trim($_POST['disableguest']);
|
||||
$siteprivate = Trim($_POST['siteprivate']);
|
||||
|
||||
$query = "UPDATE site_permissions SET disableguest='$disableguest', siteprivate='$siteprivate' WHERE id='1'";
|
||||
mysqli_query($con, $query);
|
||||
|
||||
if (mysqli_errno($con)) {
|
||||
$msg = '<div class="paste-alert alert6" style="text-align: center;">
|
||||
' . mysqli_error($con) . '
|
||||
</div>';
|
||||
} else {
|
||||
$msg = '<div class="paste-alert alert3" style="text-align: center;">
|
||||
Site permissions saved.
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['smtp_code'])) {
|
||||
$verification = Trim($_POST['verification']);
|
||||
$smtp_host = Trim($_POST['smtp_host']);
|
||||
$smtp_port = Trim($_POST['smtp_port']);
|
||||
$smtp_username = Trim($_POST['smtp_user']);
|
||||
$smtp_password = Trim($_POST['smtp_pass']);
|
||||
$socket = Trim($_POST['socket']);
|
||||
$auth = Trim($_POST['auth']);
|
||||
$protocol = Trim($_POST['protocol']);
|
||||
|
||||
$query = "UPDATE mail SET verification='$verification', smtp_host='$smtp_host', smtp_port='$smtp_port', smtp_username='$smtp_username', smtp_password='$smtp_password', socket='$socket', protocol='$protocol', auth='$auth' WHERE id='1'";
|
||||
mysqli_query($con, $query);
|
||||
|
||||
if (mysqli_errno($con)) {
|
||||
$msg = '<div class="paste-alert alert6" style="text-align: center;">
|
||||
' . mysqli_error($con) . '
|
||||
</div>';
|
||||
|
||||
} else {
|
||||
$msg = '
|
||||
<div class="paste-alert alert3" style="text-align: center;">
|
||||
Mail settings updated
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
if (isset($msg)) echo $msg;
|
||||
?>
|
||||
<?php if (isset($msg)) echo $msg; ?>
|
||||
|
||||
<div role="tabpanel">
|
||||
<!-- Nav tabs -->
|
||||
|
|
|
@ -13,124 +13,60 @@
|
|||
* GNU General Public License in GPL.txt for more details.
|
||||
*/
|
||||
|
||||
session_start();
|
||||
|
||||
if (isset($_SESSION['login'])) {
|
||||
// Do nothing
|
||||
} else {
|
||||
header("Location: .");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (isset($_GET['logout'])) {
|
||||
if (isset($_SESSION['login']))
|
||||
unset($_SESSION['login']);
|
||||
|
||||
session_destroy();
|
||||
header("Location: .");
|
||||
exit();
|
||||
}
|
||||
define('IN_ADMIN', 1);
|
||||
require_once('common.php');
|
||||
|
||||
$today_users_count = 0;
|
||||
$today_pastes_count = 0;
|
||||
|
||||
$date = date('jS F Y');
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
require_once('../config.php');
|
||||
require_once('../includes/functions.php');
|
||||
$con = mysqli_connect($dbhost, $dbuser, $dbpassword, $dbname);
|
||||
|
||||
if (mysqli_connect_errno()) {
|
||||
$sql_error = mysqli_connect_error();
|
||||
die("Unable connect to database");
|
||||
}
|
||||
updateAdminHistory($conn);
|
||||
|
||||
$query = "SELECT @last_id := MAX(id) FROM admin_history";
|
||||
$query = $conn->query("SELECT @last_id := MAX(id) FROM page_view");
|
||||
$row = $query->fetch(PDO::FETCH_NUM);
|
||||
$page_last_id = intval($row[0]);
|
||||
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$last_id = $row['@last_id := MAX(id)'];
|
||||
}
|
||||
$query = $conn->prepare('SELECT tpage, tvisit FROM page_view WHERE id = ?');
|
||||
$query->execute([$page_last_id]);
|
||||
|
||||
$query = "SELECT * FROM admin_history WHERE id=" . Trim($last_id);
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$last_date = $row['last_date'];
|
||||
$last_ip = $row['ip'];
|
||||
}
|
||||
|
||||
if ($last_ip == $ip) {
|
||||
if ($last_date == $date) {
|
||||
|
||||
} else {
|
||||
$query = "INSERT INTO admin_history (last_date,ip) VALUES ('$date','$ip')";
|
||||
mysqli_query($con, $query);
|
||||
}
|
||||
} else {
|
||||
$query = "INSERT INTO admin_history (last_date,ip) VALUES ('$date','$ip')";
|
||||
mysqli_query($con, $query);
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM page_view";
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$total_page = isset($total_page) + Trim($row['tpage']);
|
||||
$total_visit = isset($total_visit) + Trim($row['tvisit']);
|
||||
}
|
||||
|
||||
$query = "SELECT @last_id := MAX(id) FROM page_view";
|
||||
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$page_last_id = $row['@last_id := MAX(id)'];
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM page_view WHERE id=" . Trim($page_last_id);
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
while ($row = $query->fetch()) {
|
||||
$today_page = $row['tpage'];
|
||||
$today_visit = $row['tvisit'];
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM site_info";
|
||||
$result = mysqli_query($con, $query);
|
||||
$query = $conn->query('SELECT email FROM site_info');
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
while ($row = $query->fetch()) {
|
||||
$admin_email = Trim($row['email']);
|
||||
}
|
||||
|
||||
$c_date = date('jS F Y');
|
||||
$query = "SELECT id, username, date, ip FROM users where date='$c_date'";
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$today_users_count = $today_users_count + 1;
|
||||
}
|
||||
/* Number of users today */
|
||||
$query = $conn->prepare('SELECT COUNT(*) FROM users WHERE `date` = ?');
|
||||
$query->execute([$c_date]);
|
||||
$today_users_count = intval($query->fetch(PDO::FETCH_NUM)[0]);
|
||||
|
||||
$query = "SELECT id, ip, title, date, now_time, s_date, views, member FROM pastes where s_date='$c_date'";
|
||||
$result = mysqli_query($con, $query);
|
||||
/* Number of pastes today */
|
||||
$query = $conn->prepare('SELECT COUNT(*) FROM pastes where s_date = ?');
|
||||
$query->execute([$c_date]);
|
||||
$today_pastes_count = intval($query->fetch(PDO::FETCH_NUM)[0]);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$today_pastes_count = $today_pastes_count + 1;
|
||||
}
|
||||
for ($loop = 0; $loop <= 6; $loop++) {
|
||||
$myid = $page_last_id - $loop;
|
||||
$query = "SELECT * FROM page_view WHERE id='$myid'";
|
||||
$result = mysqli_query($con, $query);
|
||||
$query = $conn->prepare("SELECT date, tpage, tvisit FROM page_view WHERE id = ?");
|
||||
$query->execute([$myid]);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
while ($row = $query->fetch()) {
|
||||
$sdate = $row['date'];
|
||||
$sdate = str_replace(date('Y'), '', $sdate);
|
||||
$sdate = str_replace('January', 'Jan', $sdate);
|
||||
$sdate = str_replace('February', 'Feb', $sdate);
|
||||
$sdate = str_replace('March', 'Mar', $sdate);
|
||||
$sdate = str_replace('April', 'Apr', $sdate);
|
||||
$sdate = str_replace('August', 'Aug', $sdate);
|
||||
$sdate = str_replace('August', 'Aug', $sdate);
|
||||
$sdate = str_replace('September', 'Sep', $sdate);
|
||||
$sdate = str_replace('October', 'Oct', $sdate);
|
||||
$sdate = str_replace('November', 'Nov', $sdate);
|
||||
|
@ -233,8 +169,8 @@ for ($loop = 0; $loop <= 6; $loop++) {
|
|||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$res = getRecentadmin($con, 7);
|
||||
while ($row = mysqli_fetch_array($res)) {
|
||||
$res = getRecentadmin($conn, 7);
|
||||
foreach ($res as $row) {
|
||||
$title = Trim($row['title']);
|
||||
$p_id = Trim($row['id']);
|
||||
$p_date = Trim($row['s_date']);
|
||||
|
@ -284,33 +220,20 @@ for ($loop = 0; $loop <= 6; $loop++) {
|
|||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$query = "SELECT @last_id := MAX(id) FROM users";
|
||||
$result = mysqli_query($con, $query);
|
||||
$most_recent_users = $conn->query('SELECT id, username, date, ip FROM users ORDER BY id DESC LIMIT 7')->fetchAll();
|
||||
$last_id = intval(
|
||||
$conn->query('SELECT MAX(id) FROM users')->fetch(PDO::FETCH_NUM)[0]
|
||||
);
|
||||
|
||||
if($result) {
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$last_id = $row['@last_id := MAX(id)'];
|
||||
}
|
||||
}
|
||||
|
||||
for ($uloop = 0; $uloop <= 6; $uloop++) {
|
||||
$r_my_id = $last_id - $uloop;
|
||||
$query = "SELECT * FROM users WHERE id='$r_my_id'";
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$u_date = $row['date'];
|
||||
$ip = $row['ip'];
|
||||
$username = $row['username'];
|
||||
}
|
||||
echo "
|
||||
foreach ($most_recent_users as $user) {
|
||||
echo "
|
||||
<tr>
|
||||
<td>$r_my_id</td>
|
||||
<td>$username</td>
|
||||
<td>$u_date</td>
|
||||
<td><span class='label label-default'>$ip</span></td>
|
||||
<td>${user['id']}</td>
|
||||
<td>${user['username']}</td>
|
||||
<td>${user['date']}</td>
|
||||
<td><span class='label label-default'>${user['ip']}</span></td>
|
||||
</tr> ";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
|
@ -344,8 +267,8 @@ for ($loop = 0; $loop <= 6; $loop++) {
|
|||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$res = getreports($con, 7);
|
||||
while ($row = mysqli_fetch_array($res)) {
|
||||
$res = getreports($conn, 7);
|
||||
foreach ($res as $row) {
|
||||
$r_paste = Trim($row['p_report']);
|
||||
$r_id = Trim($row['id']);
|
||||
$r_date = Trim($row['t_report']);
|
||||
|
|
|
@ -20,18 +20,18 @@ session_start();
|
|||
|
||||
require_once ('../config.php');
|
||||
|
||||
$con = mysqli_connect($dbhost, $dbuser, $dbpassword, $dbname);
|
||||
if (mysqli_connect_errno()) {
|
||||
$sql_error = mysqli_connect_error();
|
||||
die("Unable connect to database");
|
||||
}
|
||||
$conn = new PDO(
|
||||
"mysql:host=$db_host;dbname=$db_schema;charset=utf8",
|
||||
$db_user,
|
||||
$db_pass,
|
||||
$db_opts
|
||||
);
|
||||
|
||||
$query = "SELECT * FROM admin";
|
||||
$result = mysqli_query($con,$query);
|
||||
$query = $conn->query('SELECT user, pass FROM admin');
|
||||
|
||||
while($row = mysqli_fetch_array($result)) {
|
||||
$adminid = Trim($row['user']);
|
||||
$password = $row['pass'];
|
||||
while ($row = $query->fetch()) {
|
||||
$adminid = Trim($row['user']);
|
||||
$password = Trim($row['pass']);
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
|
|
|
@ -32,10 +32,7 @@ if (!empty($_POST))
|
|||
if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) )
|
||||
continue;
|
||||
|
||||
if ( get_magic_quotes_gpc() )
|
||||
$value = htmlspecialchars( stripslashes((string)$value) );
|
||||
else
|
||||
$value = htmlspecialchars( (string)$value );
|
||||
$value = htmlspecialchars( (string)$value );
|
||||
?>
|
||||
<tr>
|
||||
<th style="vertical-align: top"><?php echo htmlspecialchars( (string)$key ); ?></th>
|
||||
|
|
|
@ -12,61 +12,11 @@
|
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License in GPL.txt for more details.
|
||||
*/
|
||||
session_start();
|
||||
define('IN_ADMIN', 1);
|
||||
require_once('common.php');
|
||||
|
||||
if (isset($_SESSION['login'])) {
|
||||
// Do nothing
|
||||
} else {
|
||||
header("Location: .");
|
||||
exit();
|
||||
}
|
||||
updateAdminHistory($conn);
|
||||
|
||||
if (isset($_GET['logout'])) {
|
||||
if (isset($_SESSION['login']))
|
||||
unset($_SESSION['login']);
|
||||
|
||||
session_destroy();
|
||||
header("Location: .");
|
||||
exit();
|
||||
}
|
||||
|
||||
$date = date('jS F Y');
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
require_once('../config.php');
|
||||
$con = mysqli_connect($dbhost, $dbuser, $dbpassword, $dbname);
|
||||
|
||||
if (mysqli_connect_errno()) {
|
||||
$sql_error = mysqli_connect_error();
|
||||
die("Unable connect to database");
|
||||
}
|
||||
|
||||
$query = "SELECT @last_id := MAX(id) FROM admin_history";
|
||||
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$last_id = $row['@last_id := MAX(id)'];
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM admin_history WHERE id=" . Trim($last_id);
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$last_date = $row['last_date'];
|
||||
$last_ip = $row['ip'];
|
||||
}
|
||||
|
||||
if ($last_ip == $ip) {
|
||||
if ($last_date == $date) {
|
||||
|
||||
} else {
|
||||
$query = "INSERT INTO admin_history (last_date,ip) VALUES ('$date','$ip')";
|
||||
mysqli_query($con, $query);
|
||||
}
|
||||
} else {
|
||||
$query = "INSERT INTO admin_history (last_date,ip) VALUES ('$date','$ip')";
|
||||
mysqli_query($con, $query);
|
||||
}
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
if (isset($_POST{'editme'})) {
|
||||
$edit_me_id = htmlentities(Trim($_POST['editme']));
|
||||
|
@ -167,7 +117,7 @@ if (isset($_GET{'edit'})) {
|
|||
<br />
|
||||
<?php
|
||||
if (isset($_GET{'edit'})) {
|
||||
echo '<input type="hidden" value=' . $_GET{'edit'} . 'id="editme" name="editme" />';
|
||||
echo '<input type="hidden" value=' . $_GET['edit'] . 'id="editme" name="editme" />';
|
||||
}
|
||||
?>
|
||||
<div class='control-group'>
|
||||
|
@ -221,8 +171,8 @@ if (isset($_GET{'edit'})) {
|
|||
|
||||
|
||||
|
||||
if (isset($_GET{'page'})) { // Get the current page
|
||||
$page = $_GET{'page'} + 1;
|
||||
if (isset($_GET['page'])) { // Get the current page
|
||||
$page = $_GET['page'] + 1;
|
||||
$offset = $rec_limit * $page;
|
||||
} else {
|
||||
// Show first set of results
|
||||
|
|
|
@ -12,63 +12,10 @@
|
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License in GPL.txt for more details.
|
||||
*/
|
||||
session_start();
|
||||
|
||||
if (isset($_SESSION['login'])) {
|
||||
// Do nothing
|
||||
} else {
|
||||
header("Location: .");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (isset($_GET['logout'])) {
|
||||
if (isset($_SESSION['login']))
|
||||
unset($_SESSION['login']);
|
||||
|
||||
session_destroy();
|
||||
header("Location: .");
|
||||
exit();
|
||||
}
|
||||
|
||||
$date = date('jS F Y');
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
require_once('../config.php');
|
||||
$con = mysqli_connect($dbhost, $dbuser, $dbpassword, $dbname);
|
||||
|
||||
if (mysqli_connect_errno()) {
|
||||
$sql_error = mysqli_connect_error();
|
||||
die("Unable connect to database");
|
||||
}
|
||||
|
||||
$query = "SELECT @last_id := MAX(id) FROM admin_history";
|
||||
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$last_id = $row['@last_id := MAX(id)'];
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM admin_history WHERE id=" . Trim($last_id);
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$last_date = $row['last_date'];
|
||||
$last_ip = $row['ip'];
|
||||
}
|
||||
|
||||
if ($last_ip == $ip) {
|
||||
if ($last_date == $date) {
|
||||
|
||||
} else {
|
||||
$query = "INSERT INTO admin_history (last_date,ip) VALUES ('$date','$ip')";
|
||||
mysqli_query($con, $query);
|
||||
}
|
||||
} else {
|
||||
$query = "INSERT INTO admin_history (last_date,ip) VALUES ('$date','$ip')";
|
||||
mysqli_query($con, $query);
|
||||
}
|
||||
|
||||
define('IN_ADMIN', 1);
|
||||
require_once('common.php');
|
||||
|
||||
updateAdminHistory($conn);
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
require_once('config.php');
|
||||
require_once('../config.php');
|
||||
// DB table to use
|
||||
$table = 'pastes';
|
||||
|
||||
|
@ -27,10 +27,10 @@ $columns2 = array(
|
|||
|
||||
// SQL server connection information
|
||||
$sql_details = array(
|
||||
'user' => $dbuser,
|
||||
'pass' => $dbpassword,
|
||||
'db' => $dbname,
|
||||
'host' => $dbhost
|
||||
'user' => $db_user,
|
||||
'pass' => $db_pass,
|
||||
'db' => $db_schema,
|
||||
'host' => $db_host
|
||||
);
|
||||
|
||||
|
||||
|
|
112
archive.php
112
archive.php
|
@ -14,126 +14,24 @@
|
|||
*/
|
||||
session_start();
|
||||
|
||||
define('IN_PONEPASTE', 1);
|
||||
require_once('includes/common.php');
|
||||
require_once('config.php');
|
||||
require_once('includes/functions.php');
|
||||
|
||||
// UTF-8
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
|
||||
$date = date('jS F Y');
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
$data_ip = file_get_contents('tmp/temp.tdata');
|
||||
$conn = new PDO(
|
||||
"mysql:host=$db_host;dbname=$db_schema;charset=utf8",
|
||||
$db_user,
|
||||
$db_pass,
|
||||
$db_opts
|
||||
);
|
||||
|
||||
// Get site info
|
||||
$site_info_rows = $conn->query('SELECT * FROM site_info');
|
||||
while ($row = $site_info_rows->fetch()) {
|
||||
$title = Trim($row['title']);
|
||||
$des = Trim($row['des']);
|
||||
$baseurl = Trim($row['baseurl']);
|
||||
$keyword = Trim($row['keyword']);
|
||||
$site_name = Trim($row['site_name']);
|
||||
$email = Trim($row['email']);
|
||||
$twit = Trim($row['twit']);
|
||||
$face = Trim($row['face']);
|
||||
$gplus = Trim($row['gplus']);
|
||||
$ga = Trim($row['ga']);
|
||||
$additional_scripts = Trim($row['additional_scripts']);
|
||||
}
|
||||
// Temp count for untagged pastes
|
||||
$total_untagged = intval($conn->query("SELECT COUNT(*) from pastes WHERE tagsys IS NULL")->fetch(PDO::FETCH_NUM)[0]);
|
||||
|
||||
updatePageViews($conn);
|
||||
|
||||
//Temp count for untagged pastes
|
||||
$untagged = $conn->query("SELECT COUNT(id) from pastes WHERE tagsys is null");
|
||||
while ($row = $untagged->fetch()) {
|
||||
$total_untagged = $row['COUNT(id)'];
|
||||
}
|
||||
|
||||
|
||||
// Set theme and language
|
||||
$site_theme_rows = $conn->query('SELECT * FROM interface WHERE id="1"');
|
||||
while ($row = $site_theme_rows->fetch()) {
|
||||
$default_lang = Trim($row['lang']);
|
||||
$default_theme = Trim($row['theme']);
|
||||
}
|
||||
require_once("langs/$default_lang");
|
||||
|
||||
$p_title = $lang['archive']; // "Pastes Archive";
|
||||
|
||||
// Check if IP is banned
|
||||
if ( is_banned($conn, $ip) ) die($lang['banned']); // "You have been banned from ".$site_name;
|
||||
|
||||
// Logout
|
||||
if (isset($_GET['logout'])) {
|
||||
header('Location: ' . $_SERVER['HTTP_REFERER']);
|
||||
unset($_SESSION['token']);
|
||||
unset($_SESSION['oauth_uid']);
|
||||
unset($_SESSION['username']);
|
||||
session_destroy();
|
||||
}
|
||||
|
||||
// Page views
|
||||
$site_view_rows = $conn->query("SELECT @last_id := MAX(id) FROM page_view");
|
||||
while ($row = $site_view_rows->fetch()) {
|
||||
$last_id = $row['@last_id := MAX(id)'];
|
||||
}
|
||||
|
||||
$site_view_last = $conn->query("SELECT * FROM page_view WHERE id='?'");
|
||||
$site_view_last->execute([$last_id]);
|
||||
while ($row = $site_view_last->fetch()) {
|
||||
$last_date = $row['date'];
|
||||
}
|
||||
|
||||
if ($last_date == $date) {
|
||||
if (str_contains($data_ip, $ip)) {
|
||||
$statement = $conn->prepare("SELECT * FROM page_view WHERE id ='?'");
|
||||
$statement->execute([$last_id]);
|
||||
while ($row = $statement->fetch()) {
|
||||
$last_tpage = Trim($row['tpage']);
|
||||
}
|
||||
$last_tpage = $last_tpage + 1;
|
||||
|
||||
// IP already exists, Update view count
|
||||
$statement = $conn->prepare("UPDATE page_view SET tpage=? WHERE id='?'");
|
||||
$statement->execute([$last_tpage,$last_id]);
|
||||
} else {
|
||||
$statement = $conn->prepare("SELECT * FROM page_view WHERE id ='?'");
|
||||
$statement->execute([$last_id]);
|
||||
while ($row = $statement->fetch()) {
|
||||
$last_tpage = Trim($row['tpage']);
|
||||
$last_tvisit = Trim($row['tvisit']);
|
||||
}
|
||||
$last_tpage = $last_tpage + 1;
|
||||
$last_tvisit = $last_tvisit + 1;
|
||||
|
||||
// Update both tpage and tvisit.
|
||||
$statement = $conn->prepare("UPDATE page_view SET tpage=?,tvisit=? WHERE id ='?'");
|
||||
$statement->execute([$last_tpage,$last_tvisit,$last_id]);
|
||||
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
||||
}
|
||||
} else {
|
||||
// Delete the file and clear data_ip
|
||||
unlink("tmp/temp.tdata");
|
||||
$data_ip = "";
|
||||
|
||||
// New date is created
|
||||
$statement = $conn->prepare("INSERT INTO page_view (date,tpage,tvisit) VALUES ('?','1','1')");
|
||||
$statement->execute([$date]);
|
||||
// Update the IP
|
||||
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
||||
|
||||
}
|
||||
// Ads
|
||||
$site_ads_rows = $conn->query('SELECT * FROM ads WHERE id="1"');
|
||||
while ($row = $site_ads_rows->fetch()) {
|
||||
$text_ads = Trim($row['text_ads']);
|
||||
$ads_1 = Trim($row['ads_1']);
|
||||
$ads_2 = Trim($row['ads_2']);
|
||||
}
|
||||
// Theme
|
||||
require_once('theme/' . $default_theme . '/header.php');
|
||||
require_once('theme/' . $default_theme . '/archive.php');
|
||||
|
|
|
@ -42,6 +42,14 @@ $db_schema = 'p0nepast3s';
|
|||
$db_user = 'P0nedbAcc0unt';
|
||||
$db_pass = '1NWO6Tp17IFz9lbl';
|
||||
|
||||
// I'm sorry, I didn't want to edit this file and check it in, but I may need to make other changes to it, so I did this
|
||||
if (gethostname() === 'thunderlane') {
|
||||
$db_host = 'localhost';
|
||||
$db_schema = 'ponepaste';
|
||||
$db_user = 'ponepaste';
|
||||
$db_pass = 'ponepaste';
|
||||
}
|
||||
|
||||
$db_opts = [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, /* throw a fatal exception on database errors */
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, /* Fetch rows as an associative array (hash table) by default */
|
||||
|
@ -72,6 +80,5 @@ $popular_formats=array(
|
|||
'pastedown_old'
|
||||
);
|
||||
|
||||
|
||||
//Cookie
|
||||
?>
|
80
discover.php
80
discover.php
|
@ -14,89 +14,15 @@
|
|||
*/
|
||||
session_start();
|
||||
|
||||
require_once('config.php');
|
||||
define('IN_PONEPASTE', 1);
|
||||
require_once('includes/common.php');
|
||||
require_once('includes/functions.php');
|
||||
|
||||
// UTF-8
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
|
||||
$date = date('jS F Y');
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
$data_ip = file_get_contents('tmp/temp.tdata');
|
||||
$con = mysqli_connect($dbhost, $dbuser, $dbpassword, $dbname);
|
||||
|
||||
if (mysqli_connect_errno()) {
|
||||
die("Unable to connect to database");
|
||||
}
|
||||
$query = "SELECT * FROM site_info";
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$title = Trim($row['title']);
|
||||
$des = Trim($row['des']);
|
||||
$baseurl = Trim($row['baseurl']);
|
||||
$keyword = Trim($row['keyword']);
|
||||
$site_name = Trim($row['site_name']);
|
||||
$email = Trim($row['email']);
|
||||
$twit = Trim($row['twit']);
|
||||
$face = Trim($row['face']);
|
||||
$gplus = Trim($row['gplus']);
|
||||
$ga = Trim($row['ga']);
|
||||
$additional_scripts = Trim($row['additional_scripts']);
|
||||
}
|
||||
|
||||
// Set theme and language
|
||||
$query = "SELECT * FROM interface";
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$default_lang = Trim($row['lang']);
|
||||
$default_theme = Trim($row['theme']);
|
||||
}
|
||||
|
||||
require_once("langs/$default_lang");
|
||||
|
||||
$p_title = $lang['archive']; // "Pastes Archive";
|
||||
|
||||
// Check if IP is banned
|
||||
if ( is_banned($con, $ip) ) die($lang['banned']); // "You have been banned from ".$site_name;
|
||||
|
||||
// Site permissions
|
||||
$query = "SELECT * FROM site_permissions where id='1'";
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$siteprivate = Trim($row['siteprivate']);
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
} else {
|
||||
if ($siteprivate =="on") {
|
||||
$privatesite = "on";
|
||||
}
|
||||
}
|
||||
|
||||
// Logout
|
||||
if (isset($_GET['logout'])) {
|
||||
header('Location: ' . $_SERVER['HTTP_REFERER']);
|
||||
unset($_SESSION['token']);
|
||||
unset($_SESSION['oauth_uid']);
|
||||
unset($_SESSION['username']);
|
||||
session_destroy();
|
||||
}
|
||||
|
||||
|
||||
|
||||
$query = "SELECT * FROM ads WHERE id='1'";
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$text_ads = Trim($row['text_ads']);
|
||||
$ads_1 = Trim($row['ads_1']);
|
||||
$ads_2 = Trim($row['ads_2']);
|
||||
|
||||
}
|
||||
// Theme
|
||||
$p_title = $lang['archive']; // "Pastes Archive";
|
||||
require_once('theme/' . $default_theme . '/header.php');
|
||||
require_once('theme/' . $default_theme . '/discover.php');
|
||||
require_once('theme/' . $default_theme . '/footer.php');
|
||||
|
|
50
event.php
50
event.php
|
@ -14,7 +14,8 @@
|
|||
*/
|
||||
session_start();
|
||||
|
||||
require_once('config.php');
|
||||
define('IN_PONEPASTE', 1);
|
||||
require_once('includes/common.php');
|
||||
require_once('includes/functions.php');
|
||||
|
||||
// UTF-8
|
||||
|
@ -22,56 +23,9 @@ header('Content-Type: text/html; charset=utf-8');
|
|||
|
||||
$date = date('jS F Y');
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
$data_ip = file_get_contents('tmp/temp.tdata');
|
||||
$conn = new PDO(
|
||||
"mysql:host=$db_host;dbname=$db_schema;charset=utf8",
|
||||
$db_user,
|
||||
$db_pass,
|
||||
$db_opts
|
||||
);
|
||||
|
||||
$site_info_rows = $conn->query('SELECT * FROM site_info');
|
||||
while ($row = $site_info_rows->fetch()) {
|
||||
$title = Trim($row['title']);
|
||||
$des = Trim($row['des']);
|
||||
$baseurl = Trim($row['baseurl']);
|
||||
$keyword = Trim($row['keyword']);
|
||||
$site_name = Trim($row['site_name']);
|
||||
$email = Trim($row['email']);
|
||||
$twit = Trim($row['twit']);
|
||||
$face = Trim($row['face']);
|
||||
$gplus = Trim($row['gplus']);
|
||||
$ga = Trim($row['ga']);
|
||||
$additional_scripts = Trim($row['additional_scripts']);
|
||||
}
|
||||
|
||||
// Set theme and language
|
||||
$site_theme_rows = $conn->query('SELECT * FROM interface WHERE id="1"');
|
||||
while ($row = $site_theme_rows->fetch()) {
|
||||
$default_lang = Trim($row['lang']);
|
||||
$default_theme = Trim($row['theme']);
|
||||
}
|
||||
require_once("langs/$default_lang");
|
||||
|
||||
|
||||
$p_title = $lang['archive']; // "Pastes Archive";
|
||||
|
||||
// Check if IP is banned
|
||||
if ( is_banned($con, $ip) ) die($lang['banned']); // "You have been banned from ".$site_name;
|
||||
|
||||
// Site permissions
|
||||
$query = "SELECT * FROM site_permissions where id='1'";
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
// Logout
|
||||
if (isset($_GET['logout'])) {
|
||||
header('Location: ' . $_SERVER['HTTP_REFERER']);
|
||||
unset($_SESSION['token']);
|
||||
unset($_SESSION['oauth_uid']);
|
||||
unset($_SESSION['username']);
|
||||
session_destroy();
|
||||
}
|
||||
|
||||
// Theme
|
||||
require_once('theme/' . $default_theme . '/header.php');
|
||||
require_once('theme/' . $default_theme . '/event.php');
|
||||
|
|
128
includes/common.php
Normal file
128
includes/common.php
Normal file
|
@ -0,0 +1,128 @@
|
|||
<?php
|
||||
if (!defined('IN_PONEPASTE')) {
|
||||
die('This file may not be accessed directly.');
|
||||
}
|
||||
|
||||
require_once('config.php');
|
||||
require_once('includes/functions.php');
|
||||
|
||||
|
||||
function getSiteInfo($conn) {
|
||||
return $conn->query('SELECT * FROM site_info LIMIT 1')->fetch();
|
||||
}
|
||||
|
||||
function getSiteLangAndTheme($conn) {
|
||||
return $conn->query('SELECT lang, theme FROM interface LIMIT 1')->fetch();
|
||||
}
|
||||
|
||||
function getSitePermissions($conn) {
|
||||
return $conn->query('SELECT * FROM site_permissions LIMIT 1')->fetch();
|
||||
}
|
||||
|
||||
function getSiteAds($conn) {
|
||||
return $conn->query('SELECT text_ads, ads_1, ads_2 FROM ads LIMIT 1')->fetch();
|
||||
}
|
||||
|
||||
function updatePageViews($conn) {
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
$date = date('jS F Y');
|
||||
$data_ip = file_get_contents('tmp/temp.tdata');
|
||||
|
||||
$last_page_view = $conn->query('SELECT * FROM page_view ORDER BY id DESC LIMIT 1')->fetch();
|
||||
$last_date = $last_page_view['date'];
|
||||
|
||||
if ($last_date == $date) {
|
||||
if (str_contains($data_ip, $ip)) {
|
||||
$last_tpage = intval($last_page_view['tpage']) + 1;
|
||||
|
||||
// IP already exists, Update view count
|
||||
$statement = $conn->prepare("UPDATE page_view SET tpage = ? WHERE id = ?");
|
||||
$statement->execute([$last_tpage, $last_page_view['id']]);
|
||||
} else {
|
||||
$last_tpage = intval($last_page_view['tpage']) + 1;
|
||||
$last_tvisit = intval($last_page_view['tvisit']) + 1;
|
||||
|
||||
// Update both tpage and tvisit.
|
||||
$statement = $conn->prepare("UPDATE page_view SET tpage = ?,tvisit = ? WHERE id = ?");
|
||||
$statement->execute([$last_tpage, $last_tvisit, $last_page_view['id']]);
|
||||
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
||||
}
|
||||
} else {
|
||||
// Delete the file and clear data_ip
|
||||
unlink("tmp/temp.tdata");
|
||||
|
||||
// New date is created
|
||||
$statement = $conn->prepare("INSERT INTO page_view (date, tpage, tvisit) VALUES (?, '1', '1')");
|
||||
$statement->execute([$date]);
|
||||
|
||||
// Update the IP
|
||||
file_put_contents('tmp/temp.tdata', $ip);
|
||||
}
|
||||
}
|
||||
|
||||
$conn = new PDO(
|
||||
"mysql:host=$db_host;dbname=$db_schema;charset=utf8",
|
||||
$db_user,
|
||||
$db_pass,
|
||||
$db_opts
|
||||
);
|
||||
|
||||
// Setup site info
|
||||
$row = getSiteInfo($conn);
|
||||
$title = Trim($row['title']);
|
||||
$des = Trim($row['des']);
|
||||
$baseurl = Trim($row['baseurl']);
|
||||
$keyword = Trim($row['keyword']);
|
||||
$site_name = Trim($row['site_name']);
|
||||
$email = Trim($row['email']);
|
||||
$twit = Trim($row['twit']);
|
||||
$face = Trim($row['face']);
|
||||
$gplus = Trim($row['gplus']);
|
||||
$ga = Trim($row['ga']);
|
||||
$additional_scripts = Trim($row['additional_scripts']);
|
||||
|
||||
|
||||
// Setup theme and language
|
||||
|
||||
$lang_and_theme = getSiteLangAndTheme($conn);
|
||||
|
||||
if ($lang_and_theme) {
|
||||
$default_lang = $lang_and_theme['lang'];
|
||||
$default_theme = $lang_and_theme['theme'];
|
||||
} else {
|
||||
$default_lang = 'en.php';
|
||||
$default_theme = 'bulma';
|
||||
}
|
||||
|
||||
// site permissions
|
||||
$site_permissions = getSitePermissions($conn);
|
||||
|
||||
if ($site_permissions) {
|
||||
$siteprivate = $site_permissions['siteprivate'];
|
||||
} else {
|
||||
$siteprivate = 'off';
|
||||
}
|
||||
|
||||
$privatesite = $siteprivate;
|
||||
|
||||
|
||||
// Prevent a potential LFI (you never know :p)
|
||||
if (in_array($default_lang, scandir('langs/'))) {
|
||||
require_once("langs/$default_lang");
|
||||
}
|
||||
|
||||
// Check if IP is banned
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
if ( is_banned($conn, $ip) ) die($lang['banned']); // "You have been banned from ".$site_name;
|
||||
|
||||
// Logout
|
||||
if (isset($_GET['logout'])) {
|
||||
header('Location: ' . $_SERVER['HTTP_REFERER']);
|
||||
unset($_SESSION['token']);
|
||||
unset($_SESSION['oauth_uid']);
|
||||
unset($_SESSION['username']);
|
||||
unset($_SESSION['pic']);
|
||||
session_destroy();
|
||||
}
|
||||
|
||||
$site_ads = getSiteAds($conn);
|
|
@ -83,12 +83,11 @@ function checkFavorite($paste_id, $user_id, $conn) {
|
|||
}
|
||||
}
|
||||
|
||||
function getreports($conn, $count = 10)
|
||||
{
|
||||
$limit = $count ? "limit $count" : "";
|
||||
$query = "SELECT * FROM user_reports $count";
|
||||
$result = mysqli_query($conn, $query);
|
||||
return $result;
|
||||
function getreports($conn, $count = 10) {
|
||||
$query = $conn->prepare('SELECT * FROM user_reports LIMIT ?');
|
||||
$query->execute([$count]);
|
||||
|
||||
return $query->fetchAll();
|
||||
}
|
||||
|
||||
function sandwitch($str){
|
||||
|
@ -233,13 +232,10 @@ LIMIT ?");
|
|||
|
||||
function getRecentadmin($conn, $count = 5)
|
||||
{
|
||||
$limit = $count ? "limit $count" : "";
|
||||
$query = "SELECT id, ip, title, date, now_time, s_date, views, member
|
||||
FROM pastes
|
||||
ORDER BY id DESC
|
||||
LIMIT 0 , $count";
|
||||
$result = mysqli_query($conn, $query);
|
||||
return $result;
|
||||
$query = $conn->prepare('SELECT id, ip title, date, now_time, s_date, views, member FROM pastes ORDER BY id DESC LIMIT 0, ?');
|
||||
$query->execute([$count]);
|
||||
|
||||
return $query->fetchAll();
|
||||
}
|
||||
function getpopular($conn, $count = 10)
|
||||
{
|
||||
|
@ -533,7 +529,7 @@ function embedView( $paste_id, $p_title, $p_conntent, $p_code, $title, $baseurl,
|
|||
function addToSitemap($paste_id, $priority, $changefreq, $mod_rewrite)
|
||||
{
|
||||
$c_date = date('Y-m-d');
|
||||
$site_data = file_get_conntents("sitemap.xml");
|
||||
$site_data = file_get_contents("sitemap.xml");
|
||||
$site_data = str_replace("</urlset>", "", $site_data);
|
||||
// which protocol are we on
|
||||
$protocol = paste_protocol();
|
||||
|
@ -554,7 +550,7 @@ function addToSitemap($paste_id, $priority, $changefreq, $mod_rewrite)
|
|||
</urlset>';
|
||||
|
||||
$full_map = $site_data . $c_sitemap;
|
||||
file_put_conntents("sitemap.xml", $full_map);
|
||||
file_put_contents("sitemap.xml", $full_map);
|
||||
}
|
||||
function paste_protocol() {
|
||||
|
||||
|
|
226
index.php
226
index.php
|
@ -24,61 +24,50 @@ if (file_exists($directory)) {
|
|||
}
|
||||
|
||||
// Required functions
|
||||
require_once('config.php');
|
||||
require_once('includes/captcha.php');
|
||||
require_once('includes/functions.php');
|
||||
define('IN_PONEPASTE', 1);
|
||||
require_once('includes/common.php');
|
||||
|
||||
// PHP <5.5 compatibility
|
||||
require_once('includes/password.php');
|
||||
|
||||
function calculatePasteExpiry($p_expiry) {
|
||||
switch ($p_expiry) {
|
||||
case '10M':
|
||||
$expires = mktime(date("H"), date("i") + "10", date("s"), date("n"), date("j"), date("Y"));
|
||||
break;
|
||||
case '1H':
|
||||
$expires = mktime(date("H") + "1", date("i"), date("s"), date("n"), date("j"), date("Y"));
|
||||
case '1D':
|
||||
$expires = mktime(date("H"), date("i"), date("s"), date("n"), date("j") + "1", date("Y"));
|
||||
break;
|
||||
case '1W':
|
||||
$expires = mktime(date("H"), date("i"), date("s"), date("n"), date("j") + "7", date("Y"));
|
||||
break;
|
||||
case '2W':
|
||||
$expires = mktime(date("H"), date("i"), date("s"), date("n"), date("j") + "14", date("Y"));
|
||||
break;
|
||||
case '1M':
|
||||
$expires = mktime(date("H"), date("i"), date("s"), date("n") + "1", date("j"), date("Y"));
|
||||
break;
|
||||
case 'self':
|
||||
$expires = "SELF";
|
||||
break;
|
||||
default:
|
||||
$expires = "NULL";
|
||||
break;
|
||||
}
|
||||
|
||||
return $expires;
|
||||
}
|
||||
|
||||
// UTF-8
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
|
||||
// Database Connection
|
||||
$conn = new PDO(
|
||||
"mysql:host=$db_host;dbname=$db_schema;charset=utf8",
|
||||
$db_user,
|
||||
$db_pass,
|
||||
$db_opts
|
||||
);
|
||||
|
||||
|
||||
// Get site info
|
||||
$site_info_rows = $conn->query('SELECT * FROM site_info');
|
||||
while ($row = $site_info_rows->fetch()) {
|
||||
$title = Trim($row['title']);
|
||||
$des = Trim($row['des']);
|
||||
$baseurl = Trim($row['baseurl']);
|
||||
$keyword = Trim($row['keyword']);
|
||||
$site_name = Trim($row['site_name']);
|
||||
$email = Trim($row['email']);
|
||||
$twit = Trim($row['twit']);
|
||||
$face = Trim($row['face']);
|
||||
$gplus = Trim($row['gplus']);
|
||||
$ga = Trim($row['ga']);
|
||||
$additional_scripts = Trim($row['additional_scripts']);
|
||||
}
|
||||
|
||||
// Set theme and language
|
||||
$site_theme_rows = $conn->query('SELECT * FROM interface WHERE id="1"');
|
||||
while ($row = $site_theme_rows->fetch()) {
|
||||
$default_lang = Trim($row['lang']);
|
||||
$default_theme = Trim($row['theme']);
|
||||
}
|
||||
require_once("langs/$default_lang");
|
||||
|
||||
// Current date & user IP
|
||||
$date = date('jS F Y');
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
$data_ip = file_get_contents('tmp/temp.tdata');
|
||||
|
||||
// Ads
|
||||
$site_ads_rows = $conn->query('SELECT * FROM ads WHERE id="1"');
|
||||
while ($row = $site_ads_rows->fetch()) {
|
||||
$text_ads = Trim($row['text_ads']);
|
||||
$ads_1 = Trim($row['ads_1']);
|
||||
$ads_2 = Trim($row['ads_2']);
|
||||
}
|
||||
|
||||
// Sitemap
|
||||
$site_sitemap_rows = $conn->query('SELECT * FROM sitemap_options WHERE id="1"');
|
||||
|
@ -113,16 +102,6 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
}
|
||||
}
|
||||
|
||||
// Check if IP is banned
|
||||
if ( is_banned($conn, $ip) ) die($lang['banned']); // "You have been banned from ".$site_name;
|
||||
|
||||
// Site permissions
|
||||
|
||||
$site_perms_rows = $conn->query("SELECT * FROM site_permissions where id='1'");
|
||||
while ($row = $site_perms_rows->fetch()) {
|
||||
$disableguest = Trim($row['disableguest']);
|
||||
$siteprivate = Trim($row['siteprivate']);
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
} else {
|
||||
|
@ -137,107 +116,29 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
}
|
||||
}
|
||||
|
||||
// Escape from quotes
|
||||
if (get_magic_quotes_gpc()) {
|
||||
function callback_stripslashes(&$val, $name)
|
||||
{
|
||||
if (get_magic_quotes_gpc())
|
||||
$val = stripslashes($val);
|
||||
}
|
||||
if (count($_GET))
|
||||
array_walk($_GET, 'callback_stripslashes');
|
||||
if (count($_POST))
|
||||
array_walk($_POST, 'callback_stripslashes');
|
||||
if (count($_COOKIE))
|
||||
array_walk($_COOKIE, 'callback_stripslashes');
|
||||
}
|
||||
|
||||
// Logout
|
||||
if (isset($_GET['logout'])) {
|
||||
header('Location: ' . $_SERVER['HTTP_REFERER']);
|
||||
unset($_SESSION['token']);
|
||||
unset($_SESSION['oauth_uid']);
|
||||
unset($_SESSION['username']);
|
||||
unset($_SESSION['pic']);
|
||||
session_destroy();
|
||||
}
|
||||
|
||||
// Page views
|
||||
$site_view_rows = $conn->query("SELECT @last_id := MAX(id) FROM page_view");
|
||||
while ($row = $site_view_rows->fetch()) {
|
||||
$last_id = $row['@last_id := MAX(id)'];
|
||||
}
|
||||
|
||||
$site_view_last = $conn->query("SELECT * FROM page_view WHERE id='?'");
|
||||
$site_view_last->execute([$last_id]);
|
||||
while ($row = $site_view_last->fetch()) {
|
||||
$last_date = $row['date'];
|
||||
}
|
||||
|
||||
if ($last_date == $date) {
|
||||
if (str_contains($data_ip, $ip)) {
|
||||
$statement = $conn->prepare("SELECT * FROM page_view WHERE id ='?'");
|
||||
$statement->execute([$last_id]);
|
||||
while ($row = $statement->fetch()) {
|
||||
$last_tpage = Trim($row['tpage']);
|
||||
}
|
||||
$last_tpage = $last_tpage + 1;
|
||||
|
||||
// IP already exists, Update view count
|
||||
$statement = $conn->prepare("UPDATE page_view SET tpage=? WHERE id='?'");
|
||||
$statement->execute([$last_tpage,$last_id]);
|
||||
} else {
|
||||
$statement = $conn->prepare("SELECT * FROM page_view WHERE id ='?'");
|
||||
$statement->execute([$last_id]);
|
||||
while ($row = $statement->fetch()) {
|
||||
$last_tpage = Trim($row['tpage']);
|
||||
$last_tvisit = Trim($row['tvisit']);
|
||||
}
|
||||
$last_tpage = $last_tpage + 1;
|
||||
$last_tvisit = $last_tvisit + 1;
|
||||
|
||||
// Update both tpage and tvisit.
|
||||
$statement = $conn->prepare("UPDATE page_view SET tpage=?,tvisit=? WHERE id ='?'");
|
||||
$statement->execute([$last_tpage,$last_tvisit,$last_id]);
|
||||
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
||||
}
|
||||
} else {
|
||||
// Delete the file and clear data_ip
|
||||
unlink("tmp/temp.tdata");
|
||||
$data_ip = "";
|
||||
|
||||
// New date is created
|
||||
$statement = $conn->prepare("INSERT INTO page_view (date,tpage,tvisit) VALUES ('?','1','1')");
|
||||
$statement->execute([$date]);
|
||||
// Update the IP
|
||||
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
||||
|
||||
}
|
||||
updatePageViews($conn);
|
||||
|
||||
// POST Handler
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
// Check if fields are empty
|
||||
if (empty($_POST["paste_data"])) {
|
||||
if (empty($_POST["paste_data"]) || trim($_POST['paste_data'] === '')) {
|
||||
$error = $lang['empty_paste'];
|
||||
goto OutPut;
|
||||
exit;
|
||||
}
|
||||
|
||||
if (empty($_POST["tags"])) {
|
||||
$error = $lang['notags'];
|
||||
goto OutPut;
|
||||
exit;
|
||||
}
|
||||
|
||||
if (strlen($_POST["title"]) > 70) {
|
||||
$error = $lang['titlelen'];
|
||||
goto OutPut;
|
||||
exit;
|
||||
}
|
||||
// Check if fields are only white space
|
||||
if (trim($_POST["paste_data"]) == '') {
|
||||
$error = $lang['empty_paste'];
|
||||
goto OutPut;
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// Set our limits
|
||||
if (mb_strlen($_POST["paste_data"], '8bit') > 1024 * 1024 * $pastelimit) {
|
||||
|
@ -247,7 +148,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
}
|
||||
|
||||
// Check POST data status
|
||||
if (isset($_POST['title']) And isset($_POST['paste_data'])) {
|
||||
if (isset($_POST['title']) && isset($_POST['paste_data'])) {
|
||||
if ($cap_e == "on" && !isset($_SESSION['username'])) {
|
||||
if ($mode == "reCAPTCHA") {
|
||||
$response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$recaptcha_secretkey."&response=".$_POST['g-recaptcha-response']);
|
||||
|
@ -297,7 +198,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
}
|
||||
$p_encrypt = Trim(htmlspecialchars($_POST['encrypted']));
|
||||
|
||||
if ($p_encrypt == "" || $p_encrypt == null) {
|
||||
if (empty($p_encrypt)) {
|
||||
$p_encrypt = "0";
|
||||
} else {
|
||||
// Encrypt option
|
||||
|
@ -311,61 +212,32 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
$p_member = "Guest";
|
||||
}
|
||||
// Set expiry time
|
||||
switch ($p_expiry) {
|
||||
case '10M':
|
||||
$expires = mktime(date("H"), date("i") + "10", date("s"), date("n"), date("j"), date("Y"));
|
||||
break;
|
||||
case '1H':
|
||||
$expires = mktime(date("H") + "1", date("i"), date("s"), date("n"), date("j"), date("Y"));
|
||||
case '1D':
|
||||
$expires = mktime(date("H"), date("i"), date("s"), date("n"), date("j") + "1", date("Y"));
|
||||
break;
|
||||
case '1W':
|
||||
$expires = mktime(date("H"), date("i"), date("s"), date("n"), date("j") + "7", date("Y"));
|
||||
break;
|
||||
case '2W':
|
||||
$expires = mktime(date("H"), date("i"), date("s"), date("n"), date("j") + "14", date("Y"));
|
||||
break;
|
||||
case '1M':
|
||||
$expires = mktime(date("H"), date("i"), date("s"), date("n") + "1", date("j"), date("Y"));
|
||||
break;
|
||||
case 'self':
|
||||
$expires = "SELF";
|
||||
break;
|
||||
case 'N':
|
||||
$expires = "NULL";
|
||||
break;
|
||||
default:
|
||||
$expires = "NULL";
|
||||
break;
|
||||
}
|
||||
$p_title = mysqli_real_escape_string($con, $p_title);
|
||||
$p_content = mysqli_real_escape_string($con, $p_content);
|
||||
$expires = calculatePasteExpiry($p_expiry);
|
||||
|
||||
$p_date = date('jS F Y h:i:s A');
|
||||
$date = date('jS F Y');
|
||||
$now_time = mktime(date("H"), date("i"), date("s"), date("n"), date("j"), date("Y"));
|
||||
$timeedit = gmmktime(date("H"), date("i"), date("s"), date("n"), date("j"), date("Y"));
|
||||
$p_tagsys = mysqli_real_escape_string($con, $p_tagsys);
|
||||
$p_code = mysqli_real_escape_string($con, $p_code);
|
||||
$p_visible = mysqli_real_escape_string($con, $p_visible);
|
||||
|
||||
// Edit existing paste or create new?
|
||||
if ( isset($_POST['edit'] ) ) {
|
||||
if (isset($_SESSION['username'])) {
|
||||
$edit_paste_id = $_POST['paste_id'];
|
||||
$statement = $conn->prepare("UPDATE pastes SET title='?',content='?',visible='?',code='?',expiry='?',password='?',encrypt='?',member='?',ip='?',tagsys='?',now_time='?' ,timeedit='?' WHERE id = '?'");
|
||||
$statement = $conn->prepare(
|
||||
"UPDATE pastes SET title = ?,content = ?,visible = ?,code=?,expiry=?,password=?,encrypt=?,member=?,ip=?,tagsys=?,now_time=? ,timeedit=? WHERE id = '?'"
|
||||
);
|
||||
|
||||
$statement->execute([$p_title,$p_content,$p_visible,$p_code,$expires,$p_password,$p_encrypt,$p_member,$ip,$p_tagsys,$now_time,$timeedit,$edit_paste_id]);
|
||||
}}
|
||||
else {
|
||||
$statement = $conn->prepare("INSERT INTO pastes (title,content,visible,code,expiry,password,encrypt,member,date,ip,now_time,views,s_date,tagsys) VALUES
|
||||
('?','?','?','?','?','?',?',?','?','?','?','0','?','?')");
|
||||
(?,?,?,?,?,?,?,?,?,?,?,'0',?,?)");
|
||||
$statement->execute([$p_title,$p_content,$p_visible,$p_code,$expires,$p_password,$p_encrypt,$p_member,$p_date,$ip,$now_time,$date,$p_tagsys]);
|
||||
|
||||
}
|
||||
$get_last = $conn->prepare( "SELECT @last_id := MAX(id) FROM pastes");
|
||||
while ($row = $get_last->fetch()) {
|
||||
$paste_id = $row['@last_id := MAX(id)'];
|
||||
}
|
||||
$paste_id = $conn->query('SELECT MAX(id) FROM pastes')->fetch(PDO::FETCH_NUM)[0];
|
||||
$success = $paste_id;
|
||||
|
||||
if ($p_visible == '0') {
|
||||
addToSitemap($paste_id, $priority, $changefreq, $mod_rewrite);
|
||||
}
|
||||
|
|
113
login.php
113
login.php
|
@ -19,7 +19,7 @@ require_once('includes/password.php');
|
|||
session_start();
|
||||
|
||||
// Required functions
|
||||
require_once('config.php');
|
||||
require_once('includes/common.php');
|
||||
require_once('includes/functions.php');
|
||||
require_once('mail/mail.php');
|
||||
|
||||
|
@ -36,29 +36,7 @@ if (isset($_SESSION['token'])) {
|
|||
header("Location: ./");
|
||||
}
|
||||
|
||||
// Database Connection
|
||||
$conn = new PDO(
|
||||
"mysql:host=$db_host;dbname=$db_schema;charset=utf8",
|
||||
$db_user,
|
||||
$db_pass,
|
||||
$db_opts
|
||||
);
|
||||
|
||||
// Get site info
|
||||
$site_info_rows = $conn->query('SELECT * FROM site_info');
|
||||
while ($row = $site_info_rows->fetch()) {
|
||||
$title = Trim($row['title']);
|
||||
$des = Trim($row['des']);
|
||||
$baseurl = Trim($row['baseurl']);
|
||||
$keyword = Trim($row['keyword']);
|
||||
$site_name = Trim($row['site_name']);
|
||||
$email = Trim($row['email']);
|
||||
$twit = Trim($row['twit']);
|
||||
$face = Trim($row['face']);
|
||||
$gplus = Trim($row['gplus']);
|
||||
$ga = Trim($row['ga']);
|
||||
$additional_scripts = Trim($row['additional_scripts']);
|
||||
}
|
||||
|
||||
$admin_mail = $email;
|
||||
$admin_name = $site_name;
|
||||
|
@ -78,92 +56,11 @@ while ($row = $email_info_rows->fetch()) {
|
|||
}
|
||||
$mail_type = $smtp_protocol;
|
||||
|
||||
// Check if IP is banned
|
||||
if ( is_banned($conn, $ip) ) die($lang['banned']); // "You have been banned from ".$site_name;
|
||||
|
||||
// Set theme and language
|
||||
$site_theme_rows = $conn->query('SELECT * FROM interface WHERE id="1"');
|
||||
while ($row = $site_theme_rows->fetch()) {
|
||||
$default_lang = Trim($row['lang']);
|
||||
$default_theme = Trim($row['theme']);
|
||||
}
|
||||
require_once("langs/$default_lang");
|
||||
|
||||
|
||||
// Page title
|
||||
$p_title = $lang['login/register']; //"Login/Register";
|
||||
$p_title = $lang['login/register']; // "Login/Register";
|
||||
|
||||
// Ads
|
||||
$site_ads_rows = $conn->query('SELECT * FROM ads WHERE id="1"');
|
||||
while ($row = $site_ads_rows->fetch()) {
|
||||
$text_ads = Trim($row['text_ads']);
|
||||
$ads_1 = Trim($row['ads_1']);
|
||||
$ads_2 = Trim($row['ads_2']);
|
||||
}
|
||||
updatePageViews($conn);
|
||||
|
||||
// Logout
|
||||
if (isset($_GET['logout'])) {
|
||||
header('Location: ' . $_SERVER['HTTP_REFERER']);
|
||||
unset($_SESSION['token']);
|
||||
unset($_SESSION['oauth_uid']);
|
||||
unset($_SESSION['username']);
|
||||
session_destroy();
|
||||
}
|
||||
|
||||
if (strpos($banned_ip, $ip) !== false) {
|
||||
die($lang['banned']); //"You have been banned from ".$site_name
|
||||
}
|
||||
|
||||
// Page views
|
||||
$site_view_rows = $conn->query("SELECT @last_id := MAX(id) FROM page_view");
|
||||
while ($row = $site_view_rows->fetch()) {
|
||||
$last_id = $row['@last_id := MAX(id)'];
|
||||
}
|
||||
|
||||
while ($row = $site_view_rows->fetch()) {
|
||||
$last_date = $row['date'];
|
||||
}
|
||||
|
||||
if ($last_date == $date) {
|
||||
if (str_contains($data_ip, $ip)) {
|
||||
$statement = $conn->prepare('SELECT * FROM page_view WHERE id = ?');
|
||||
$statement->execute([$last_id]);
|
||||
while ($row = $statement->fetch()) {
|
||||
$last_tpage = Trim($row['tpage']);
|
||||
}
|
||||
$last_tpage = $last_tpage + 1;
|
||||
|
||||
// IP already exists, Update view count
|
||||
$statement = $conn->prepare('UPDATE page_view SET tpage=? WHERE id=?;');
|
||||
$statement->execute([$last_tpage,$last_id]);
|
||||
} else {
|
||||
$statement = $conn->prepare('SELECT * FROM page_view WHERE id = ?');
|
||||
$statement->execute([$last_id]);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$last_tpage = Trim($row['tpage']);
|
||||
$last_tvisit = Trim($row['tvisit']);
|
||||
}
|
||||
$last_tpage = $last_tpage + 1;
|
||||
$last_tvisit = $last_tvisit + 1;
|
||||
|
||||
// Update both tpage and tvisit.
|
||||
$statement = $conn->prepare('UPDATE page_view SET tpage=?,tvisit=? WHERE id = ?');
|
||||
$statement->execute([$last_tpage,$last_tvisit,$last_id]);
|
||||
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
||||
}
|
||||
} else {
|
||||
// Delete the file and clear data_ip
|
||||
unlink("tmp/temp.tdata");
|
||||
$data_ip = "";
|
||||
|
||||
// New date is created
|
||||
$statement = $conn->prepare("INSERT INTO page_view (date,tpage,tvisit) VALUES ('?','1','1')");
|
||||
$statement->execute([$date]);
|
||||
// Update the IP
|
||||
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
||||
|
||||
}
|
||||
if (isset($_GET['resend'])) {
|
||||
if (isset($_POST['email'])) {
|
||||
$email = htmlentities(trim($_POST['email']));
|
||||
|
@ -264,7 +161,7 @@ if (isset($_GET['forgot'])) {
|
|||
}
|
||||
|
||||
}
|
||||
if ($_SERVER['REQUEST_METHOD'] == POST) {
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
// Check if logged in
|
||||
if (isset($_SESSION['token'])) {
|
||||
header("Location: ./");
|
||||
|
@ -274,7 +171,7 @@ if ($_SERVER['REQUEST_METHOD'] == POST) {
|
|||
$username = htmlentities(trim($_POST['username']));
|
||||
$password = $_POST['password'];
|
||||
if ($username != null && $password != null) {
|
||||
$query = $conn->prepare("SELECT * FROM users WHERE username='?'");
|
||||
$query = $conn->prepare("SELECT * FROM users WHERE username=?");
|
||||
$query->execute([$username]);
|
||||
if ($query->fetchColumn() > 0) {
|
||||
// Username found
|
||||
|
|
13
pages.php
13
pages.php
|
@ -133,18 +133,7 @@ if ($last_date == $date) {
|
|||
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM ads WHERE id='1'";
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$text_ads = Trim($row['text_ads']);
|
||||
$ads_1 = Trim($row['ads_1']);
|
||||
$ads_2 = Trim($row['ads_2']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (isset($_GET{'page'})) {
|
||||
if (isset($_GET['page'])) {
|
||||
$page_name = trim($_GET['page']);
|
||||
$page_name = Trim(htmlspecialchars($page_name));
|
||||
$page_name = mysqli_real_escape_string($con, $page_name);
|
||||
|
|
136
paste.php
136
paste.php
|
@ -22,7 +22,7 @@ session_start();
|
|||
header('Content-Type: text/html; charset=utf-8');
|
||||
|
||||
// Required functions
|
||||
require_once('config.php');
|
||||
require_once('includes/common.php');
|
||||
require_once('includes/geshi.php');
|
||||
require_once('includes/functions.php');
|
||||
|
||||
|
@ -48,143 +48,17 @@ if (isset($_GET['id'])) {
|
|||
// Prevent SQLInjection
|
||||
settype($paste_id, 'integer');
|
||||
|
||||
updatePageViews($conn);
|
||||
|
||||
// Database Connection
|
||||
$conn = new PDO(
|
||||
"mysql:host=$db_host;dbname=$db_schema;charset=utf8",
|
||||
$db_user,
|
||||
$db_pass,
|
||||
$db_opts
|
||||
);
|
||||
|
||||
|
||||
// Get site info
|
||||
$site_info_rows = $conn->query('SELECT * FROM site_info');
|
||||
while ($row = $site_info_rows->fetch()) {
|
||||
$title = Trim($row['title']);
|
||||
$des = Trim($row['des']);
|
||||
$baseurl = Trim($row['baseurl']);
|
||||
$keyword = Trim($row['keyword']);
|
||||
$site_name = Trim($row['site_name']);
|
||||
$email = Trim($row['email']);
|
||||
$twit = Trim($row['twit']);
|
||||
$face = Trim($row['face']);
|
||||
$gplus = Trim($row['gplus']);
|
||||
$ga = Trim($row['ga']);
|
||||
$additional_scripts = Trim($row['additional_scripts']);
|
||||
}
|
||||
|
||||
// Set theme and language
|
||||
$site_theme_rows = $conn->query('SELECT * FROM interface WHERE id="1"');
|
||||
while ($row = $site_theme_rows->fetch()) {
|
||||
$default_lang = Trim($row['lang']);
|
||||
$default_theme = Trim($row['theme']);
|
||||
}
|
||||
require_once("langs/$default_lang");
|
||||
|
||||
|
||||
// Check if IP is banned
|
||||
if ( is_banned($conn, $ip) ) die($lang['banned']); // "You have been banned from ".$site_name;
|
||||
|
||||
|
||||
// Current date & user IP
|
||||
$date = date('jS F Y');
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
$data_ip = file_get_contents('tmp/temp.tdata');
|
||||
|
||||
// Ads
|
||||
$site_ads_rows = $conn->query('SELECT * FROM ads WHERE id="1"');
|
||||
while ($row = $site_ads_rows->fetch()) {
|
||||
$text_ads = Trim($row['text_ads']);
|
||||
$ads_1 = Trim($row['ads_1']);
|
||||
$ads_2 = Trim($row['ads_2']);
|
||||
}
|
||||
|
||||
// Logout
|
||||
if (isset($_GET['logout'])) {
|
||||
header('Location: ' . $_SERVER['HTTP_REFERER']);
|
||||
unset($_SESSION['token']);
|
||||
unset($_SESSION['oauth_uid']);
|
||||
unset($_SESSION['username']);
|
||||
session_destroy();
|
||||
}
|
||||
|
||||
// Escape from quotes
|
||||
if (get_magic_quotes_gpc()) {
|
||||
function callback_stripslashes(&$val, $name)
|
||||
{
|
||||
if (get_magic_quotes_gpc())
|
||||
$val = stripslashes($val);
|
||||
}
|
||||
if (count($_GET))
|
||||
array_walk($_GET, 'callback_stripslashes');
|
||||
if (count($_POST))
|
||||
array_walk($_POST, 'callback_stripslashes');
|
||||
if (count($_COOKIE))
|
||||
array_walk($_COOKIE, 'callback_stripslashes');
|
||||
}
|
||||
|
||||
// Page views
|
||||
$site_view_rows = $conn->query("SELECT @last_id := MAX(id) FROM page_view");
|
||||
while ($row = $site_view_rows->fetch()) {
|
||||
$last_id = $row['@last_id := MAX(id)'];
|
||||
}
|
||||
|
||||
$site_view_last = $conn->query("SELECT * FROM page_view WHERE id='?'");
|
||||
$site_view_last->execute([$last_id]);
|
||||
while ($row = $site_view_last->fetch()) {
|
||||
$last_date = $row['date'];
|
||||
}
|
||||
|
||||
if ($last_date == $date) {
|
||||
if (str_contains($data_ip, $ip)) {
|
||||
$statement = $conn->prepare("SELECT * FROM page_view WHERE id ='?'");
|
||||
$statement->execute([$last_id]);
|
||||
while ($row = $statement->fetch()) {
|
||||
$last_tpage = Trim($row['tpage']);
|
||||
}
|
||||
$last_tpage = $last_tpage + 1;
|
||||
|
||||
// IP already exists, Update view count
|
||||
$statement = $conn->prepare("UPDATE page_view SET tpage=? WHERE id='?'");
|
||||
$statement->execute([$last_tpage,$last_id]);
|
||||
} else {
|
||||
$statement = $conn->prepare("SELECT * FROM page_view WHERE id ='?'");
|
||||
$statement->execute([$last_id]);
|
||||
while ($row = $statement->fetch()) {
|
||||
$last_tpage = Trim($row['tpage']);
|
||||
$last_tvisit = Trim($row['tvisit']);
|
||||
}
|
||||
$last_tpage = $last_tpage + 1;
|
||||
$last_tvisit = $last_tvisit + 1;
|
||||
|
||||
// Update both tpage and tvisit.
|
||||
$statement = $conn->prepare("UPDATE page_view SET tpage=?,tvisit=? WHERE id ='?'");
|
||||
$statement->execute([$last_tpage,$last_tvisit,$last_id]);
|
||||
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
||||
}
|
||||
} else {
|
||||
// Delete the file and clear data_ip
|
||||
unlink("tmp/temp.tdata");
|
||||
$data_ip = "";
|
||||
|
||||
// New date is created
|
||||
$statement = $conn->prepare("INSERT INTO page_view (date,tpage,tvisit) VALUES ('?','1','1')");
|
||||
$statement->execute([$date]);
|
||||
// Update the IP
|
||||
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
||||
|
||||
}
|
||||
//Get fav count
|
||||
$get_fav_count = $conn->prepare("SELECT count(f_paste) as total FROM pins WHERE f_paste=?");
|
||||
$get_fav_count->execute([$paste_id]);
|
||||
while ($row = $get_fav_count->fetch()) {
|
||||
while ($row = $get_fav_count->fetch()) {
|
||||
$fav_count = $row['total'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Get paste info
|
||||
|
||||
// Get paste info
|
||||
$get_paste_details = $conn->prepare("SELECT * FROM pastes WHERE id=?");
|
||||
$get_paste_details->execute([$paste_id]);
|
||||
if ($get_paste_details->fetchColumn() > 0) {
|
||||
|
|
12
profile.php
12
profile.php
|
@ -18,7 +18,8 @@ require_once('includes/password.php');
|
|||
|
||||
session_start();
|
||||
|
||||
require_once('config.php');
|
||||
define('IN_PONEPASTE', 1);
|
||||
require_once('includes/common.php');
|
||||
require_once('includes/functions.php');
|
||||
|
||||
// UTF-8
|
||||
|
@ -197,15 +198,6 @@ if ($last_date == $date) {
|
|||
}
|
||||
$total_pastes = getTotalPastes($con, $user_username);
|
||||
|
||||
$query = "SELECT * FROM ads WHERE id='1'";
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$text_ads = Trim($row['text_ads']);
|
||||
$ads_1 = Trim($row['ads_1']);
|
||||
$ads_2 = Trim($row['ads_2']);
|
||||
|
||||
}
|
||||
// Theme
|
||||
require_once('theme/' . $default_theme . '/header.php');
|
||||
require_once('theme/' . $default_theme . '/profile.php');
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
session_start();
|
||||
|
||||
// store session data
|
||||
if (isset($_SESSION['username']))
|
||||
$_SESSION['username'] = $_SESSION['username']; // or if you have any algo.
|
||||
?>
|
53
rules.php
53
rules.php
|
@ -1,64 +1,15 @@
|
|||
<?php
|
||||
session_start();
|
||||
|
||||
require_once('config.php');
|
||||
define('IN_PONEPASTE', 1);
|
||||
require_once ('includes/common.php');
|
||||
require_once('includes/functions.php');
|
||||
|
||||
// UTF-8
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
|
||||
$date = date('jS F Y');
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
$data_ip = file_get_contents('tmp/temp.tdata');
|
||||
$conn = new PDO(
|
||||
"mysql:host=$db_host;dbname=$db_schema;charset=utf8",
|
||||
$db_user,
|
||||
$db_pass,
|
||||
$db_opts
|
||||
);
|
||||
|
||||
$site_info_rows = $conn->query('SELECT * FROM site_info');
|
||||
while ($row = $site_info_rows->fetch()) {
|
||||
$title = Trim($row['title']);
|
||||
$des = Trim($row['des']);
|
||||
$baseurl = Trim($row['baseurl']);
|
||||
$keyword = Trim($row['keyword']);
|
||||
$site_name = Trim($row['site_name']);
|
||||
$email = Trim($row['email']);
|
||||
$twit = Trim($row['twit']);
|
||||
$face = Trim($row['face']);
|
||||
$gplus = Trim($row['gplus']);
|
||||
$ga = Trim($row['ga']);
|
||||
$additional_scripts = Trim($row['additional_scripts']);
|
||||
}
|
||||
|
||||
// Set theme and language
|
||||
$site_theme_rows = $conn->query('SELECT * FROM interface WHERE id="1"');
|
||||
while ($row = $site_theme_rows->fetch()) {
|
||||
$default_lang = Trim($row['lang']);
|
||||
$default_theme = Trim($row['theme']);
|
||||
}
|
||||
require_once("langs/$default_lang");
|
||||
|
||||
|
||||
$p_title = $lang['archive']; // "Pastes Archive";
|
||||
|
||||
// Check if IP is banned
|
||||
if ( is_banned($conn, $ip) ) die($lang['banned']); // "You have been banned from ".$site_name;
|
||||
|
||||
// Site permissions
|
||||
$query = "SELECT * FROM site_permissions where id='1'";
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
// Logout
|
||||
if (isset($_GET['logout'])) {
|
||||
header('Location: ' . $_SERVER['HTTP_REFERER']);
|
||||
unset($_SESSION['token']);
|
||||
unset($_SESSION['oauth_uid']);
|
||||
unset($_SESSION['username']);
|
||||
session_destroy();
|
||||
}
|
||||
|
||||
// Theme
|
||||
require_once('theme/' . $default_theme . '/header.php');
|
||||
require_once('theme/' . $default_theme . '/rules.php');
|
||||
|
|
46495
sitemap.xml
46495
sitemap.xml
File diff suppressed because it is too large
Load diff
|
@ -67,7 +67,12 @@ $(document).ready(function () {
|
|||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php echo $ads_2; ?>
|
||||
|
||||
<?php
|
||||
if (isset($site_ads)) {
|
||||
echo $site_ads['ads_2'];
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php }
|
||||
if ($privatesite == "on") { // Remove sidebar if site is private
|
||||
|
|
|
@ -348,8 +348,8 @@
|
|||
|
||||
<!-- End Panel -->
|
||||
<?php } if ($privatesite == "on") { // Remove sidebar if site is private
|
||||
} else {
|
||||
echo $ads_2;
|
||||
} else if (isset($site_ads)) {
|
||||
echo $site_ads['ads_2'];
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
|
|
@ -206,7 +206,7 @@
|
|||
|
||||
<!-- End Panel -->
|
||||
<?php } if ($privatesite == "on") { // Remove sidebar if site is private
|
||||
} else {
|
||||
echo $ads_2;
|
||||
} elseif (isset($site_ads)) {
|
||||
echo $site_ads['ads_2'];
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -74,10 +74,11 @@
|
|||
<div class="column">
|
||||
</div>
|
||||
<div class="column">
|
||||
<?php if (isset($_SESSION['username'])) { ?>
|
||||
<?php } else { ?>
|
||||
<?php echo $ads_2; ?>
|
||||
<?php } ?>
|
||||
<?php
|
||||
if (isset($site_ads) && !isset($_SESSION['username'])) {
|
||||
echo $site_ads['ads_2'];
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -165,10 +166,11 @@
|
|||
<div class="column">
|
||||
</div>
|
||||
<div class="column">
|
||||
<?php if (isset($_SESSION['username'])) { ?>
|
||||
<?php } else { ?>
|
||||
<?php echo $ads_2; ?>
|
||||
<?php } ?>
|
||||
<?php
|
||||
if (isset($site_ads) && !isset($_SESSION['username'])) {
|
||||
echo $site_ads['ads_2'];
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
|
@ -227,10 +229,11 @@
|
|||
<div class="column">
|
||||
</div>
|
||||
<div class="column">
|
||||
<?php if (isset($_SESSION['username'])) { ?>
|
||||
<?php } else { ?>
|
||||
<?php echo $ads_2; ?>
|
||||
<?php } ?>
|
||||
<?php
|
||||
if (isset($site_ads) && !isset($_SESSION['username'])) {
|
||||
echo $site_ads['ads_2'];
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -257,10 +260,11 @@
|
|||
<div class="column">
|
||||
</div>
|
||||
<div class="column">
|
||||
<?php if (isset($_SESSION['username'])) { ?>
|
||||
<?php } else { ?>
|
||||
<?php echo $ads_2; ?>
|
||||
<?php } ?>
|
||||
<?php
|
||||
if (isset($site_ads) && !isset($_SESSION['username'])) {
|
||||
echo $site_ads['ads_2'];
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -276,10 +280,11 @@
|
|||
<div class="column">
|
||||
</div>
|
||||
<div class="column">
|
||||
<?php if (isset($_SESSION['username'])) { ?>
|
||||
<?php } else { ?>
|
||||
<?php echo $ads_2; ?>
|
||||
<?php } ?>
|
||||
<?php
|
||||
if (isset($site_ads) && !isset($_SESSION['username'])) {
|
||||
echo $site_ads['ads_2'];
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
|
|
@ -329,11 +329,13 @@
|
|||
</nav>
|
||||
</div>
|
||||
<div class="column is-3">
|
||||
<!-- $text_ads -->
|
||||
<?php if (isset($_SESSION['username'])) { ?>
|
||||
<?php } else { ?>
|
||||
<?php echo $text_ads; ?>
|
||||
<?php } ?>
|
||||
<!-- $text_ads -->
|
||||
<?php
|
||||
// don't display ads for logged in users.
|
||||
if (isset($site_ads) && !isset($_SESSION['username'])) {
|
||||
echo $site_ads['text_ads'];
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="column is-4">
|
||||
<!-- ReCaptcha & Captcha -->
|
||||
|
|
|
@ -63,7 +63,11 @@
|
|||
<div class="column">
|
||||
</div>
|
||||
<div class="column">
|
||||
<?php echo $ads_2; ?>
|
||||
<?php
|
||||
if (isset($site_ads)) {
|
||||
echo $site_ads['ads_2'];
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -27,8 +27,11 @@
|
|||
} else {
|
||||
echo '<p class="help is-danger subtitle is-6">' . $lang['notfound'] . '</p>';
|
||||
}
|
||||
|
||||
if (isset($site_ads)) {
|
||||
echo $site_ads['ads_2'];
|
||||
}
|
||||
?>
|
||||
<?php echo $ads_2; ?>
|
||||
</div>
|
||||
<?php require_once('theme/' . $default_theme . '/sidebar.php'); ?>
|
||||
</div>
|
||||
|
|
|
@ -315,7 +315,11 @@ $(document).ready(function () {
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php echo $ads_2; ?>
|
||||
<?php
|
||||
if (isset($site_ads)) {
|
||||
echo $site_ads['ads_2'];
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php require_once('theme/' . $default_theme . '/sidebar.php'); ?>
|
||||
</div>
|
||||
|
|
|
@ -429,7 +429,11 @@ overflow: hidden !important;
|
|||
</div>
|
||||
<br/>
|
||||
</nav>
|
||||
<?php echo $ads_2; ?>
|
||||
<?php
|
||||
if (isset($site_ads)) {
|
||||
echo $site_ads['ads_2'];
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
<?php } ?>
|
||||
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
2a02:c7f:68a4:e800:3d32:d825:bda7:7e94
|
11
user.php
11
user.php
|
@ -14,7 +14,8 @@
|
|||
*/
|
||||
session_start();
|
||||
|
||||
require_once('config.php');
|
||||
define('IN_PONEPASTE', 1);
|
||||
require_once('includes/common.php');
|
||||
require_once('includes/functions.php');
|
||||
|
||||
// UTF-8
|
||||
|
@ -222,13 +223,7 @@ if ($last_date == $date) {
|
|||
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM ads WHERE id='1'";
|
||||
$result = mysqli_query($con, $query);
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$text_ads = Trim($row['text_ads']);
|
||||
$ads_1 = Trim($row['ads_1']);
|
||||
$ads_2 = Trim($row['ads_2']);
|
||||
}
|
||||
|
||||
|
||||
if ( isset($_GET['del']) ) {
|
||||
if ( $_SESSION['token'] ) { // Prevent unauthorized deletes
|
||||
|
|
Loading…
Add table
Reference in a new issue