mirror of
https://github.com/Neetpone/ponepaste.git
synced 2025-03-12 06:30:07 +01:00
?
I could not resist making that the commit message; this changes what appear to be some find and replace failures to be valid syntax.
This commit is contained in:
parent
6624ffd3cb
commit
c9fe44913a
6 changed files with 31 additions and 24 deletions
12
archive.php
12
archive.php
|
@ -82,7 +82,7 @@ while ($row = $site_view_rows->fetch()) {
|
||||||
$last_id = $row['@last_id := MAX(id)'];
|
$last_id = $row['@last_id := MAX(id)'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$site_view_last = $conn->query("SELECT * FROM page_view WHERE id='?'");
|
$site_view_last = $conn->query("SELECT * FROM page_view WHERE id = ? ");
|
||||||
$site_view_last->execute([$last_id]);
|
$site_view_last->execute([$last_id]);
|
||||||
while ($row = $site_view_last->fetch()) {
|
while ($row = $site_view_last->fetch()) {
|
||||||
$last_date = $row['date'];
|
$last_date = $row['date'];
|
||||||
|
@ -90,7 +90,7 @@ while ($row = $site_view_last->fetch()) {
|
||||||
|
|
||||||
if ($last_date == $date) {
|
if ($last_date == $date) {
|
||||||
if (str_contains($data_ip, $ip)) {
|
if (str_contains($data_ip, $ip)) {
|
||||||
$statement = $conn->prepare("SELECT * FROM page_view WHERE id ='?'");
|
$statement = $conn->prepare("SELECT * FROM page_view WHERE id = ?");
|
||||||
$statement->execute([$last_id]);
|
$statement->execute([$last_id]);
|
||||||
while ($row = $statement->fetch()) {
|
while ($row = $statement->fetch()) {
|
||||||
$last_tpage = Trim($row['tpage']);
|
$last_tpage = Trim($row['tpage']);
|
||||||
|
@ -98,10 +98,10 @@ if ($last_date == $date) {
|
||||||
$last_tpage = $last_tpage + 1;
|
$last_tpage = $last_tpage + 1;
|
||||||
|
|
||||||
// IP already exists, Update view count
|
// IP already exists, Update view count
|
||||||
$statement = $conn->prepare("UPDATE page_view SET tpage=? WHERE id='?'");
|
$statement = $conn->prepare("UPDATE page_view SET tpage=? WHERE id= ?");
|
||||||
$statement->execute([$last_tpage,$last_id]);
|
$statement->execute([$last_tpage,$last_id]);
|
||||||
} else {
|
} else {
|
||||||
$statement = $conn->prepare("SELECT * FROM page_view WHERE id ='?'");
|
$statement = $conn->prepare("SELECT * FROM page_view WHERE id = ?");
|
||||||
$statement->execute([$last_id]);
|
$statement->execute([$last_id]);
|
||||||
while ($row = $statement->fetch()) {
|
while ($row = $statement->fetch()) {
|
||||||
$last_tpage = Trim($row['tpage']);
|
$last_tpage = Trim($row['tpage']);
|
||||||
|
@ -111,7 +111,7 @@ if ($last_date == $date) {
|
||||||
$last_tvisit = $last_tvisit + 1;
|
$last_tvisit = $last_tvisit + 1;
|
||||||
|
|
||||||
// Update both tpage and tvisit.
|
// Update both tpage and tvisit.
|
||||||
$statement = $conn->prepare("UPDATE page_view SET tpage=?,tvisit=? WHERE id ='?'");
|
$statement = $conn->prepare("UPDATE page_view SET tpage=?,tvisit=? WHERE id = ?");
|
||||||
$statement->execute([$last_tpage,$last_tvisit,$last_id]);
|
$statement->execute([$last_tpage,$last_tvisit,$last_id]);
|
||||||
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ if ($last_date == $date) {
|
||||||
$data_ip = "";
|
$data_ip = "";
|
||||||
|
|
||||||
// New date is created
|
// New date is created
|
||||||
$statement = $conn->prepare("INSERT INTO page_view (date,tpage,tvisit) VALUES ('?','1','1')");
|
$statement = $conn->prepare("INSERT INTO page_view (date,tpage,tvisit) VALUES (?,'1','1')");
|
||||||
$statement->execute([$date]);
|
$statement->execute([$date]);
|
||||||
// Update the IP
|
// Update the IP
|
||||||
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
||||||
|
|
|
@ -42,6 +42,14 @@ $db_schema = 'p0nepast3s';
|
||||||
$db_user = 'P0nedbAcc0unt';
|
$db_user = 'P0nedbAcc0unt';
|
||||||
$db_pass = '1NWO6Tp17IFz9lbl';
|
$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 = [
|
$db_opts = [
|
||||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, /* throw a fatal exception on database errors */
|
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 */
|
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'
|
'pastedown_old'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//Cookie
|
//Cookie
|
||||||
?>
|
?>
|
16
index.php
16
index.php
|
@ -153,7 +153,7 @@ while ($row = $site_view_rows->fetch()) {
|
||||||
$last_id = $row['@last_id := MAX(id)'];
|
$last_id = $row['@last_id := MAX(id)'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$site_view_last = $conn->query("SELECT * FROM page_view WHERE id='?'");
|
$site_view_last = $conn->prepare("SELECT * FROM page_view WHERE id = ?");
|
||||||
$site_view_last->execute([$last_id]);
|
$site_view_last->execute([$last_id]);
|
||||||
while ($row = $site_view_last->fetch()) {
|
while ($row = $site_view_last->fetch()) {
|
||||||
$last_date = $row['date'];
|
$last_date = $row['date'];
|
||||||
|
@ -161,7 +161,7 @@ while ($row = $site_view_last->fetch()) {
|
||||||
|
|
||||||
if ($last_date == $date) {
|
if ($last_date == $date) {
|
||||||
if (str_contains($data_ip, $ip)) {
|
if (str_contains($data_ip, $ip)) {
|
||||||
$statement = $conn->prepare("SELECT * FROM page_view WHERE id ='?'");
|
$statement = $conn->prepare("SELECT * FROM page_view WHERE id = ?");
|
||||||
$statement->execute([$last_id]);
|
$statement->execute([$last_id]);
|
||||||
while ($row = $statement->fetch()) {
|
while ($row = $statement->fetch()) {
|
||||||
$last_tpage = Trim($row['tpage']);
|
$last_tpage = Trim($row['tpage']);
|
||||||
|
@ -169,10 +169,10 @@ if ($last_date == $date) {
|
||||||
$last_tpage = $last_tpage + 1;
|
$last_tpage = $last_tpage + 1;
|
||||||
|
|
||||||
// IP already exists, Update view count
|
// IP already exists, Update view count
|
||||||
$statement = $conn->prepare("UPDATE page_view SET tpage=? WHERE id='?'");
|
$statement = $conn->prepare("UPDATE page_view SET tpage=? WHERE id = ?");
|
||||||
$statement->execute([$last_tpage,$last_id]);
|
$statement->execute([$last_tpage,$last_id]);
|
||||||
} else {
|
} else {
|
||||||
$statement = $conn->prepare("SELECT * FROM page_view WHERE id ='?'");
|
$statement = $conn->prepare("SELECT * FROM page_view WHERE id = ?");
|
||||||
$statement->execute([$last_id]);
|
$statement->execute([$last_id]);
|
||||||
while ($row = $statement->fetch()) {
|
while ($row = $statement->fetch()) {
|
||||||
$last_tpage = Trim($row['tpage']);
|
$last_tpage = Trim($row['tpage']);
|
||||||
|
@ -182,7 +182,7 @@ if ($last_date == $date) {
|
||||||
$last_tvisit = $last_tvisit + 1;
|
$last_tvisit = $last_tvisit + 1;
|
||||||
|
|
||||||
// Update both tpage and tvisit.
|
// Update both tpage and tvisit.
|
||||||
$statement = $conn->prepare("UPDATE page_view SET tpage=?,tvisit=? WHERE id ='?'");
|
$statement = $conn->prepare("UPDATE page_view SET tpage = ?, tvisit = ? WHERE id = ?");
|
||||||
$statement->execute([$last_tpage,$last_tvisit,$last_id]);
|
$statement->execute([$last_tpage,$last_tvisit,$last_id]);
|
||||||
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ if ($last_date == $date) {
|
||||||
$data_ip = "";
|
$data_ip = "";
|
||||||
|
|
||||||
// New date is created
|
// New date is created
|
||||||
$statement = $conn->prepare("INSERT INTO page_view (date,tpage,tvisit) VALUES ('?','1','1')");
|
$statement = $conn->prepare("INSERT INTO page_view (date,tpage,tvisit) VALUES (?,'1','1')");
|
||||||
$statement->execute([$date]);
|
$statement->execute([$date]);
|
||||||
// Update the IP
|
// Update the IP
|
||||||
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
||||||
|
@ -337,12 +337,12 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
if ( isset($_POST['edit'] ) ) {
|
if ( isset($_POST['edit'] ) ) {
|
||||||
if (isset($_SESSION['username'])) {
|
if (isset($_SESSION['username'])) {
|
||||||
$edit_paste_id = $_POST['paste_id'];
|
$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]);
|
$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 {
|
else {
|
||||||
$statement = $conn->prepare("INSERT INTO pastes (title,content,visible,code,expiry,password,encrypt,member,date,ip,now_time,views,s_date,tagsys) VALUES
|
$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]);
|
$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]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,7 +158,7 @@ if ($last_date == $date) {
|
||||||
$data_ip = "";
|
$data_ip = "";
|
||||||
|
|
||||||
// New date is created
|
// New date is created
|
||||||
$statement = $conn->prepare("INSERT INTO page_view (date,tpage,tvisit) VALUES ('?','1','1')");
|
$statement = $conn->prepare("INSERT INTO page_view (date,tpage,tvisit) VALUES (?,'1','1')");
|
||||||
$statement->execute([$date]);
|
$statement->execute([$date]);
|
||||||
// Update the IP
|
// Update the IP
|
||||||
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
||||||
|
@ -274,7 +274,7 @@ if ($_SERVER['REQUEST_METHOD'] == POST) {
|
||||||
$username = htmlentities(trim($_POST['username']));
|
$username = htmlentities(trim($_POST['username']));
|
||||||
$password = $_POST['password'];
|
$password = $_POST['password'];
|
||||||
if ($username != null && $password != null) {
|
if ($username != null && $password != null) {
|
||||||
$query = $conn->prepare("SELECT * FROM users WHERE username='?'");
|
$query = $conn->prepare("SELECT * FROM users WHERE username=?");
|
||||||
$query->execute([$username]);
|
$query->execute([$username]);
|
||||||
if ($query->fetchColumn() > 0) {
|
if ($query->fetchColumn() > 0) {
|
||||||
// Username found
|
// Username found
|
||||||
|
|
12
paste.php
12
paste.php
|
@ -115,7 +115,7 @@ while ($row = $site_view_rows->fetch()) {
|
||||||
$last_id = $row['@last_id := MAX(id)'];
|
$last_id = $row['@last_id := MAX(id)'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$site_view_last = $conn->query("SELECT * FROM page_view WHERE id='?'");
|
$site_view_last = $conn->query("SELECT * FROM page_view WHERE id=?");
|
||||||
$site_view_last->execute([$last_id]);
|
$site_view_last->execute([$last_id]);
|
||||||
while ($row = $site_view_last->fetch()) {
|
while ($row = $site_view_last->fetch()) {
|
||||||
$last_date = $row['date'];
|
$last_date = $row['date'];
|
||||||
|
@ -123,7 +123,7 @@ while ($row = $site_view_last->fetch()) {
|
||||||
|
|
||||||
if ($last_date == $date) {
|
if ($last_date == $date) {
|
||||||
if (str_contains($data_ip, $ip)) {
|
if (str_contains($data_ip, $ip)) {
|
||||||
$statement = $conn->prepare("SELECT * FROM page_view WHERE id ='?'");
|
$statement = $conn->prepare("SELECT * FROM page_view WHERE id =?");
|
||||||
$statement->execute([$last_id]);
|
$statement->execute([$last_id]);
|
||||||
while ($row = $statement->fetch()) {
|
while ($row = $statement->fetch()) {
|
||||||
$last_tpage = Trim($row['tpage']);
|
$last_tpage = Trim($row['tpage']);
|
||||||
|
@ -131,10 +131,10 @@ if ($last_date == $date) {
|
||||||
$last_tpage = $last_tpage + 1;
|
$last_tpage = $last_tpage + 1;
|
||||||
|
|
||||||
// IP already exists, Update view count
|
// IP already exists, Update view count
|
||||||
$statement = $conn->prepare("UPDATE page_view SET tpage=? WHERE id='?'");
|
$statement = $conn->prepare("UPDATE page_view SET tpage=? WHERE id=?");
|
||||||
$statement->execute([$last_tpage,$last_id]);
|
$statement->execute([$last_tpage,$last_id]);
|
||||||
} else {
|
} else {
|
||||||
$statement = $conn->prepare("SELECT * FROM page_view WHERE id ='?'");
|
$statement = $conn->prepare("SELECT * FROM page_view WHERE id =?");
|
||||||
$statement->execute([$last_id]);
|
$statement->execute([$last_id]);
|
||||||
while ($row = $statement->fetch()) {
|
while ($row = $statement->fetch()) {
|
||||||
$last_tpage = Trim($row['tpage']);
|
$last_tpage = Trim($row['tpage']);
|
||||||
|
@ -144,7 +144,7 @@ if ($last_date == $date) {
|
||||||
$last_tvisit = $last_tvisit + 1;
|
$last_tvisit = $last_tvisit + 1;
|
||||||
|
|
||||||
// Update both tpage and tvisit.
|
// Update both tpage and tvisit.
|
||||||
$statement = $conn->prepare("UPDATE page_view SET tpage=?,tvisit=? WHERE id ='?'");
|
$statement = $conn->prepare("UPDATE page_view SET tpage=?,tvisit=? WHERE id =?");
|
||||||
$statement->execute([$last_tpage,$last_tvisit,$last_id]);
|
$statement->execute([$last_tpage,$last_tvisit,$last_id]);
|
||||||
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ if ($last_date == $date) {
|
||||||
$data_ip = "";
|
$data_ip = "";
|
||||||
|
|
||||||
// New date is created
|
// New date is created
|
||||||
$statement = $conn->prepare("INSERT INTO page_view (date,tpage,tvisit) VALUES ('?','1','1')");
|
$statement = $conn->prepare("INSERT INTO page_view (date,tpage,tvisit) VALUES (?,'1','1')");
|
||||||
$statement->execute([$date]);
|
$statement->execute([$date]);
|
||||||
// Update the IP
|
// Update the IP
|
||||||
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip);
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
|
|
||||||
2a02:c7f:68a4:e800:3d32:d825:bda7:7e94
|
127.0.0.1
|
Loading…
Add table
Reference in a new issue