Changeset 11 for trunk/dns.cgi
- Timestamp:
- 09/10/09 15:27:29 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dns.cgi
r10 r11 48 48 # handle login redirect 49 49 if ($webvar{action} && $webvar{action} eq 'login') { 50 # handle user check 51 my $newurl = "http://$ENV{HTTP_HOST}$ENV{REQUEST_URI}?sid=$sid&page=domlist"; 52 print "Status: 302\nLocation: $newurl\n\n"; 53 exit; 50 ##fixme: need to actually do a user/pass check 51 changepage(page => "domlist"); 54 52 } 55 53 … … 98 96 } 99 97 100 domlist();98 listdomains(); 101 99 102 100 } elsif ($webvar{page} eq 'reclist') { … … 151 149 $page->param(grplist => \@grplist); 152 150 151 } elsif ($webvar{page} eq 'deldom') { 152 153 $page->param(id => $webvar{id}); 154 # first pass = confirm y/n (sorta) 155 if (!defined($webvar{del})) { 156 $page->param(del_getconf => 1); 157 $page->param(domain => domainName($dbh,$webvar{id})); 158 # print some neato things? 159 160 # } else { 161 # #whether actually deleting or cancelling we redirect to the domain list, default format 162 163 } elsif ($webvar{del} eq 'ok') { 164 my ($code,$msg) = delDomain($dbh, $webvar{id}); 165 if ($code ne 'OK') { 166 # need to find failure mode 167 $page->param(del_failed => 1); 168 $page->param(errmsg => $msg); 169 } else { 170 # success. go back to the domain list, do not pass "GO" 171 changepage(page => "domlist"); 172 } 173 } else { 174 # cancelled. whee! 175 changepage(page => "domlist"); 176 } 177 153 178 } elsif ($webvar{page} eq 'newrec') { 154 179 print "whee!\n"; … … 214 239 ##fixme: group/parent instead of hardcoded 1 215 240 showdomain('y',1); 216 }217 218 } elsif ($webvar{page} eq 'deldom') {219 220 $page->param(id => $webvar{id});221 # first pass = confirm y/n (sorta)222 if (!defined($webvar{del})) {223 $page->param(del_getconf => 1);224 $page->param(domain => domainName($dbh,$webvar{id}));225 # print some neato things?226 227 # } else {228 # #whether actually deleting or cancelling we redirect to the domain list, default format229 230 } elsif ($webvar{del} eq 'ok') {231 my ($code,$msg) = delDomain($dbh, $webvar{id});232 if ($code ne 'OK') {233 # need to find failure mode234 $page->param(del_failed => 1);235 $page->param(errmsg => $msg);236 } else {237 ##work238 domlist();239 }240 } else {241 # cancelled. whee!242 $page->param(del_failed => 0);243 domlist();244 241 } 245 242 … … 280 277 # hokay, a bit of magic to decide which page we hit. 281 278 if ($code eq 'OK') { 279 # redirect to dns.cgi?etc&page=reclist 280 print $q->redirect(""); 282 281 $page = HTML::Template->new(filename => "$templatedir/reclist.tmpl"); 283 282 showdomain(0,$msg); … … 315 314 316 315 exit 0; 316 317 318 sub changepage { 319 my %params = @_; # think this works the way I want... 320 321 # handle user check 322 my $newurl = "http://$ENV{HTTP_HOST}$ENV{SCRIPT_NAME}?sid=$sid"; 323 foreach (keys %params) { 324 $newurl .= "&$_=$params{$_}"; 325 } 326 327 print "Status: 302\nLocation: $newurl\n\n"; 328 exit; 329 } # end changepage 317 330 318 331 … … 441 454 442 455 443 sub domlist{456 sub listdomains { 444 457 my $sth = $dbh->prepare("select count(*) from domains"); 445 458 $sth->execute; … … 477 490 } 478 491 $page->param(domtable => \@domlist); 479 } # end domlist()492 } # end listdomains()
Note:
See TracChangeset
for help on using the changeset viewer.