[eluser]fchristant[/eluser]
I'm also using the HTTP Referer. I have a basecontroller class which extends all my controllers. It has this method:
Code:
function pagerefresh() {
// redirects the page to the current page
header('location:'.$_SERVER['HTTP_REFERER']);
flush();
exit();
}
Next I can call $this->pagerefresh() from my controllers. I use this often in combination with a message, for example:
Code:
if ($userid == $imagedata['user_id']) {
$this->session->set_flashdata('pagemessage', "You cannot vote on your own images!");
$this->pagerefresh();
}
Some of my views have this code to display the message:
Code:
<?php
$message = $this->session->flashdata('pagemessage');
if ($message) { ?>
<p class="msg"><?= $message ?></p>
<?php } ?>
I use this mechanism to redirect the user to the current page whilst also displaying a message. I like this because there is no javascript reliance. The HTTP Referer is a dependency, but it is one I have control over, I also rely on it for Cancel buttons.