Location: PHPKode > projects > Philosopher'Stone Personal > pssp/userdel.php
<?php

include('setup.php');
allowed(1, 5);

// Work out which user
$id = get_or_post('id', 'No user specified.', 'userlst.php');

$sc->register('users', array('class' => 'users', 'arguments' => '%db%', 'depends' => 'db'));
$u = $sc->users;
$app_navs = $sc->appnavs;

// Fetch the user
$errors = 0;
$user = $u->get_user_by_id($id);
if ($user === false) {
	emsg('Unable to find the requested user record.');
	$errors++;
}

if ($errors == 0) {
	if ($_POST['delete'] == 'Delete') {
		$u->delete_user_by_id($id);
		smsg("User $id successfully deleted.");
		redirect('userlst.php');
	}
}

$meta['app_navs'] = $app_navs->get();
$meta['mod_navs'] = array(
	array('url' => 'useradd.php', 'txt' => 'Add User'),
	array('url' => 'userlst.php', 'txt' => 'List Users')
);
$meta['file_mtime'] = date('d F Y H:i:s', getlastmod());
$meta['app_title'] = 'Users';
$meta['page_title'] = 'Delete User';
$meta['view_file'] = fullpath('view', 'userdel');
include 'generic.php';
Return current item: Philosopher'Stone Personal