(original) (raw)
#!/usr/bin/perl use CGI::Carp('fatalsToBrowser'); require 'cgi-lib2.pl'; require 'redirect_config.pl'; &ReadParse; use DBI; my dbh=DBI−>connect("DBI:mysql:dbh = DBI->connect ("DBI:mysql:dbh=DBI−>connect("DBI:mysql:database:$host","$user","$pwd")||print "Couldn't connect to database: ".DBI->errstr; statement="SELECTpostidFROMhon3stlypostmetaWHEREmetakey=′artid′ANDmetavalue=′".statement ="SELECT post_id FROM hon3stly_postmeta WHERE meta_key='artid' AND meta_value='".statement="SELECTpostidFROMhon3stlypostmetaWHEREmetakey=′artid′ANDmetavalue=′".in{'ID'}."'"; my sth=sth = sth=dbh->prepare($statement); sth−>execute();mysth->execute(); my sth−>execute();myresult = sth−>fetch();sth->fetch(); sth−>fetch();sth->finish(); my ($post_id) = @$result; statement2="SELECTpostnameFROMhon3stlypostsWHEREID=statement2 ="SELECT post_name FROM hon3stly_posts WHERE ID=statement2="SELECTpostnameFROMhon3stlypostsWHEREID=post_id"; my sth=sth = sth=dbh->prepare($statement2); sth−>execute();mysth->execute(); my sth−>execute();myresult2 = sth−>fetch();sth->fetch(); sth−>fetch();sth->finish(); my ($post_name) = @$result2; redirect="redirect = "redirect="destination_url/$post_id/$post_name"; #print "Content-type: text/html; charset=iso-8859-1\n\n"; #print qq~$destination_url/$post_id/$post_name --- statement2;˜statement2~; statement2;˜dbh->disconnect(); print "Location: $redirect\n\n";