Modernized php
This commit is contained in:
@ -18,13 +18,13 @@ echo "<h1>$I[admintitle]</h1>";
|
||||
print_langs();
|
||||
|
||||
//check password
|
||||
if(!isSet($_POST['pass']) || $_POST['pass']!==ADMINPASS){
|
||||
if(!isset($_POST['pass']) || $_POST['pass']!==ADMINPASS){
|
||||
echo "<form action=\"$_SERVER[SCRIPT_NAME]\" method=\"POST\">";
|
||||
echo "<input type=\"hidden\" name=\"lang\" value=\"$language\">";
|
||||
echo "<p>$I[password]: <input type=\"password\" name=\"pass\" size=\"30\" required></p>";
|
||||
echo "<input type=\"submit\" name=\"action\" value=\"$I[login]\">";
|
||||
echo '</form>';
|
||||
if(isSet($_POST['pass'])){
|
||||
if(isset($_POST['pass'])){
|
||||
echo "<p class=\"red\">$I[wrongpass]</p>";
|
||||
}
|
||||
}else{
|
||||
@ -57,12 +57,12 @@ if(!isSet($_POST['pass']) || $_POST['pass']!==ADMINPASS){
|
||||
echo '</table>';
|
||||
}
|
||||
echo "<p>$I[cloneof]: <input type=\"text\" name=\"original\" size=\"30\"";
|
||||
if(isSet($_REQUEST['original'])){
|
||||
if(isset($_REQUEST['original'])){
|
||||
echo ' value="'.htmlspecialchars($_REQUEST['original']).'"';
|
||||
}
|
||||
echo '></p>';
|
||||
echo "<p>$I[bitcoins]: <input type=\"text\" name=\"btc\" size=\"30\"";
|
||||
if(isSet($_REQUEST['btc'])){
|
||||
if(isset($_REQUEST['btc'])){
|
||||
echo ' value="'.htmlspecialchars($_REQUEST['btc']).'"';
|
||||
}
|
||||
echo '></p>';
|
||||
@ -82,10 +82,10 @@ if(!isSet($_POST['pass']) || $_POST['pass']!==ADMINPASS){
|
||||
}
|
||||
}
|
||||
echo '</textarea></p>';
|
||||
if(isSet($_REQUEST['cat']) && $_REQUEST['cat']<count($categories) && $_REQUEST['cat']>=0){
|
||||
if(isset($_REQUEST['cat']) && $_REQUEST['cat']<count($categories) && $_REQUEST['cat']>=0){
|
||||
$category=$_REQUEST['cat'];
|
||||
}
|
||||
if(!isSet($category)){
|
||||
if(!isset($category)){
|
||||
$category=count($categories);
|
||||
}
|
||||
echo "<p>$I[category]: <select name=\"cat\">";
|
||||
|
@ -53,7 +53,7 @@ function send_html(){
|
||||
$I['lastadded']=>"address!='' AND id NOT IN (SELECT onion_id FROM " . PREFIX . 'phishing)',
|
||||
$I['offline']=>"address!='' AND id NOT IN (SELECT onion_id FROM " . PREFIX . 'phishing) AND timediff>604800'
|
||||
];
|
||||
if(!isSet($_REQUEST['pg'])){
|
||||
if(!isset($_REQUEST['pg'])){
|
||||
$_REQUEST['pg']=1;
|
||||
}else{
|
||||
settype($_REQUEST['pg'], 'int');
|
||||
@ -74,7 +74,7 @@ function send_html(){
|
||||
echo "<h1>$I[title]</h1>";
|
||||
print_langs();
|
||||
echo "<br><small>$I[format]: <a href=\"?format=text\" target=\"_self\">Text</a> <a href=\"?format=json\" target=\"_self\">JSON</a></small>";
|
||||
if(!isSet($db)){
|
||||
if(!isset($db)){
|
||||
echo "<p><b class=\"red\">$I[error]:</b> $I[nodb]</p>";
|
||||
echo '</body></html>';
|
||||
exit;
|
||||
@ -85,7 +85,7 @@ function send_html(){
|
||||
echo "<input type=\"hidden\" name=\"pg\" value=\"$_REQUEST[newpg]\">";
|
||||
echo "<input type=\"hidden\" name=\"lang\" value=\"$language\">";
|
||||
echo "<p><label>$I[addonion]: <br><input name=\"addr\" size=\"30\" placeholder=\"http://$_SERVER[HTTP_HOST]\" value=\"";
|
||||
if(isSet($_REQUEST['addr'])){
|
||||
if(isset($_REQUEST['addr'])){
|
||||
echo htmlspecialchars($_REQUEST['addr']);
|
||||
}
|
||||
echo '" required></label></p>';
|
||||
@ -105,11 +105,11 @@ function send_html(){
|
||||
}
|
||||
}
|
||||
echo '</textarea></label></p>';
|
||||
if(isSet($_REQUEST['cat']) && $_REQUEST['cat']<(count($categories)+count($special)+1) && $_REQUEST['cat']>=0){
|
||||
if(isset($_REQUEST['cat']) && $_REQUEST['cat']<(count($categories)+count($special)+1) && $_REQUEST['cat']>=0){
|
||||
settype($_REQUEST['cat'], 'int');
|
||||
$category=$_REQUEST['cat'];
|
||||
}
|
||||
if(!isSet($category)){
|
||||
if(!isset($category)){
|
||||
$category=count($categories);
|
||||
}
|
||||
echo "<p><label>$I[category]: <select name=\"cat\">";
|
||||
@ -128,7 +128,7 @@ function send_html(){
|
||||
echo "<input type=\"hidden\" name=\"pg\" value=\"$_REQUEST[newpg]\">";
|
||||
echo "<input type=\"hidden\" name=\"lang\" value=\"$language\">";
|
||||
echo "<p><label>$I[search]: <br><input name=\"q\" size=\"30\" placeholder=\"$I[searchterm]\" value=\"";
|
||||
if(isSet($_REQUEST['q'])){
|
||||
if(isset($_REQUEST['q'])){
|
||||
echo htmlspecialchars($_REQUEST['q']);
|
||||
}
|
||||
echo '"></label></p>';
|
||||
@ -234,7 +234,7 @@ function send_html(){
|
||||
if($category==count($categories)){
|
||||
$category=0;
|
||||
}
|
||||
if(!isSet($_POST['desc'])){
|
||||
if(!isset($_POST['desc'])){
|
||||
$desc='';
|
||||
}else{
|
||||
$desc=trim($_POST['desc']);
|
||||
@ -288,6 +288,7 @@ function send_html(){
|
||||
print_phishing_table();
|
||||
}elseif($category>=count($categories)){//show special categories
|
||||
$tmp=$category-count($categories);
|
||||
$query = '';
|
||||
foreach($special as $name=>$query){
|
||||
if($tmp===0) break;
|
||||
--$tmp;
|
||||
@ -320,7 +321,7 @@ function send_html(){
|
||||
echo '</body></html>';
|
||||
}
|
||||
|
||||
function get_table(PDOStatement $stmt, &$numrows=0, $promoted=false){
|
||||
function get_table(PDOStatement $stmt, int &$numrows = 0, bool $promoted = false) : string {
|
||||
global $I, $db, $language;
|
||||
$time=time();
|
||||
$admin_approval = '';
|
||||
@ -417,7 +418,7 @@ function print_phishing_table(){
|
||||
|
||||
function send_text(){
|
||||
global $I, $db;
|
||||
if(!isSet($db)){
|
||||
if(!isset($db)){
|
||||
die("$I[error]: $I[nodb]");
|
||||
}
|
||||
header('Content-Type: text/plain; charset=UTF-8');
|
||||
@ -433,7 +434,7 @@ function send_text(){
|
||||
|
||||
function send_json(){
|
||||
global $I, $db, $categories;
|
||||
if(!isSet($db)){
|
||||
if(!isset($db)){
|
||||
die("$I[error]: $I[nodb]");
|
||||
}
|
||||
header('Content-Type: application/json;');
|
||||
@ -453,7 +454,7 @@ function send_json(){
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
function get_pagination($category, $pages){
|
||||
function get_pagination(int $category, int $pages) : string {
|
||||
global $I, $language;
|
||||
ob_start();
|
||||
echo "<ul class=\"list\"><li>$I[pages]:</li>";
|
||||
@ -520,6 +521,6 @@ function send_captcha(){
|
||||
echo "<input type=\"hidden\" name=\"challenge\" value=\"$randid\"><input type=\"text\" name=\"captcha\" size=\"15\" autocomplete=\"off\"></label></p>";
|
||||
}
|
||||
|
||||
function send_error($msg){
|
||||
function send_error(string $msg){
|
||||
die("<p class=\"red\">$msg</p></div></body></html>");
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ echo "<p>$I[testdesc]</p>";
|
||||
echo "<form action=\"$_SERVER[SCRIPT_NAME]\" method=\"POST\">";
|
||||
echo "<input type=\"hidden\" name=\"lang\" value=\"$language\">";
|
||||
echo "<p>$I[link]: <br><input name=\"addr\" size=\"30\" value=\"";
|
||||
if(isSet($_REQUEST['addr'])){
|
||||
if(isset($_REQUEST['addr'])){
|
||||
echo htmlspecialchars($_REQUEST['addr']);
|
||||
}else{
|
||||
echo "http://$_SERVER[HTTP_HOST]";
|
||||
@ -67,7 +67,7 @@ if(!empty($_REQUEST['addr'])){
|
||||
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
|
||||
$header = substr($content, 0, $header_size);
|
||||
$content = substr($content, $header_size);
|
||||
if(isSet($db)){
|
||||
if(isset($db)){
|
||||
//update entry in database
|
||||
$stmt=$db->prepare('SELECT null FROM ' . PREFIX . 'onions WHERE md5sum=?;');
|
||||
$stmt->execute([$md5]);
|
||||
@ -99,7 +99,7 @@ if(!empty($_REQUEST['addr'])){
|
||||
}
|
||||
echo "<p class=\"green\">$I[testonline]</p>";
|
||||
}else{
|
||||
if(isSet($db)){
|
||||
if(isset($db)){
|
||||
$time=time();
|
||||
$db->prepare('UPDATE ' . PREFIX . 'onions SET lasttest=?, timediff=lasttest-lastup WHERE md5sum=? AND lasttest<?;')->execute([$time, $md5, $time]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user