"._('Wrong Password!')."
"; } }else{ $msg = ''; $category=count($categories); if(isset($_REQUEST['cat']) && $_REQUEST['cat']"._('Invalid onion address!')."
"; } else { $addr = strtolower( $addr[ 3 ] ); $md5 = md5( $addr, true ); if ( $_POST[ 'action' ] === _('Remove') ) { //remove address from public display $db->prepare( 'UPDATE ' . PREFIX . "onions SET address='', locked=1, approved=-1, timechanged=? WHERE md5sum=?;" )->execute( [ time(), $md5 ] ); $msg .= ""._('Successfully removed onion address!')."
"; } elseif ( $_POST[ 'action' ] === _('Lock') ) { //lock editing $db->prepare( 'UPDATE ' . PREFIX . 'onions SET locked=1, approved=1, timechanged=? WHERE md5sum=?;' )->execute( [ time(), $md5 ] ); $msg .= "role=\"alert\">"._('Successfully locked onion address!')."
"; } elseif ( $_POST[ 'action' ] === _('Re-add') ) { //add onion back, if previously removed $db->prepare( 'UPDATE ' . PREFIX . 'onions SET address=?, locked=1, approved=1, timechanged=? WHERE md5sum=?;' )->execute( [ $addr, time(), $md5 ] ); $msg .= ""._('Successfully re-added onion address!')."
"; } elseif ( $_POST[ 'action' ] === _('Unlock') ) { //unlock editing $db->prepare( 'UPDATE ' . PREFIX . 'onions SET locked=0, approved=1, timechanged=? WHERE md5sum=?;' )->execute( [ time(), $md5 ] ); $msg .= ""._('Successfully unlocked onion address!')."
"; } elseif ( $_POST[ 'action' ] === _('Promote') ) { //promote link for paid time $stmt = $db->prepare( 'SELECT special FROM ' . PREFIX . 'onions WHERE md5sum=?;' ); $stmt->execute( [ $md5 ] ); $specialtime = $stmt->fetch( PDO::FETCH_NUM ); if ( $specialtime[ 0 ] < time() ) { $time = time() + ( ( $_POST[ 'btc' ] / PROMOTEPRICE ) * PROMOTETIME ); } else { $time = $specialtime[ 0 ] + ( ( $_POST[ 'btc' ] / PROMOTEPRICE ) * PROMOTETIME ); } $db->prepare( 'UPDATE ' . PREFIX . 'onions SET special=?, locked=1, approved=1, timechanged=? WHERE md5sum=?;' )->execute( [ $time, time(), $md5 ] ); $msg .= "".sprintf(_('Successfully promoted onion address until %1$s!'), date( 'Y-m-d H:i', $time ))."
"; } elseif ( $_POST[ 'action' ] === _('Un-promote') ) { //remove promoted status $db->prepare( 'UPDATE ' . PREFIX . 'onions SET special=0, timechanged=? WHERE md5sum=?;' )->execute( [ time(), $md5 ] ); $msg .= ""._('Successfully un-promoted onion address!')."
"; } elseif ( $_POST[ 'action' ] === _('Update') ) { //update description $stmt = $db->prepare( 'SELECT * FROM ' . PREFIX . 'onions WHERE md5sum=?;' ); $stmt->execute( [ $md5 ] ); if ( $category === count( $categories ) ) { $category = 0; } if ( ! isset( $_POST[ 'desc' ] ) ) { $desc = ''; } else { $desc = trim( $_POST[ 'desc' ] ); $desc = htmlspecialchars( $desc ); $desc = preg_replace( "/(\r?\n|\r\n?)/", '', $desc ); } if ( ! $stmt->fetch( PDO::FETCH_ASSOC ) ) { //not yet there, add it $stmt = $db->prepare( 'INSERT INTO ' . PREFIX . 'onions (address, description, md5sum, category, timeadded, locked, approved, timechanged) VALUES (?, ?, ?, ?, ?, 1, 1, ?);' ); $stmt->execute( [ $addr, $desc, $md5, $category, time(), time() ] ); $msg .= "
"._('Successfully added onion address!')."
"; } elseif ( $desc != '' ) { //update description+category $stmt = $db->prepare( 'UPDATE ' . PREFIX . 'onions SET description=?, category=?, locked=1, approved=1, timechanged=? WHERE md5sum=?;' ); $stmt->execute( [ $desc, $category, time(), $md5 ] ); $msg .= ""._('Successfully updated description!')."
"; } elseif ( $category != 0 ) { //only update category $stmt = $db->prepare( 'UPDATE ' . PREFIX . 'onions SET category=?, locked=1, approved=1, timechanged=? WHERE md5sum=?;' ); $stmt->execute( [ $category, time(), $md5 ] ); $msg .= ""._('Successfully updated category!')."
"; } else { //no description or category change and already known $msg .= ""._('Thanks, but I already knew this address!')."
"; } } elseif ( $_POST[ 'action' ] === _('Phishing') ) {//mark as phishing clone if ( $_POST[ 'original' ] !== '' && ! preg_match( '~(^(https?://)?([a-z2-7]{55}d)(\.onion(/.*)?)?$)~i', $_POST[ 'original' ], $orig ) ) { $msg .= ""._('Invalid onion address!')."
"; } else { if ( isset( $orig[ 3 ] ) ) { $orig = strtolower( $orig[ 3 ] ); } else { $orig = ''; } if ( $orig !== $addr ) { $stmt = $db->prepare( 'INSERT INTO ' . PREFIX . 'phishing (onion_id, original) VALUES ((SELECT id FROM ' . PREFIX . 'onions WHERE address=?), ?);' ); $stmt->execute( [ $addr, $orig ] ); $stmt = $db->prepare( 'UPDATE ' . PREFIX . 'onions SET locked=1, approved=1, timechanged=? WHERE address=?;' ); $stmt->execute( [ time(), $addr ] ); $msg .= ""._('Successfully added Phishing clone!')."
"; } else { $msg .= ""._('Not added Phishing clone! Phishing and original have the same address.')."
"; } } } elseif ( $_POST[ 'action' ] === _('No phishing') ) { //remove phishing clone status $stmt = $db->prepare( 'DELETE FROM ' . PREFIX . 'phishing WHERE onion_id=(SELECT id FROM ' . PREFIX . 'onions WHERE address=?);' ); $stmt->execute( [ $addr ] ); $stmt = $db->prepare( 'UPDATE ' . PREFIX . 'onions SET locked=1, approved=1, timechanged=? WHERE address=?;' ); $stmt->execute( [ time(), $addr ] ); $msg .= ""._('Successfully removed Phishing clone!')."
"; } elseif ( $_POST[ 'action' ] === _('Reject') ) { //lock editing $db->prepare( 'UPDATE ' . PREFIX . 'onions SET approved=-1, timechanged=? WHERE md5sum=?;' )->execute( [ time(), $md5 ] ); $msg .= ""._('Successfully rejected onion address')."
"; } elseif ( $_POST[ 'action' ] === _('Approve') ) { //lock editing $db->prepare( 'UPDATE ' . PREFIX . 'onions SET approved=1, timechanged=? WHERE md5sum=?;' )->execute( [ time(), $md5 ] ); $msg .= ""._('Successfully approved onion address')."
"; } else { //no specific button was pressed $msg .= ""._('No action taken!')."
"; } } } } $view_mode = $_POST[ 'view_mode' ] ?? 'single'; if(isset($_POST['switch_view_mode'])){ $view_mode = $view_mode === 'single' ? 'multi' : 'single'; } echo ""; echo "'; echo $msg; } ?>