how to include php code in custom fields ?

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
timschulte
Posts: 3
Joined: Sat Dec 11, 2010 7:04 am

how to include php code in custom fields ?

Post by timschulte »

Script URL:
Version of script: 2.2
Hosting company: ezhosting.com
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:

$_SERVER['HTTP_REFERER']
REFERER
include

Write your message below:

I'd like to pass some variables to the ticket, such as where they are coming from when they hit the button to create a trouble ticket, so we know where the trouble on the site is occurring without the customer having to enter a page url in a custom field.

I was wondering how I would include the referer in one of the custom fields. When I enter:

<?php echo $_SERVER['HTTP_REFERER']; ?>

in the Options of the custom fields, it simply prints out:

<?php echo $_SERVER['HTTP_REFERER']; ?>

in the custom field, how would I get the script to evaluate the code and not display it ??

I also tried using just

echo $_SERVER['HTTP_REFERER']; without the <?php ?>
$_SERVER['HTTP_REFERER'] and also with just the system variable that I wanted as default

entry in the hesk_settings.inc.php is:

'custom6'=>array('use'=>1,'place'=>0,'type'=>'text','req'=>0,'name'=>'Referer','maxlen'=>255,'value'=>'<?php echo $_SERVER[\'HTTP_REFERER\']; ?>'),

Thanks.

Tim
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: how to include php code in custom fields ?

Post by Klemen »

You might be better of modifying index.php file. Find

Code: Select all

if ($v['use'] && $v['place']==0)
and paste this ABOVE that code:

Code: Select all

if ($k == 'custom6')
{
echo '<input type="hidden" name="custom6" value="'.strip_tags($_SERVER['HTTP_REFERER']).'" />';
continue;
}
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
timschulte
Posts: 3
Joined: Sat Dec 11, 2010 7:04 am

Re: how to include php code in custom fields ?

Post by timschulte »

Thanks that worked like a champ :)

One thing to remember if you don't want the customer to see those variables, then you need to also place that code in the ticket.php so when they pull up a ticket it hides them.

one suggestion for the next version: please put $_SERVER['HTTP_USER_AGENT'] & $_SERVER['HTTP_REFERER']
along with capturing the ip that the end user is coming from.

I have our pages click straight to the add ticket from within the website, that way I can see where they are coming from when they have troubles, the agent code gives me a heads up to what kind of browser and OS they are using and helps with trouble shooting versus asking them what they are using. just my two cents.

Thanks for a great piece of software!

Tim
Post Reply