Location: PHPKode > projects > DDL CMS > Upload these files to your webspace/topsites/templates/admin_accounts.tpl
<?php
	global $date_format;

$match = urlencode('##Search_Field##=\'##Search_Value##\'');

$defaults['Status'] = array('Approved');
$defaults['Category'] = array('Mixed');
$defaults['Per_Page'] = 20;
$defaults['Order_Field'] = 'Hits In (Raw)';
$defaults['Direction'] = 'DESC';
$defaults['Search_Field'] = 'Title';
$defaults['Search_Type'] = '##Search_Field## LIKE \'%##Search_Value##%\'';

$_POST = array_merge($defaults, $_REQUEST);

$lang =& IniParse("{$GLOBALS['DDIR']}/language");
$rejects =& DirRead("{$GLOBALS['DDIR']}/reject", '^[^.]');

$DB->Connect();

$query = GenerateSearchQuery();

$result = $DB->Query($query);

?>
<?php 
require($GLOBALS['TDIR'] .'/admin_accounts.js');
?>
<?PHP
if( isset($message) )
{
?>
<div id="message">
<?PHP echo $message; ?>
</div>
<br />
<?PHP
}
?>


<div>


<!-- BEGIN SEARCH TABLE -->

<form name="form" action="admin.php" method="post" onSubmit="return checkForm(this);">

<table>
<tr>
<td colspan=2>
<h2>Display Topsites Accounts</b></h2>
</td>
</tr>

<tr>
<td colspan=2>
Select which accounts to display:<br />
</td>
</tr>

<tr>
<td colspan=2>

<?PHP

$statuses = array('Unconfirmed', 'Pending', 'Approved');

foreach($statuses as $status)
{
    echo "<input type=\"checkbox\" name=\"Status[]\" value=\"$status\"" .
         (in_array($status, $_POST['Status']) ? ' checked' : '') .
         "> $status<br />\n";
}

?>
<br>
</td>
</tr>


<tr>
<td colspan=2>
<h2><b>Search and Sorting Options</b></h2>

<!-- <span>
<a href="" onClick="return openWindow('', 'QuickTasks');">[Quick Tasks]</a>
</span> -->
</td>
</tr>

<tr>
<td>
<span>
Search In
</span>
</td>
<td>
<select name="Search_Field">
<?PHP
$search_fields = array('Username' => 'Username',
                       'Email' => 'E-mail',
                       'Site_URL' => 'Site URL',
                       'Title' => 'Site Title',
                       'Notes' => 'Notes');

foreach(range(1,3) as $index)
{
    if( !IsEmptyString($GLOBALS["NAME_FIELD_$index"]) )
    {
        if( strlen($GLOBALS["NAME_FIELD_$index"]) > 20 )
        {
            $GLOBALS["NAME_FIELD_$index"] = trim(substr($GLOBALS["NAME_FIELD_$index"], 0, 17)) . '...';
        }

        $search_fields["Field_$index"] = $GLOBALS["NAME_FIELD_$index"];
    }
}

foreach($search_fields as $field => $name)
{
    echo "<option value=\"$field\"" .
         ($_POST['Search_Field'] == $field ? ' selected' : '') .
         ">$name</option>\n";
}

?>
</select>
</td>
</tr>

<tr>
<td>
<span>
Search Term
</span>
</td>
<td>
<select name="Search_Type">
<?PHP
$search_types = array('##Search_Field## LIKE \'%##Search_Value##%\'' => 'Contains', 
                      '##Search_Field##=\'##Search_Value##\'' => 'Matches',
                      '##Search_Field##>\'##Search_Value##\'' => 'Greater Than',
                      '##Search_Field##<\'##Search_Value##\'' => 'Less Than');

foreach($search_types as $field => $name)
{
    echo "<option value=\"$field\"" .
         ($_POST['Search_Type'] == $field ? ' selected' : '') .
         ">$name</option>\n";
}

?>
</select>
<input type="text" name="Search_Value" size="25" value="<?PHP echo $_POST['Search_Value']; ?>">
</td>
</tr>

