editcustom.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. $new['description'] = substr(trim($_POST["description"]), 0, 100);
  10. if (isset($_POST["pass"]) and (strlen(trim($_POST["pass"])) > 0)) {
  11. $new['password'] = password_hash($_POST["pass"], PASSWORD_BCRYPT);
  12. }
  13. if (isset($_POST["api_key"]) and (strlen(trim($_POST["api_key"])) > 20)) {
  14. $new['api_key'] = $_POST["api_key"];
  15. }
  16. $new['rights'] = $_POST["f_acl"] * 1;
  17. update_record($db_link, "customers", "id='$id'", $new);
  18. unset($_POST["pass"]);
  19. header("Location: " . $_SERVER["REQUEST_URI"]);
  20. exit;
  21. }
  22. unset($_POST);
  23. print_control_submenu($page_url);
  24. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  25. $customer=get_record($db_link,'customers',"id=".$id);
  26. ?>
  27. <div id="cont">
  28. <br><b><?php echo WEB_customer_titles; ?></b><br>
  29. <form name="def" action="editcustom.php?id=<?php echo $id; ?>" method="post">
  30. <input type="hidden" name="id" value=<?php echo $id; ?>>
  31. <table class="data">
  32. <tr>
  33. <td><?php echo WEB_customer_login; ?></td>
  34. <td><input type="text" name="login" value="<?php print $customer['Login']; ?>" size=20></td>
  35. </tr>
  36. <tr>
  37. <td><?php echo WEB_cell_description; ?></td>
  38. <td><input type="text" name="description" value="<?php print $customer['description']; ?>" size=50></td>
  39. </tr>
  40. <tr>
  41. <td><?php echo WEB_customer_password; ?></td>
  42. <td><input type="password" name="pass" value="" size=20></td>
  43. </tr>
  44. <tr>
  45. <td><?php echo WEB_customer_api_key; ?></td>
  46. <td><input type="text" name="api_key" value="<?php print $customer['api_key']; ?>" size=50></td>
  47. </tr>
  48. <tr>
  49. <td><?php echo WEB_customer_mode; ?></td>
  50. <td><?php print_acl_select($db_link,'f_acl',$customer['rights']); ?></td>
  51. </tr>
  52. <tr>
  53. <td colspan=2><input type="submit" name="edituser" value="<?php echo WEB_btn_save; ?>"></td>
  54. </tr>
  55. </table>
  56. </form>
  57. <?php require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php"); ?>