- Timestamp:
- 06/13/16 16:06:41 (8 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r720 r722 4882 4882 return $loglist; 4883 4883 } # end getLogEntries() 4884 4885 4886 ## DNSDB::recSearchCount() 4887 # Get a total count for a global record search 4888 ## DNSDB::recSearch() 4889 # Find records matching the search string 4890 sub recSearch { 4891 my $self = shift; 4892 my $dbh = $self->{dbh}; 4893 4894 my %args = @_; 4895 4896 my $sql = q( 4897 SELECT r.domain_id,d.domain,g1.group_name AS domgroup,r.rdns_id,z.revnet AS revzone,g2.group_name AS 4898 revgroup,r.host,t.name AS rectype,r.val,l.description AS location 4899 FROM records r 4900 LEFT JOIN domains d ON r.domain_id = d.domain_id 4901 LEFT JOIN groups g1 ON d.group_id = g1.group_id 4902 LEFT JOIN revzones z ON r.rdns_id = z.rdns_id 4903 LEFT JOIN groups g2 on z.group_id = g2.group_id 4904 JOIN rectypes t ON r.type = t.val 4905 LEFT JOIN locations l ON r.location = l.location 4906 WHERE r.type <> 6 AND (r.host ~* ? OR r.val ~* ?) 4907 ); 4908 4909 # Limit scope based on group 4910 if ($args{group} != 1) { 4911 my @grouplist; 4912 $self->getChildren($args{group}, \@grouplist); 4913 my $groupset = join(',', $args{group}, @grouplist); 4914 # oh my aching HEAD. there has to be a better way to do conditions on joined tables... 4915 $sql .= "AND ( 4916 (g1.group_id IN ($groupset) AND g2.group_id IN ($groupset)) OR 4917 (g1.group_id IN ($groupset) AND g2.group_id IS NULL) OR 4918 (g1.group_id IS NULL AND g2.group_id IN ($groupset)) 4919 ) 4920 "; 4921 } 4922 4923 my $foo = q( 4924 SELECT r.domain_id,d.domain,g1.group_name AS domgroup,r.rdns_id,z.revnet AS revzone,g2.group_name AS 4925 revgroup,r.host,t.name AS rectype,r.val,l.description AS location 4926 FROM records r 4927 LEFT JOIN domains d on r.domain_id = d.domain_id 4928 LEFT JOIN groups g1 on d.group_id = g1.group_id 4929 LEFT JOIN revzones z on r.rdns_id = z.rdns_id 4930 LEFT JOIN groups g2 on z.group_id = g2.group_id 4931 JOIN rectypes t ON r.type = t.val 4932 LEFT JOIN locations l ON r.location = l.location 4933 WHERE r.type <> 6 AND (r.host ~* 'kings' OR r.val ~* 'kings'); 4934 ); 4935 #ORDER BY record_id 4936 4937 #warn "$sql\n"; 4938 # safety valve. probably need a way to flag this back to the caller. 4939 if (!$args{searchfor} || $args{searchfor} =~ /^.{0,2}$/) { $sql .= "LIMIT 10"; } 4940 4941 #$sql .= "LIMIT 20" if $sql !~ /LIMIT/; 4942 4943 return $dbh->selectall_arrayref($sql, { Slice => {} }, $args{searchfor}, $args{searchfor}) or warn $dbh->errstr; 4944 } # end recSearch() 4884 4945 4885 4946 -
trunk/dns.cgi
r709 r722 1859 1859 DONELOG: ; 1860 1860 1861 } elsif ($webvar{page} eq 'recsearch') { 1862 1863 ##FIXME 1864 ##FIXME Limit scope of search!! 1865 ##FIXME 1866 1867 # my $count = $dnsdb->recSearchCount(searchfor => $webvar{searchfor}); 1868 1869 $page->param(searchfor => $webvar{searchfor}); 1870 my $recset = $dnsdb->recSearch(searchfor => $webvar{searchfor}, group => $logingroup); 1871 $page->param(searchresults => $recset); 1872 1861 1873 } # end $webvar{page} dance 1862 1874 -
trunk/templates/dns.css
r590 r722 36 36 background-color: #F0F0F0; 37 37 } 38 39 /* Alternating row colours, now in CSS */ 40 .altrows > tbody > tr { 41 background-color: #D0E0E0; 42 } 43 .altrows > tbody > tr:nth-child(odd) { 44 background-color: #FFFFFF; 45 } 46 .altrows > tbody > tr:nth-child(even) { 47 background-color: #DDDDDD; 48 } 49 38 50 .container { 39 51 background-color: #FFFFFF; -
trunk/templates/menu.tmpl
r638 r722 31 31 <!-- hmm: <TMPL_VAR NAME=groupname> --> 32 32 <hr /> 33 Find records(s): 34 <form action="<TMPL_VAR NAME=script_self>&page=recsearch" method="POST"> 35 <input name="searchfor" /> 36 <input type="submit" value=" Search " /> 37 </form> 38 <hr /> 33 39 <a href="<TMPL_VAR NAME=script_self>&page=dnsq">DNS Query</a><br /> 34 40 <a href="<TMPL_VAR NAME=script_self>&page=whoisq">WHOIS Query</a><br />
Note:
See TracChangeset
for help on using the changeset viewer.