diff --git a/archive.php b/archive.php index 6ee83c3..bb40904 100644 --- a/archive.php +++ b/archive.php @@ -82,7 +82,7 @@ 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 = $conn->query("SELECT * FROM page_view WHERE id = ? "); $site_view_last->execute([$last_id]); while ($row = $site_view_last->fetch()) { $last_date = $row['date']; @@ -90,7 +90,7 @@ while ($row = $site_view_last->fetch()) { if ($last_date == $date) { 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]); while ($row = $statement->fetch()) { $last_tpage = Trim($row['tpage']); @@ -98,10 +98,10 @@ if ($last_date == $date) { $last_tpage = $last_tpage + 1; // 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]); } else { - $statement = $conn->prepare("SELECT * FROM page_view WHERE id ='?'"); + $statement = $conn->prepare("SELECT * FROM page_view WHERE id = ?"); $statement->execute([$last_id]); while ($row = $statement->fetch()) { $last_tpage = Trim($row['tpage']); @@ -111,7 +111,7 @@ if ($last_date == $date) { $last_tvisit = $last_tvisit + 1; // 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]); file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip); } @@ -121,7 +121,7 @@ if ($last_date == $date) { $data_ip = ""; // 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]); // Update the IP file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip); diff --git a/config.php b/config.php index 39ac226..8503459 100644 --- a/config.php +++ b/config.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 ?> \ No newline at end of file diff --git a/index.php b/index.php index ecbe8ee..7e80876 100644 --- a/index.php +++ b/index.php @@ -153,7 +153,7 @@ 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 = $conn->prepare("SELECT * FROM page_view WHERE id = ?"); $site_view_last->execute([$last_id]); while ($row = $site_view_last->fetch()) { $last_date = $row['date']; @@ -161,7 +161,7 @@ while ($row = $site_view_last->fetch()) { if ($last_date == $date) { 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]); while ($row = $statement->fetch()) { $last_tpage = Trim($row['tpage']); @@ -169,10 +169,10 @@ if ($last_date == $date) { $last_tpage = $last_tpage + 1; // 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]); } else { - $statement = $conn->prepare("SELECT * FROM page_view WHERE id ='?'"); + $statement = $conn->prepare("SELECT * FROM page_view WHERE id = ?"); $statement->execute([$last_id]); while ($row = $statement->fetch()) { $last_tpage = Trim($row['tpage']); @@ -182,7 +182,7 @@ if ($last_date == $date) { $last_tvisit = $last_tvisit + 1; // 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]); file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip); } @@ -192,7 +192,7 @@ if ($last_date == $date) { $data_ip = ""; // 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]); // Update the 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($_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]); } diff --git a/login.php b/login.php index 052a39d..9c4be27 100644 --- a/login.php +++ b/login.php @@ -158,7 +158,7 @@ if ($last_date == $date) { $data_ip = ""; // 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]); // Update the 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'])); $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 diff --git a/paste.php b/paste.php index 27e2476..552f490 100644 --- a/paste.php +++ b/paste.php @@ -115,7 +115,7 @@ 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 = $conn->query("SELECT * FROM page_view WHERE id=?"); $site_view_last->execute([$last_id]); while ($row = $site_view_last->fetch()) { $last_date = $row['date']; @@ -123,7 +123,7 @@ while ($row = $site_view_last->fetch()) { if ($last_date == $date) { 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]); while ($row = $statement->fetch()) { $last_tpage = Trim($row['tpage']); @@ -131,10 +131,10 @@ if ($last_date == $date) { $last_tpage = $last_tpage + 1; // 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]); } else { - $statement = $conn->prepare("SELECT * FROM page_view WHERE id ='?'"); + $statement = $conn->prepare("SELECT * FROM page_view WHERE id =?"); $statement->execute([$last_id]); while ($row = $statement->fetch()) { $last_tpage = Trim($row['tpage']); @@ -144,7 +144,7 @@ if ($last_date == $date) { $last_tvisit = $last_tvisit + 1; // 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]); file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip); } @@ -154,7 +154,7 @@ if ($last_date == $date) { $data_ip = ""; // 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]); // Update the IP file_put_contents('tmp/temp.tdata', $data_ip . "\r\n" . $ip); diff --git a/tmp/temp.tdata b/tmp/temp.tdata index 36e9286..eb4d00c 100644 --- a/tmp/temp.tdata +++ b/tmp/temp.tdata @@ -1,2 +1,2 @@ -2a02:c7f:68a4:e800:3d32:d825:bda7:7e94 \ No newline at end of file +127.0.0.1 \ No newline at end of file