[EMAIL PROTECTED] wrote:
I'm running web-cyradm on SLES 9 with register_globals On
in php.ini, may be you should try this and restart the apache.

NO, this very unsecure way!!! Web-cyradm works great with
register_globals=off.

Please try search function with file from attachment. It should print a
lot of debuging information.

And attachment :-)

rgds,
Lukasz


  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 ""; print ""; if (!$DOMAIN_AS_PREFIX ) { print ""; } print ""; print ""; 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 "\n"; print "\n"; print "\n"; print "\n"; print "\n\n\n\n\n"; } print ""; print "
". _("action")."". _("domainname").""._("prefix").""._("max Accounts").""._("default quota per user")."
". _("Edit Domain")."". _("Delete Domain")."". _("accounts").""._("Aliases").""; print $domain; print ""; if (!$DOMAIN_AS_PREFIX) { # Print the prefix print $row[1]; print ""; } # Print the maxaccount print $row[2]; print ""; # Print the quota print $row[3]; 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 ""; $prev = $row_pos -10; $next = $row_pos +10; if ($row_pos<10){ print ""; } else { print ""; } if ($next>$total){ print ""; } else { print ""; } print "
"; print ""._("Add new account").""; print ""._("Previous 10 entries")."". _("Previous 10 entries") .""._("Next 10 entries")."". _("Next 10 entries")."

"; print "

\n"; print ""; print ""; print ""; print ""; print ""; print ""; 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"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n\n\n\n\n"; } print "\n\n"; print "
"._("action").""._("Email address").""._("Username").""._("Quota used")."
"._("Edit account").""._("Change Password").""._("Delete account").""._("Set quota").""._("Set catch all").""; $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 "
"; print $username; print ""; 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"; } else{ print "\n"._("No accounts found")."\n

"; print "

"; print "
\n"; print ""._("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']; ?>
&domain="> &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 ", ... "; } ?>
_______________________________________________
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

Reply via email to