editcustom.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/auth.php");
  3. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . HTML_LANG . ".php");
  4. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/idfilter.php");
  5. $msg_error = "";
  6. if (isset($_POST["edituser"])) {
  7. global $salt;
  8. $new['Login'] = substr(trim($_POST["login"]), 0, 20);
  9. if (isset($_POST["pass"]) and (strlen(trim($_POST["pass"])) > 0)) {
  10. $new['password'] = password_hash($_POST["pass"], PASSWORD_BCRYPT);
  11. }
  12. if (isset($_POST["api_key"]) and (strlen(trim($_POST["api_key"])) > 20)) {
  13. $new['api_key'] = $_POST["api_key"];
  14. }
  15. $new['readonly'] = $_POST["f_ro"] * 1;
  16. update_record($db_link, "Customers", "id='$id'", $new);
  17. unset($_POST["pass"]);
  18. header("Location: " . $_SERVER["REQUEST_URI"]);
  19. exit;
  20. }
  21. unset($_POST);
  22. print_control_submenu($page_url);
  23. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  24. $customer=get_record($db_link,'Customers',"id=".$id);
  25. ?>
  26. <div id="cont">
  27. <br><b><?php echo WEB_custom_titles; ?></b><br>
  28. <form name="def" action="editcustom.php?id=<?php echo $id; ?>" method="post">
  29. <input type="hidden" name="id" value=<?php echo $id; ?>>
  30. <table class="data">
  31. <tr>
  32. <td><?php echo WEB_custom_login; ?></td>
  33. <td><?php echo WEB_custom_password; ?></td>
  34. <td><?php echo WEB_custom_api_key; ?></td>
  35. <td><?php echo WEB_custom_mode; ?></td>
  36. </tr>
  37. <tr>
  38. <td><input type="text" name="login" value="<?php print $customer['Login']; ?>" size=20></td>
  39. <td><input type="text" name="pass" value="" size=20></td>
  40. <td><input type="text" name="api_key" value="<?php print $customer['api_key']; ?>" size=50></td>
  41. <td><?php print_qa_select('f_ro',$customer['readonly']); ?></td>
  42. </tr>
  43. <td colspan=2><input type="submit" name="edituser" value="<?php echo WEB_btn_save; ?>"></td>
  44. </table>
  45. </form>
  46. <?php require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php"); ?>