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
Admin New Ticket
Moderator: mkoch227
Re: Admin New Ticket
You can check if the user is an admin with $_SESSION['isadmin']
However, note that staff should enter the name of the customer there, not their own name...
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 
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


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
Re: Admin New Ticket
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
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
Re: Admin New Ticket
Figured it out, here is the doe I used.
admin/newticket.php (around line 93)
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