More cleanup, mostly surrounding ads

This commit is contained in:
Floorb 2021-07-10 18:21:03 -04:00
parent a88feadd29
commit ba94c853f1
21 changed files with 127 additions and 560 deletions

View file

@ -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">

View file

@ -29,13 +29,6 @@ $total_untagged = intval($conn->query("SELECT COUNT(*) from pastes WHERE tagsys
updatePageViews($conn);
// 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']);
}
$p_title = $lang['archive']; // "Pastes Archive";

View file

@ -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');

View file

@ -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');

View file

@ -15,6 +15,14 @@ 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');
@ -86,6 +94,18 @@ if ($lang_and_theme) {
$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");
@ -104,3 +124,5 @@ if (isset($_GET['logout'])) {
unset($_SESSION['pic']);
session_destroy();
}
$site_ads = getSiteAds($conn);

View file

@ -69,14 +69,6 @@ header('Content-Type: text/html; charset=utf-8');
$date = date('jS F Y');
$ip = $_SERVER['REMOTE_ADDR'];
// 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"');
while ($row = $site_sitemap_rows->fetch()) {

111
login.php
View file

@ -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: ./");

View file

@ -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);

121
paste.php
View file

@ -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,128 +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();
}
// 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) {

View file

@ -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');

View file

@ -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');

View file

@ -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

View file

@ -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>

View file

@ -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'];
}
?>

View file

@ -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 } ?>

View file

@ -330,10 +330,12 @@
</div>
<div class="column is-3">
<!-- $text_ads -->
<?php if (isset($_SESSION['username'])) { ?>
<?php } else { ?>
<?php echo $text_ads; ?>
<?php } ?>
<?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 -->

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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 } ?>

View file

@ -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