<tr>
<td>
<span>
Sort By
</span>
</td>
<td>
<select name="Order_Field">
<?PHP

foreach($GLOBALS['SORTINGS'] as $name => $sql)
{
    echo "<option value=\"$name\"" .
         ($_POST['Order_Field'] == $name ? ' selected' : '') .
         ">$name</option>\n";
}

?>
</select>
</td>
</tr>

<tr>
<td>
<span>
Direction
</span>
</td>
<td>
<select name="Direction">
<?PHP
$sort_direction = array('ASC' => 'Ascending', 'DESC' => 'Descending');

foreach($sort_direction as $field => $name)
{
    echo "<option value=\"$field\"" .
         ($_POST['Direction'] == $field ? ' selected' : '') .
         ">$name</option>\n";
}

?>
</select>
</td>
</tr>


<tr>
<td>
<span>
Per Page
</span>
</td>
<td>
<input type="text" name="Per_Page" size="10" value="<?PHP echo $_POST['Per_Page']; ?>">
</td>
</tr>

<tr>
<td colspan=2>
<input type="submit" value="Display Accounts" onClick="newSearch(document.form);">
</td>
</tr>
</table>

<input type="hidden" name="Page" value="<?PHP echo $_POST['Page']; ?>">
<input type="hidden" name="Run" value="DisplayAccounts">
<!-- END SEARCH TABLE -->


</div>

<br />

<!-- BEGIN RESULTS TABLE -->
<?PHP

