Have Urchin? Have cPanel?
We when deleting an account in cpanel the urchin profile remains. Here is how to get rid of those profiles.

PHP Code:
#!/usr/local/cpanel/3rdparty/bin/php 

<?php 

// path to urchin folder ~ no trailing slash 
$urchin_path "/usr/local/urchin"

// Your access hash key from WHM panel 
$accesshash 'INSERT YOUR ACCESS KEY HASH HERE'




/* Syntax we are using... You can find info on urchin and cpanel sites 

List all urchin profiles - /usr/local/urchin/util/uconf-driver action=list table="profile" 
Remove urchine profile $name - /usr/local/urchin/util/uconf-driver action=delete table="profile" name="$name" 
List all cpanel accounts of $user - $accts = listaccts($host,$user,$accesshash,0); 

*/ 

// cPanel variables 
require '/usr/local/cpanel/Cpanel/Accounting.php.inc'
$host "localhost"
$user "root"



$accts listaccts($host,$user,$accesshash,0); 

// Cycle through array that is returned. The first of each account array contains domain 
foreach($accts as $current_account
    
$ALL_ACCOUNT_DOMAINS[] = $current_account[0]; 


// Get number of records in urchin db 
$urchin_num = `{$urchin_path}/util/uconf-driver action=nrecords table="profile"`; 

$urchin_command "{$urchin_path}/util/uconf-driver action=list table=\"profile\" start=0 n=" trim($urchin_num); 

// Contains all return info 
$urchin_id_strings = `$urchin_command`; 

// Create array based on spaces 
foreach(explode(" "$urchin_id_strings) as $current_value

    
// Look for format of profile names, store in regs 
    
if (ereg("^(name=)\"([^\"]+)\""$current_value$regs)) 
    { 
        
// If current profile is not in cpanel accounts, assume it needs to be removed 
        
if (array_search($regs[2], $ALL_ACCOUNT_DOMAINS) === false
        { 
            
$IDS_TO_REMOVE[] = $regs[2]; 
        } 
    } 


if (!empty(
$IDS_TO_REMOVE)) 

    
// Yes, I know -- we could have done this command earlier. But lets just place it here 
    
foreach($IDS_TO_REMOVE as $current_profile
    { 
        
// Remove current_profile 
        
$result = `{$urchin_path}/util/uconf-driver action=delete table="profile" name="$current_profile"`; 
    } 


// Check new urchin number 
$new_urchin_num = `{$urchin_path}/util/uconf-driver action=nrecords table="profile"`; 

// Echo out how many records have been removed. 
echo "Profiles Removed: " . (trim($urchin_num) - trim($new_urchin_num)) . "\n\n";
Put that in a file called remurchin.php and then run it
Code:
php remurchin.php
[Code originally posted at the cPanel Forums by Patiek]

Taken from MyCPAdmin.com