> Please try search function with file from attachment. It should print a
> lot of debuging information.
>
> And attachment :-)
Thanks for taking care of this, below the outpot running your search.php:
imap_login(); if ($error!=0){ die ("Error $error"); } if ($admintype==0)
{ $allowed_domains="('1'='1"; $allowed_domains3="('1'='1"; } else
{ $allowed_domains="(a.domain_name='";
$allowed_domains3="(virtual.username='"; for ($i = 0; $i < $cnt; $i++)
{ $row=$result->fetchRow(DB_FETCHMODE_ASSOC, $i);
$allowed_domains.=$row['domain_name']."' OR a.domain_name='";
$allowed_domains3.=$row['domain_name']."' OR virtual.username='"; } }
$query="SELECT * FROM domain a where domain_name LIKE '%$searchstring%' and
$allowed_domains') ORDER BY domain_name"; $query2="SELECT distinct
a.username, a.domain_name FROM virtual as v, accountuser as a where
((v.username LIKE '%$searchstring%') or (v.alias LIKE '%$searchstring%')) and
(v.username=a.username) and $allowed_domains') ORDER BY username";
$query3="SELECT DISTINCT alias, username FROM virtual WHERE (((dest LIKE
'%$searchstring%') OR (alias LIKE '%$searchstring%')) AND (dest <> username)
AND (username <>'') ) AND $allowed_domains3') ORDER BY username";
$result=$handle->query($query); $result2=$handle->query($query2);
$result3=$handle->query($query3); if (DB::isError($result2)) { echo 'Standard
Message: '.$result2->getMessage()." \n"; echo 'Standard Code:'.
$result2->getCode()." \n"; echo 'DBMS/User Message:'.
$result2->getUserInfo()." \n"; echo 'DBMS/Debug Message:'.
$result2->getDebugInfo()." \n"; die (); } $cnt=$result->numRows($result);
$total=$result2->numRows($result2); $total3=$result3->numRows($result3);
##### Show matching Domains first ####### print " "; print " "; print "
"._("Total domains matching").": ".$cnt." "; print " "; print " "; print " ";
print " ". _("action")." "; print " ". _("domainname")." "; if (!
$DOMAIN_AS_PREFIX ) { print " "._("prefix")." "; } print " "._("max
Accounts")." "; print " "._("default quota per user")." "; print " "; $b=0;
for ($c=0;$c <$cnt;$c++){ if ($b==0){ $cssrow="row1"; $b=1; }
else{ $cssrow="row2"; $b=0; } $row=$result->fetchRow($result,
$c,'domain_name'); $domain=$row[0]; print " \n"; print "
\"index.php?action=editdomain&domain=$domain\" ". _("Edit Domain")." \n";
print " \"index.php?action=deletedomain&domain=$domain\" ". _("Delete
Domain")." \n"; print " \"index.php?action=accounts&domain=$domain\" ".
_("accounts")." \n"; print " \"index.php?action=aliases&domain=$domain\"
"._("Aliases")." \n"; print " "; print $domain; print " \n "; if (!
$DOMAIN_AS_PREFIX) { # Print the prefix print $row[1]; print " \n "; } #
Print the maxaccount print $row[2]; print " \n "; # Print the quota print
$row[3]; print " \n \n"; } print " "; print " "; ############ And now show
the users matching the search query ########### print " "._("Total users
matching").": ".$total." "; if (!isset($row_pos)){ $row_pos=0; }
$query="SELECT distinct a.username, a.domain_name FROM virtual as v,
accountuser as a where ((v.username LIKE '%$searchstring%') or (v.alias LIKE
'%$searchstring%')) and (v.username=a.username) and $allowed_domains') ORDER
BY username"; $result=$handle->limitQuery($query,$row_pos,10);
$cnt=$result->numRows($result); print " "._("Displaying from position").": ".
"$row_pos "; $b=0; if ($cnt!=0){ print " "; print " "; print "
\"index.php?action=newaccount&domain=$domain\" "._("Add new account")." ";
print " "; $prev = $row_pos -10; $next = $row_pos +10; if ($row_pos <10)
{ print " \"#\" "._("Previous 10 entries")." "; } else { print "
\"index.php?action=search&domain=$domain&row_pos=$prev&searchstring=$searchstring\"
". _("Previous 10 entries") ." "; } if ($next>$total){ print " \"#\"
"._("Next 10 entries")." "; } else { print "
\"index.php?action=search&domain=$domain&row_pos=$next&searchstring=$searchstring\"
". _("Next 10 entries")." "; } print " "; print " \n"; print " "; print " ";
print " "._("action")." "; print " "._("Email address")." "; print "
"._("Username")." "; print " "._("Quota used")." "; print " "; for ($c=0;$c
<$cnt;$c++){ if ($b==0){ $cssrow="row1"; $b=1; } else{ $cssrow="row2";
$b=0; } $row=$result->fetchRow(DB_FETCHMODE_ASSOC,$c);
$username=$row['username']; $domain=$row['domain_name']; $query2="SELECT *
FROM virtual WHERE username='$username'"; $result2=$handle->query($query2);
$row2=$result2->fetchRow(DB_FETCHMODE_ASSOC, 0); $alias=$row2['alias']; print
"\n "; print "\n
\"index.php?action=editaccount&domain=$domain&username=$username\" "._("Edit
account")." "; print "\n
\"index.php?action=change_password&domain=$domain&username=$username&alias=$alias\"
"._("Change Password")." "; print "\n
\"index.php?action=deleteaccount&domain=$domain&username=$username\"
"._("Delete account")." "; print "\n
\"index.php?action=setquota&domain=$domain&username=$username\" "._("Set
quota")." "; print "\n
\"index.php?action=catch&domain=$domain&username=$username\" "._("Set catch
all")." "; print "\n "; $query2="SELECT * FROM virtual WHERE
username='$username'"; $result2=$handle->query($query2);
$cnt2=$result2->numRows($result2); for ($c2=0;$c2 <$cnt2;$c2++){ # Print All
Emailadresses found for the account
$row=$result2->fetchRow(DB_FETCHMODE_ASSOC, $c2); print $row['alias']." "; }
$query4 = "select * from virtual where alias='" . $username . "'"; $result4 =
$handle->query($query4); $row4 = $result4->fetchRow(DB_FETCHMODE_ASSOC, 0);
if (is_array($row4)){ print " " . _("Forwards") . ": "; $forwards_tmp =
preg_split('|,\s*|', stripslashes($row4['dest'])); $forwards = array(); while
(list(, $forward) = each($forwards_tmp)){ if (strtolower($forward) !=
strtolower($username)){ $forwards[] = htmlspecialchars(trim($forward)); }
else { $forwards[] = " " . htmlspecialchars(trim($forward)) . " "; } } echo
implode(" ", $forwards); } print " \n "; print $username; print " \n "; if
($DOMAIN_AS_PREFIX){ $quota = $cyr_conn->getquota("user/" . $username); }
else { $quota = $cyr_conn->getquota("user." . $username); } if
($quota['used'] != "NOT-SET"){ $q_used = $quota['used']; $q_total =
$quota['qmax']; if (! $q_total == 0){ $q_percent = 100*$q_used/$q_total;
printf ("%d KBytes %s %d KBytes (%.2f%%)", $quota['used'], _("out of"),
$quota['qmax'], $q_percent); } else { print _("Unable to retrieve
quota"); } } else { print _("Quota not set"); } print " \n \n"; } print "\n
\n"; print " \n"; } else{ print "\n"._("No accounts found")."\n "; print " ";
print " \n"; print " \"index.php?action=newaccount&domain=$domain\" "._("Add
new account")." "; print "\n \n"; } ################ And now show the
matching aliases ####################### print " "._("Total aliases
matching").": ".$total3." "; if ($total3 == 0) print _("No aliases found");
else { ?> fetchRow( DB_FETCHMODE_ASSOC, $c); $alias = $row['alias']; $domain
= $row['username']; ?> index.php?action=editalias&alias=
Notice: Undefined variable: alias
in /home/sysadmin/public_html/admin/search.php on line 109
&domain=index.php?action=deletealias&alias=
Notice: Undefined variable: alias
in /home/sysadmin/public_html/admin/search.php on line 110
&domain=limitQuery($query4, 0, 3); $num_dest = $result4->numRows ($result4);
for ($d =0; $d < $num_dest; $d++){ $row2 = $result4->fetchRow
(DB_FETCHMODE_ASSOC, $d); if ($d != 0) { print ", "; } print ($row2
['dest']); } $query5 = "SELECT COUNT( dest ) FROM virtual WHERE alias =
'$alias'"; $num_dests = $handle->getOne($query5); if ($num_dests > 3){ print
", ... "; } ?>
Best wishes
Enrique
--
Dirk Enrique Seiffert
CaribeNet S.A. - Cartagena - Colombia
www.caribenet.com
_______________________________________________
This mailing list is hosted and supported
by bit-heads GmbH | http://www.bit-heads.ch
_______________________________________________
Web-cyradm mailing list
[email protected]
http://www.web-cyradm.org/mailman/listinfo/web-cyradm