Page 1 of 1

Back Button Mod

Posted: Mon Dec 17, 2007 10:40 pm
by DC
/*************************************
Title: Back Button Mod
Version: 1.0
Author: DC
Demo: No demo raw code below ...
Download: -
Website: -

Short description:
A php based version of the JS back link in hesk on ticket ID err.
*************************************/

Ok heres a quick code block I came up with for HESK
what this mod does is replaces the JS back button link with a dynamic php version, reason why I felt this was better is for the following reasons ....

A js back with no history does nothing so if you came to the page from your own link or its been deleted your stuck on that page ...

so my mod idea does the fallowing if you came from a prior page it will send you back to that page if you came from a direct link lets say in email or such and get the error ID not found or simular then you will be returned to ticket.php when clicking the back link...

Just made more sense to me.

In inc/common.inc.php

just before the script end you will see a block of code that looks like this.

Code: Select all

<?php echo $error; ?></p>
<p>&nbsp;</p>
<p align="center"><a href="javascript:history.go(-1)"><?php echo $hesklang['back']; ?></a></p>

Replace that block with this ...

Code: Select all

<?php
//DC Back Button Mod 1.0
if ($_SERVER['HTTP_REFERER'] == ''){
$ref_redir = "ticket.php";
}else{
$ref_redir = $_SERVER['HTTP_REFERER'];
}

echo $error; 
?></p>

<p>&nbsp;</p>
<p align="center"><a href="<?=$ref_redir?>"><?php echo $hesklang['back']; ?></a></p>

Feel free to make this better :-)

DC