Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

OSTicket 1.8.12 - Custom Forms that get emailed

Good afternoon,
I am in the middle of moving from 1.6 RC to 1.8.12 on a dev server.
Everything is working perfectly except I am having trouble with some custom forms I created that just take form info and email it to a specific user.
The issue seems to be that it no longer submits to itself, regardless of what I put in the <form> tag, it just goes to index.php when I hit submit.
I even set the action to go to a page, and it still went to index.php.

the custom form uses the following layout.

itsupplies.php

requires /include/client/header.inc.php
requires /include/client/itsupp.inc.php
requires /include/client/footer.inc.php

snippet from /include/client/itsupp.inc.php
<?php
$nameErr = $storeErr = $partIdErr = "";
$name = $store = $partId = "";

if ($_SERVER["REQUEST_METHOD"] == "POST") {
  if (empty($_POST["name"])) {
    $nameErr = "Name is required";
  } else {
    $name = test_input($_POST["name"]);
  }
}

function test_input($data) {
  $data = trim($data);
  $data = stripslashes($data);
  $data = htmlspecialchars($data);
  return $data;
}
?>



<h1>IT Supplies</h1><br />
<h1>Please fill in the form below to request IT Supplies</h1>
<p><font color='red'><b>This page is ONLY for IT Supplies. Please request Office Supplies through the "Request Office Supplies" button.</b></font></p>

<form name="register" method="POST" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<table align="left" cellpadding=2 cellspacing=1 width="800">
    <tr>
        <th width="20%">Full Name:</th>
        <td>
                <input type="text" name="name" size="25" value="<?php echo $name; ?>">
                &nbsp;<font class="error">*&nbsp;<?php echo $nameErr;?></font>
        </td>
    </tr>

Tagged:

Comments

  • Support for the 1.8 branch has ended.  It's really old at this point, and I do not know anyone who is still running it.  Also I'm pretty sure that the Custom Forms feature was introduced in 1.9, so you must be trying to alter the source to implement your own custom form rather than using the ones baked into the product now.  My point is that I'm sorry to say but I do not think that you will gain much traction on this thread due to the version being so outdated.
  • edited November 2016
    ok, I basically just made my own form with a couple input boxes that uses the header/footer from OSTicket so everything looks the same.

    Do you see anything in my PHP that is wrong? or do I just not pursue this?
  • I dont see anything that jumps out at em... but I also have looked at the 1.8 branch in a really long time.
  • honestly, the reason why I am upgrading to 1.8.12 1st is because when I went to 1.9 I had some strange slowness issue when opening/responding to tickets. Looked like the DB was getting locked, something to do with the ost__search table.

    so I tried 1.8.12 and I did not have the issue.

    maybe I will try 1.10 and see what happens.
  • For what it's worth, I found the part that kept redirecting me back to index.php regardless of what was inside of my POST form.

    in client.inc.php


    /******* CSRF Protectin *************/
    // Enforce CSRF protection for POSTS
    if ($_POST  && !$ost->checkCSRFToken()) {
        @header('Location: index.php');
        //just incase redirect fails
        die('Action denied (400)!');
    }


    I remove that portion and my forms work correctly now.

    I will work towards moving to version 1.10 once I get 1.8.12 as our live.

    As always, thanks for taking the time to respond ntozier.
  • Very welcome.  Sorry that I couldnt be more help.
Sign In or Register to comment.