# Redirect users

\n"; $ret .= LJ::html_hidden(mode => 'submit', ssl => $GET{'ssl'}); $ret .= "\n"; $ret .= "\n"; $ret .= "\n"; $ret .= "
\n"; $ret .= "Redirect to:
\n"; $ret .= "
\n"; $ret .= "Affect entries with numbers strictly less than:
\n"; $ret .= "
\n"; $ret .= "standout?>\n"; $ret .= "\n"; $ret .= "\n"; $ret .= "\n"; $ret .= "standout?>\n"; $ret .= "\n"; return $ret; }; # If POST didn't accur, give out the HTML form. If it did occur, # process data unless (LJ::did_post()) { $body .= $update_form->(); # Redirect from 'from' to 'to' with maxid 'maxid' } elsif ($POST{'mode'} eq 'submit') { # Get $from, $to, $maxid, canonicalize $from and $to. my $from = LJ::canonical_username($POST{'from'}); my $to = LJ::canonical_username($POST{'to'}); my $maxid = $POST{'maxid'}; # If $to not emptry, we're adding a redirect if ($to ne "") { # Check whether maxidx is an integer if($maxid =~ /\d+/){ $maxid=$maxid+0; # Check whether we already have a redirect from $from if (!(LJ::Rewriteuser::get_rewrite($from))){ # We don't have a redirect -- okay, we add it LJ::Rewriteuser::insert_rewrite_hash($from,$to,$maxid); $body = "Success: $from is now redirected to $to with maxid $maxid.
Please restart httpd before setting any oy other redirects."; # We do have redirect already -- do nothing, return error } else {$body = "Error: there already is a redirect for this user. Namely, to: ".(LJ::Rewriteuser::get_rewrite($from));} # maxid is not an integer -- return error } else {$body="Error: maxid must be a number.";} # Okay, $to is empty -- this means we're removing a redirect } else { if (LJ::Rewriteuser::get_rewrite($from)){ LJ::Rewriteuser::delete_rewrite_hash($from); $body="Success: $from is not redirected anywhere from now on.
Please restart httpd before setting any oy other redirects."; } } } return $body; } _code?>
lib: cgi-bin/console.pl, cgi-bin/ljlib.pl </LJDEP> _c?>