editcustom.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. $new['Login'] = substr(trim($_POST["login"]), 0, 20);
  8. if (isset($_POST["pass"]) and (strlen(trim($_POST["pass"])) > 0)) {
  9. $new['Pwd'] = md5($_POST["pass"]);
  10. }
  11. $new['readonly'] = $_POST["f_ro"] * 1;
  12. update_record($db_link, "Customers", "id='$id'", $new);
  13. unset($_POST["pass"]);
  14. header("Location: " . $_SERVER["REQUEST_URI"]);
  15. exit;
  16. }
  17. unset($_POST);
  18. print_control_submenu($page_url);
  19. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php");
  20. $customer=get_record($db_link,'Customers',"id=".$id);
  21. ?>
  22. <div id="cont">
  23. <br><b>Пользователь</b><br>
  24. <form name="def" action="editcustom.php?id=<?php echo $id; ?>" method="post">
  25. <input type="hidden" name="id" value=<?php echo $id; ?>>
  26. <table class="data">
  27. <tr>
  28. <td>Login</td>
  29. <td>Password</td>
  30. <td>RO</td>
  31. </tr>
  32. <tr>
  33. <td><input type="text" name="login" value="<?php print $customer['Login']; ?>" size=20></td>
  34. <td><input type="text" name="pass" value="" size=20></td>
  35. <td><?php print_qa_select('f_ro',$customer['readonly']); ?></td>
  36. </tr>
  37. <td colspan=2><input type="submit" name="edituser" value="Save"></td>
  38. </table>
  39. </form>
  40. <?php require_once ($_SERVER['DOCUMENT_ROOT']."/inc/footer.php"); ?>