Files
Testing/mailservices/admin/usermgr/accounts.php
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

170 lines
7.0 KiB
PHP

<?php header('Content-type: text/html; charset=utf-8');
if ( !defined('PATHTOINCLUDES') ) define('PATHTOINCLUDES', $_SERVER["DOCUMENT_ROOT"] . '/mailservices/includes/');
include(PATHTOINCLUDES."base.php");
include(PATHTOINCLUDES."record_set.php");
$_SESSION["user_uri"]="/mailservices/admin/usermgr/accounts.php";
$_SESSION["pagename"]="List Accounts";
$_SESSION["the_section_location"] = "/mailservices/admin/usermgr/accounts.php";
$_SESSION["the_section_container"]="section_content";
$_SESSION["the_tab"]="one";
//connect to db if required
$dconn=dbconnect2();
$em="";
$_SESSION["acct_id"]="";
if(!isset($_SESSION["acct_limit"])) {$_SESSION["acct_limit"]=20;}
if(!isset($_SESSION["acct_offset"])) {$_SESSION["acct_offset"]=0;}
if(!isset($_SESSION["acct_searchstring"])){$_SESSION["acct_searchstring"]="";}
if(isset($_POST["gosearch"])){$_SESSION["acct_offset"]=0;}
if(isset($offset)){$_SESSION["acct_offset"]=$offset;}
if(isset($_POST["limit"])){$_SESSION["acct_limit"]=$_POST["limit"];$_SESSION["acct_offset"]=0;}
$limit=$_SESSION["acct_limit"];
$offset=$_SESSION["acct_offset"];
$conda=" WHERE 1>0";
if(isset($_POST["searchstring"]))
{
$_SESSION["acct_searchstring"]=$_POST["searchstring"];
}
if($_SESSION["acct_searchstring"] != "")
{
$condb=" AND lastname like '".$_SESSION["acct_searchstring"]."%'";
}
else
{
$condb="";
}
$sql="SELECT `users`.`uid`, `users`.`active`, `users`.`firstname`, `users`.`mi`, AES_DECRYPT(`users`.`lastname`,'".$wordgames."') AS lname, AES_DECRYPT(`users`.`email`,'".$wordgames."') AS emailaddress, AES_DECRYPT(`users`.`phone`,'".$wordgames."') AS telephone,`users`.`default_admin` FROM `users` ".$conda.$condb."
LIMIT ".$limit." OFFSET ".$offset;
$result= mysql_query($sql) or $em=$em.mysql_error();
$sql2="SELECT count(`users`.`uid`) AS cuid FROM `users`".$conda.$condb;
$rcount=mysql_query($sql2);
$thecount = mysql_result($rcount,0);
mysql_free_result($rcount);
?>
<div id="usermgr" class="list-container">
<div id="searchform" class="search-form-container" style="background:transparent;border-bottom:1px solid #c0c0c0">
<form
action="javascript:search_accounts('/mailservices/admin/usermgr/accounts.php','section_content');"
method="post" name="frmsearch" id="frmsearch" style="background:transparent;">
<fieldset style="background:transparent;">
<label for="acct_searchstring">Last
Name: </label><input type="text" name="searchstring" id="searchstring"
size="20" class="expand_search"
value="<?php echo $_SESSION["acct_searchstring"];?>"
onfocus="clearinput('search','acct_searchstring');"
onblur="resetinput('search','acct_searchstring');" onkeypress="submitenter()"
/> <label
for="limit" style="padding-left:5px;">Rows:</label><select name="limit" id="limit">
<option value="1"
<?php if($_SESSION["acct_limit"]==1){echo "selected=\"selected\"";} ?>>
1 Row</option>
<option value="5"
<?php if($_SESSION["acct_limit"]==5){echo "selected=\"selected\"";} ?>>
5 Rows</option>
<option value="10"
<?php if($_SESSION["acct_limit"]==10){echo "selected=\"selected\"";} ?>>
10 Rows</option>
<option value="20"
<?php if($_SESSION["acct_limit"]==20){echo "selected=\"selected\"";} ?>>
20 Rows</option>
<option value="50"
<?php if($_SESSION["acct_limit"]==50){echo "selected=\"selected\"";} ?>>
50 Rows</option>
</select> <input type="submit" name="gosearch" id="gosearch" value="Search"
class="redbutton search-btn" />
</fieldset>
</form>
</div>
<?php // end searchform?>
<div id="useraccounts" class="list-wrap">
<form name="frmactive" method="post" action="#">
<fieldset>
<legend>
</legend>
<table width="100%" cellpadding="0" cellspacing="1" id="tb-full"
class="tb-full">
<thead>
<tr>
<th class="th-first">Active</th>
<th>Fullname</th>
<th>Phone</th>
<th nowrap="nowrap">Email Address</th>
<th nowrap="nowrap">Default Admin</th>
<th class="th-last" style="text-align:right;padding-right:3px;"><a href="#" class="redbutton add-record"
onclick="getmenucontent('/mailservices/admin/usermgr/add_user.php','section_content','admin_tabs','three',this.parentNode,'h')">add&nbsp;user</a></th>
</tr>
</thead>
<tbody>
<?php
$rownum=0;
while ($row = mysql_fetch_assoc($result)) {
$rownum=$rownum+1;
if($rownum % 2 != 0){$rc="#ffff99";} else{$rc="#fff";}
echo "<tr style=\"background:".$rc.";\" onmouseover=\"this.style.background='#ccffcc';\" onmouseout=\"this.style.background='".$rc."';\" class=\"trr\" valign=\"top\">";
$checked="";
if($row["active"]=="Y")
{
$checked="checked=\"checked\"";
}
if($row["default_admin"]=="Y")
{
echo "<td nowrap=\"nowrap\" class=\"tdd\" align=\"center\" style=\"text-align:center;color:green;\">&#10003;</td>";
}
else
{
echo "<td nowrap=\"nowrap\" class=\"tdd td-first\" align=\"center\" style=\"text-align:center;\"><input type=\"checkbox\" name=\"active[".$rownum."]\" value=\"Y\" ".$checked." /><input type=\"hidden\" name=\"uid[".$rownum."]\" value=\"".$row["uid"]."\" /></td>";
}
echo "<td nowrap=\"nowrap\" class=\"tdd tdd-first\">".$row["firstname"]." ".$row["lname"]."</td>";
echo "<td nowrap=\"nowrap\" class=\"tdd\">".$row["telephone"]."</td>";
echo "<td nowrap=\"nowrap\" class=\"tdd\"><a href=\"mailto:".$row["emailaddress"]."\">".$row["emailaddress"]."<a></td>";
echo "<td nowrap=\"nowrap\" class=\"tdd\" align=\"center\">".$row["default_admin"]."</td>";
echo "<td align=\"right\" width=\"100%\" class=\"tdd tdd-last\">";
//rights will determine this
echo "<image src=\"/mailservices/images/icons/chat-small.png\" style=\"margin-right:5px;\" /> ";
if($row["default_admin"] == "N")
{
echo "<a href=\"delete_user.php?uid=".$row["uid"]."\" title=\"Delete user account\" class=\"ared\">Delete</a> l ";
}
if($row["default_admin"]=="N")
{
echo '<a href="#" onclick="getmenucontent(\'/mailservices/admin/usermgr/edit_user.php?uid='.$row["uid"].'\',\'section_content\',\'admin_tabs\',\'four\',this.parentNode,\'h\')">Edit</a></td>';
}
elseif($row["default_admin"]=="Y" && $_SESSION["default_admin"]=="Y")
{
echo '<a href="#" onclick="getmenucontent(\'/mailservices/admin/usermgr/edit_user.php?uid='.$row["uid"].'\',\'section_content\',\'admin_tabs\',\'four\',this.parentNode,\'h\')">Edit</a></td>';
}
echo "</tr>";
}
mysql_free_result($result);
if($rownum==0)
{
echo "<tr>";
echo "<td class=\"nrr\" colspan=\"5\">No Records Returned.</td>";
echo "</tr>";
}
?>
</tbody>
</table>
</fieldset>
</form>
</div>
<?php // user accoutns?>
<div class="page-nav">
<div style="float: right;">
<?php recordsetNav($thecount,$_SERVER['PHP_SELF'],$_SESSION['the_section_container'],$offset,$limit,1);?>
</div>
</div>
<div
style="position: absolute; top: 5px; right: 16px; width: 38px; height: 38px;">
<img src="/mailservices/images/icons/system-chat.png" alt="" />
</div>
</div>
<?php // end user manager ?>