companies.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <?php
  2. if (!$logged_me_in_successfully234)
  3. return;
  4. if (empty($cmdlevel))
  5. return;
  6. getForm(0);
  7. //if ($active == 1)
  8. //$dot = "продажи";
  9. //else if ($active == 2)
  10. //$dot = "деактивации";
  11. //if (empty($name) || empty($client) || empty($login) || empty($address))
  12. //getForm(3);
  13. //else
  14. //{
  15. // $agentpass = genPass(10, false);
  16. // $md5 = md5($agentpass);
  17. // $query1 = mysql_query("insert into sell_agents (active, phone, login, client_id, name, email, address, password, skype) values ($active, '$phone','$login', $client, '$name', '$email', '$address', '$md5', '$skype')");
  18. // echo "Точка $dot <neutral>".$name."</neutral> добавлена, пароль: ".$agentpass;
  19. //}
  20. function getForm($errCode)
  21. {
  22. global $id, $active, $companyID, $link;
  23. if ($active == 1 || $active == 10)
  24. $s = "<neutral>Компании</neutral>";
  25. $s.="
  26. <form name='form1' method='post' onsubmit='return emailCheck(this.email.value);'>
  27. Выберите компанию из списка:
  28. <input type='hidden' name='active' value='$active'>
  29. <select onchange='ChangeCompany()' name='companies'>
  30. ";
  31. //$s.="<option></option>";
  32. $query1 = mysqli_query($link,"select id, name from companies where active=1");
  33. while ($res1 = mysqli_fetch_array($query1))
  34. {
  35. $sel = "";
  36. if ($companyID == $res1['id']) $sel = "selected";
  37. if ($res1['name'])
  38. $s.= '<option '.$sel.' value="'.$res1['id'].'">'.$res1['id'].'. '.$res1['name'].'</option>';
  39. }
  40. $s.="</select>";
  41. if (isset($client)){
  42. $s.="
  43. <table>
  44. <tr>
  45. <td width=200>
  46. ";
  47. if($errCode==3) $s.="<span style='font-family:Tahoma, Verdana, Arial, Sans-Serif;font-size:10px;color:#CC0000'>Заполните пустые поля</span><br>";
  48. $s.=
  49. "
  50. Название:
  51. </td>
  52. <td>
  53. </td>
  54. <td><br>
  55. <input type='text' name=name>
  56. </td>
  57. </tr>
  58. <tr>
  59. <td>
  60. Логин:
  61. </td>
  62. <td>
  63. </td>
  64. <td>
  65. <input type='text' name=login>
  66. </td>
  67. </tr>
  68. <tr>
  69. <td>
  70. Адрес:
  71. </td>
  72. <td>
  73. </td>
  74. <td>
  75. <input type='text' name='address'>
  76. </td>
  77. </tr>
  78. <tr>
  79. <td>
  80. Phone*:
  81. </td>
  82. <td>
  83. </td>
  84. <td>
  85. <input type='text' name='phone'>
  86. </td>
  87. </tr>
  88. <tr>
  89. <td>
  90. E-mail*:
  91. </td>
  92. <td>
  93. </td>
  94. <td>
  95. <input type='text' name='email'>
  96. </td>
  97. </tr>
  98. <tr>
  99. <td>
  100. Skype*:
  101. </td>
  102. <td>
  103. </td>
  104. <td>
  105. <input type='text' name='skype'>
  106. </td>
  107. </tr>
  108. <tr>
  109. <td>
  110. </td>
  111. <td>
  112. </td>
  113. <td>
  114. <input type='submit' value='Вход'>
  115. </td>
  116. </tr>
  117. </table>
  118. * - необязательные поля
  119. ";
  120. }
  121. echo $s.'
  122. <br>Или добавьте новую: <input name="New" type="button" id="New" onClick="" value="Создать"> </form>';
  123. }
  124. ?>