I didnt have much time to play with the WWW-Athenticate, I decided to go another way with javascript prompt get password and verify the password. What do you think of this.
<?php
// read, delete
function destroy($password,$table,$id) {
if ($password == 'passwordgoeshere') {
$r = mysql_query("DELETE FROM {$table} WHERE id={$id}");
$_SESSION['message'] = ($r) ? 'Success!' : 'Failure! =(' ;
header("Location: ?view={$table}&id=1");
exit;
} else {
$_SESSION['message'] = "Not authorized to Destroy a record!";
header("Location: ?view={$table}");
exit;
}
}
<input type='button'
value="Destroy"
class="button"
onClick="f=prompt('Enter password'); if (isset(f)) { window.location.href = '?view=portfolio&id=<?php echo $id; ?>&act=destroy&p='+f; }" />
?>
I ve got so use to ctrl + s that i keep doing it in the browser when i edit my posts and try to save the html page lol