Admin New Ticket

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
steve
Posts: 147
Joined: Tue Mar 27, 2012 9:32 pm

Admin New Ticket

Post by steve »

I want to gray out the name and email field on the admin new_ticket.php page. I want the session variables to continue to populate the name and email field with the logged in use information, but i dont want the user to be able to change it, unless they are an admin.

Any ideas?

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

Re: Admin New Ticket

Post by Klemen »

You can check if the user is an admin with $_SESSION['isadmin']

Code: Select all

if ($_SESSION['isadmin']) 
{
// Do admin stuff
}
else
{
// Do regular user stuff
}

However, note that staff should enter the name of the customer there, not their own name...
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
steve
Posts: 147
Joined: Tue Mar 27, 2012 9:32 pm

Re: Admin New Ticket

Post by steve »

Thank you for your reply,

For this argument, what could i use in the else section so the name and email fields still appear and populate with the current user info, but make in so the user cannot edit the fields?

-Steve
-Steve
steve
Posts: 147
Joined: Tue Mar 27, 2012 9:32 pm

Re: Admin New Ticket

Post by steve »

Figured it out, here is the doe I used.

admin/newticket.php (around line 93)

Code: Select all

	<!-- Contact info -->
	<table border="0" width="100%">
	<tr>
<?php
if ($_SESSION['isadmin'])
{
?>
	<td style="text-align:right" width="150"><?php echo $hesklang['name']; ?>:</td>
	<td width="80%"><input type="text" name="name" size="40" maxlength="30" value="<?php if (isset($_SESSION['as_name'])) {echo stripslashes(hesk_input($_SESSION['as_name']));} ?>" <?php if (in_array('name',$_SESSION['iserror'])) {echo ' class="isError" ';} ?> /></td>
<?php
}
else
{
?>
	<td style="text-align:right" width="150"><?php echo $hesklang['name']; ?>:</td>
	<td width="80%"><input type="text" name="name" size="40" maxlength="30" value="<?php if (isset($_SESSION['as_name'])) {echo stripslashes(hesk_input($_SESSION['as_name']));} ?>" <?php if (in_array('name',$_SESSION['iserror'])) {echo ' class="isError" ';} ?> readonly/></td>
<?PHP
}
?>	


	</tr>
	<tr>
<?php
	if ($_SESSION['isadmin'])
	{
	?>
	<td style="text-align:right" width="150"><?php echo $hesklang['email']; ?>:</td>
	<td width="80%"><input type="text" name="email" size="40" maxlength="50" value="<?php if (isset($_SESSION['as_email'])) {echo stripslashes(hesk_input($_SESSION['as_email']));} ?>" <?php if (in_array('email',$_SESSION['iserror'])) {echo ' class="isError" ';} elseif (in_array('email',$_SESSION['isnotice'])) {echo ' class="isNotice" ';} ?> /></td>
<?php
}
else
{
?>
	<td style="text-align:right" width="150"><?php echo $hesklang['email']; ?>:</td>
	<td width="80%"><input type="text" name="email" size="40" maxlength="50" value="<?php if (isset($_SESSION['as_email'])) {echo stripslashes(hesk_input($_SESSION['as_email']));} ?>" <?php if (in_array('email',$_SESSION['iserror'])) {echo ' class="isError" ';} elseif (in_array('email',$_SESSION['isnotice'])) {echo ' class="isNotice" ';} ?> readonly/></td>
<?php
}
?>
	</tr>
	</table>

	<hr />
-Steve
Post Reply