if( $_POST['Total'] > 0 )
{

?>
<table>
<tr>
<td>
<?PHP
if( $_POST['Page'] > 0 )
{
?>
<a href="" onClick="return submitForm(-1);">&lt;&lt; Prev</a>
<?PHP
}
?>
</td>
<td>

<input type="button" value="Jump To Page" onClick="jumpPage()">
&nbsp;
<select name="Page_Jump">
<?PHP
$pages = ceil($_POST['Total']/$_POST['Per_Page']);

foreach(range(1,$pages) as $page)
{
    echo "<option value=\"" . ($page - 1) . "\">#$page</option>";
}

?>

</select>

</td>
<td>
<?PHP
if( $_POST['End'] < $_POST['Total'] )
{
?>
<a href="" onClick="return submitForm(1);">Next &gt;&gt;</a>
<?PHP
}
?>
</tr>
</table>

<br />


<table>
<tr>
<td>
<h2>Accounts <?PHP echo $_POST['Start']; ?> - <?PHP echo $_POST['End']; ?> of <?PHP echo $_POST['Total']; ?></h2>
</td>
</tr>



<?PHP
while( $account = $DB->NextRow($result) )
{
    AccountData($account, $lang);
?>
<tr id="<?PHP echo $account['Username']; ?>">
<td style="padding-top:20px">
<input type="checkbox" name="Username[]" value="<?PHP echo $account['Username']; ?>">
<b><?PHP echo $account['Username']; ?></b>
</td>
<td align=right style="padding-top:20px">
<?PHP
if( $account['Status'] == 'Unconfirmed' )
{
?>
<a href="" onClick="return openWin('<?PHP echo $account['Username']; ?>', 'ConfirmAccount', true)">[Confirm]</a>
&nbsp;
<a href="" onClick="return openWin('<?PHP echo $account['Username']; ?>', 'RejectAccount', true)">[Reject]</a>
&nbsp;
<?PHP
}
else if( $account['Status'] == 'Pending' )
{
?>
<a href="" onClick="return openWin('<?PHP echo $account['Username']; ?>', 'ApproveAccount', true)">[Approve]</a>
&nbsp;
<a href="" onClick="return openWin('<?PHP echo $account['Username']; ?>', 'RejectAccount', true)">[Reject]</a>
&nbsp;
<?PHP
}
?>

<a href="" onClick="return openWin('<?PHP echo $account['Username']; ?>', 'DisplayAccountDetails', false);">[Details]</a>
&nbsp;
<a href="" onClick="return openWin('<?PHP echo $account['Username']; ?>', 'DisplayEditAccount', false);">[Edit]</a>
&nbsp;

<?PHP
if( $account['Status'] == 'Approved' )
{
?>
<a href="" onClick="return openWin('<?PHP echo $account['Username']; ?>', 'DisplayCheatTally', false);">[Cheats]</a>
&nbsp;

<?PHP
if( $account['Suspended'] == 1 )
{
?>
<a href="" onClick="return openWin('<?PHP echo $account['Username']; ?>', 'SuspendAccount', true)">[Un-Suspend]</a>
&nbsp;
<?PHP
}
else
{
?>
<a href="" onClick="return openWin('<?PHP echo $account['Username']; ?>', 'SuspendAccount', true)">[Suspend]</a>
&nbsp;
<?PHP
}

if( $account['Locked'] == 1 )
{
?>
<a href="" onClick="return openWin('<?PHP echo $account['Username']; ?>', 'LockAccount', true)">[Un-Lock]</a>
&nbsp;
<?PHP
}
else
{
?>
<a href="" onClick="return openWin('<?PHP echo $account['Username']; ?>', 'LockAccount', true)">[Lock]</a>
&nbsp;
<?PHP
}
}
?>

<a href="" onClick="return openWin('<?PHP echo $account['Username']; ?>', 'DeleteAccount', true);">[Delete]</a>
</td>
</tr>


<tr id="<?PHP echo $account['Username']; ?>">
<td colspan=2>

<table>
<tr>
<td align=right width=100>
<b>Site: </b>
</td>
<td>
<a href="<?PHP echo $account['Site_URL']; ?>" target="_blank"><?PHP echo $account['Title']; ?></a> - <?PHP echo $account['Description']; ?>
</td>
</tr>

<tr>
<td align=right width=100>
<b>E-mail: </b>
</td>
<td>
<a href="mailto:<?PHP echo $account['Email']; ?>"><?PHP echo $account['Email']; ?></a>
</td>
<td align=right width=100>
<b>Sort: </b>
</td>
<td>
<?PHP

if( $_REQUEST['Order_Field'] == 'Signup' )
{
    $account['Sort_Value'] = date($date_format, $account['theDate']);
}

if( is_numeric($account['Sort_Value']) )
{
    $account['Sort_Value'] = FormatNumber($account['Sort_Value'], (strstr($account['Sort_Value'], '.') ? $GLOBALS['DECIMALS'] : 0));
}

echo $account['Sort_Value']; 

?>
</td>
</tr>


<tr>
<td align=right width=100>
<b>In Weight: </b>
</td>
<td>
<?PHP echo $account['In_Weight']; ?>
</td>
<td align=right width=100>
<b>Hits In: </b>
</td>
<td>
<?PHP echo $account['Weighted_In']; ?> [<?PHP echo $account['Current_In']; ?>]
</td>
<td align=right width=100>
<b>Total In: </b>
</td>
<td>
<?PHP echo $account['Weighted_Total_In']; ?> [<?PHP echo $account['Total_In']; ?>]
</td>
</tr>

<tr>
<td align=right>
<b>Out Weight: </b>
</td>
<td>
<?PHP echo $account['Out_Weight']; ?>
</td>
<td align=right>
<b>Hits Out: </b>
</td>
<td>
<?PHP echo $account['Weighted_Out']; ?> [<?PHP echo $account['Current_Out']; ?>]
</td>
<td align=right>
<b>Total Out: </b>
</td>
<td>
<?PHP echo $account['Weighted_Total_Out']; ?> [<?PHP echo $account['Total_Out']; ?>]
</td>
</tr>

<tr>
<td align=right>
<b>Signup: </b>
</td>
<td>
<?PHP echo date($date_format, $account['theDate']); ?>
</td>
<td align=right>
<b>Prod: </b>
</td>
<td>
<?PHP echo $account['Current_Prod']; ?> [<?PHP echo $account['Prod_In']; ?>]
</td>
<td align=right>
<b>Total Prod: </b>
</td>
<td>
<?PHP echo $account['Total_Prod']; ?>  [<?PHP echo $account['Prod_Total_In']; ?>]
</td>
</tr>


<tr>
<td align=right>
<b>Status: </b>
</td>
<td>
<?PHP 

echo $account['Status'];

if( $account['Status'] != 'Approved' )
{
    echo "&nbsp;&nbsp;&nbsp;\n<select name=\"Reject_{$account['Username']}\" id=\"Reject_{$account['Username']}\">\n<option value=\"\">None</option>\n";

    foreach($rejects as $reject)
    {
        echo "<option value=\"$reject\">$reject</option>\n";
    }
 
    echo "</select>";
}

?>

</td>
<td align=right>
<!-- <b>Rating: </b> -->
</td>
<td>
<!-- <?PHP echo $account['Average_Rating']; ?> -->
</td>
</tr>

<?PHP
if( !IsEmptyString($account['Category']) )
{
?>
<tr>
<td align=right>
<b>Category: </b>
</td>
<td>
<?PHP echo $account['Category']; ?>
</td>
</tr>
<?PHP
}

if( !IsEmptyString($GLOBALS['NAME_FIELD_1']) && !IsEmptyString($account['Field_1']) )
{
?>
<tr>
<td>
<b><?PHP echo $GLOBALS['NAME_FIELD_1']; ?>:</b>
</td>
<td>
<?PHP echo $account['Field_1']; ?>
</td>
</tr>
<?PHP
}

if( !IsEmptyString($GLOBALS['NAME_FIELD_2']) && !IsEmptyString($account['Field_2']) )
{
?>
<tr>
<td>
<b><?PHP echo $GLOBALS['NAME_FIELD_2']; ?>:</b>
</td>
<td>
<?PHP echo $account['Field_2']; ?>
</td>
</tr>
<?PHP
}

if( !IsEmptyString($GLOBALS['NAME_FIELD_3']) && !IsEmptyString($account['Field_3']) )
{
?>
<tr>
<td>
<b><?PHP echo $GLOBALS['NAME_FIELD_3']; ?>:</b>
</td>
<td>
<?PHP echo $account['Field_3']; ?>
</td>
</tr>
<?PHP
}

if( !IsEmptyString($account['Notes']) )
{
?>
<tr>
<td>
<b>Notes:</b>
</td>
<td>
<?PHP echo $account['Notes']; ?>
</td>
</tr>
<?PHP
}
?>
</table>


</td>
</tr>
<?PHP
}
?>





</table>

<br />

<table>
<tr>
<td>
<?PHP
if( $_POST['Page'] > 0 )
{
?>
<a href="" onClick="return submitForm(-1);">&lt;&lt; Prev</a>
<?PHP
}
?>
</td>
<td>
<input type="button" value="Check All" onClick="selectAll(this)">
&nbsp;&nbsp;

<select name="Function">
<!--   <option value="DisplayEmailAccount">E-mail Selected Accounts</option> -->
  <option value="ConfirmAccount">Confirm Selected Accounts</option>
  <option value="ApproveAccount">Approve Selected Accounts</option>
  <option value="RejectAccount">Reject Selected Accounts</option>
  <option value="DeleteAccount">Delete Selected Accounts</option>
</select>
<input type="submit" value="Execute" onClick="setRun(document.form.Function[document.form.Function.selectedIndex].value)">

</td>
<td>
<?PHP
if( $_POST['End'] > $_POST['Total'] )
{
?>
<a href="" onClick="return submitForm(1);">Next &gt;&gt;</a>
<?PHP
}
?>
</td>
</tr>
</table>

</form>

<?PHP
}
else
{
?>
<div>
<b>No Accounts Matched Your Search Criteria</b>
</div>
<br />
<?PHP
}
?>
<!-- END RESULTS TABLE -->
<?PHP

$DB->Free($result);
$DB->Disconnect();

?>
Return current item: DDL CMS