Changeset 709 for trunk/cgi-bin
- Timestamp:
- 03/20/15 15:14:06 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/admin.cgi
r708 r709 236 236 } elsif ($webvar{action} eq 'listcust') { 237 237 238 $sth = $ip_dbh->prepare("select custid,name,tech_handle from customers order by custid"); 239 $sth->execute; 240 my @custlist; 241 while (my @data = $sth->fetchrow_array) { 242 my %row = ( 243 custid => $data[0], 244 custname => $data[1], 245 tech => $data[2] 246 ); 247 push @custlist, \%row; 248 } 249 $page->param(custlist => \@custlist); 238 my $clist = $ip_dbh->selectall_arrayref("SELECT custid,name AS custname,tech_handle AS tech ". 239 "FROM customers ORDER BY custid", { Slice => {} } ); 240 $page->param(custlist => $clist); 250 241 251 242 } elsif ($webvar{action} eq 'edcust') { … … 279 270 } elsif ($webvar{action} eq 'updcust') { 280 271 281 $sth = $ip_dbh->prepare("UPDATE customers SET". 282 " name=?, street=?, city=?, province=?, country=?, pocode=?,". 283 " phone=?, tech_handle=?, abuse_handle=?, admin_handle=?, special=?". 284 " WHERE custid=?"); 285 $sth->execute($webvar{name}, $webvar{street}, $webvar{city}, $webvar{province}, 286 $webvar{country}, $webvar{pocode}, $webvar{phone}, $webvar{tech_handle}, 287 $webvar{abuse_handle}, $webvar{admin_handle}, $webvar{special}, $webvar{custid}); 272 if ($webvar{abutton} eq 'Update') { 273 $ip_dbh->do(q( 274 UPDATE customers 275 SET name = ?, street = ?, city = ?, province=?, country=?, pocode=?, 276 phone = ?, tech_handle = ?, abuse_handle = ?, admin_handle = ?, special = ? 277 WHERE custid = ? 278 ), undef, 279 ($webvar{name}, $webvar{street}, $webvar{city}, $webvar{province}, $webvar{country}, $webvar{pocode}, 280 $webvar{phone}, $webvar{tech_handle}, $webvar{abuse_handle}, $webvar{admin_handle}, $webvar{special}, 281 $webvar{custid}) 282 ); 283 $page->param(whatact => "Updated"); 284 } elsif ($webvar{abutton} eq 'Delete (immediate)') { 285 $ip_dbh->do("DELETE FROM customers WHERE custid = ?", undef, $webvar{custid}); 286 $page->param(whatact => "Deleted"); 287 } else { 288 # Your llama is on fire 289 } 290 # Show what we've just either updated or deleted. 291 # Deleted, so that in case of "OOOPS!!", the "special" data can be recovered. 288 292 $page->param( 289 293 custid => $webvar{custid},
Note:
See TracChangeset
for help on using the changeset viewer.