ljr/obsolete/htdocs/lj-gate/rlj_delete.bml

105 lines
2.9 KiB
Plaintext
Raw Normal View History

2019-02-05 21:49:12 +00:00
<?_info
nocache=>1
_info?>
<?page
title=><?_ml .title _ml?>
body<=
<?h1 Remove LJR -> LJ live export. h1?>
<br/>
<?_code
use strict;
use DBI;
use vars qw(%POST);
# copied from update.bml
if ($LJ::SERVER_DOWN) {
return LJ::server_down_html();
}
my $remote = LJ::get_remote();
# Errors that are unlikely to change between starting
# to compose an entry and submitting it.
if ($remote) {
if ($remote->underage) {
return BML::redirect("$LJ::SITEROOT/agecheck/?s=1");
}
if ($remote->identity) {
return "Non-$LJ::SITENAME users can't post, as they don't actually have journals here.\n";
}
if (! LJ::get_cap($remote, "can_post")) {
return $LJ::MSG_NO_POST || $ML{'.error.cantpost'};
}
}
else {
return "Please login.\n";
}
my $qhost = $LJ::DBINFO{'master'}->{'host'};
my $quser = $LJ::DBINFO{'master'}->{'user'};
my $qpass = $LJ::DBINFO{'master'}->{'pass'};
my $qsock = $LJ::DBINFO{'master'}->{'sock'};
my $qport = $LJ::DBINFO{'master'}->{'port'};
#my $qdb = $LJ::DBINFO{'master'}->{'dbname'};
my $qdb = "prod_ljgate";
my $dbh = DBI->connect(
"DBI:mysql:mysql_socket=$qsock;hostname=$qhost;port=$qport;database=$qdb",
$quser, $qpass,
) || die localtime(time) . ": Can't connect to database\n";
my $sqh;
#ID <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LJR
my $user_id;
#ID <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LiveJournal
my $alien_id;
#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>?
my $mode=$POST{'mode'};
#<23><><EFBFBD><EFBFBD><EFBFBD>
my $ret;
#<23><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...
if ($mode eq "del") {
#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> our_user ID, <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
my $sqh=$dbh->prepare("SELECT userid FROM our_user WHERE our_user=?");
$sqh->execute($remote->{'user'});
$user_id = $sqh->fetchrow_array;
#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> rlj2lj ID <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
$sqh = $dbh->prepare("SELECT alienid FROM rlj2lj WHERE userid=?");
$sqh->execute ($user_id);
$alien_id = $sqh->fetchrow_array;
#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> rlj2lj
$sqh = $dbh->prepare("DELETE FROM rlj2lj WHERE userid=?");
$sqh->execute($user_id);
#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
$sqh = $dbh->prepare("DELETE FROM alien WHERE alienid=?");
$sqh->execute($alien_id);
#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
$sqh = $dbh->prepare("DELETE FROM our_user WHERE userid=?");
$sqh->execute($user_id);
#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
$sqh = $dbh->prepare("DELETE FROM rlj_lj_id WHERE userid=?");
$sqh->execute($user_id);
$ret .= "<br/>Live LJR -> LJ export removed.";
$ret .= "<br/><br/><a href=/lj-gate/>LJ-gate root</a>";
}
#...<2E> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
else {
$ret .= "<form method=\"post\" action=\"rlj_delete.bml\">\n";
$ret .= LJ::html_hidden(mode => 'del');
$ret .= LJ::html_submit('confirm', 'Remove export!');
};
$dbh->disconnect;
return $ret;
_code?>
<=body
page?>