addproject.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <?php
  2. //namespace app\models;
  3. require_once "doctrine/bootstrap.php";
  4. include 'CheckPoint.php';
  5. include 'CheckPointType.php';
  6. use CheckPoints\CheckPoint;
  7. use CheckPointTypes\CheckPointType;
  8. header("Expires: 0");
  9. header("Content-Type: text/html; charset=utf-8");
  10. session_start();
  11. if (isset($_SESSION['LAST_ACTIVITY']) && (time() - $_SESSION['LAST_ACTIVITY'] > 6000)) {
  12. // last request was more than 30 minutes ago
  13. session_unset(); // unset $_SESSION variable for the run-time
  14. session_destroy(); // destroy session data in storage
  15. }
  16. $_SESSION['LAST_ACTIVITY'] = time(); // update last activity time stamp
  17. $add = 'Login Area';
  18. foreach (array_keys($_REQUEST) as $var) {
  19. ${$var} = $_REQUEST[$var];
  20. }
  21. if ($act == "exit")
  22. {
  23. session_unset();
  24. session_destroy();
  25. session_start();
  26. }
  27. if ($_SESSION['cmdlevel'])
  28. $cmdlevel = $_SESSION['cmdlevel'];
  29. if ($_SESSION['hostid'])
  30. $agent_id = $_SESSION['hostid'];
  31. if ($_SESSION['add'])
  32. $add = $_SESSION['add'];
  33. if ($_SESSION['id'])
  34. $id = $_SESSION['id'];
  35. if ($_SESSION['login'])
  36. $login = $_SESSION['login'];
  37. if ($_SESSION['name'])
  38. $name = $_SESSION['name'];
  39. foreach (array_keys($_SESSION) as $var) {
  40. ${$var} = $_SESSION[$var];
  41. }
  42. include 'functions.php';
  43. include 'auth.php';
  44. $logged_me_in_successfully234 = 0;
  45. $incl = '';
  46. if (!$_SESSION['pass'] && !$_SESSION['login'])
  47. {
  48. $table = 'accounts';
  49. $result=mysqli_query($link, "SELECT id, login, name, cmdlevel FROM $table WHERE login='".$login."' AND password='".md5($pass)."'");
  50. $res1 = mysqli_fetch_array($result);
  51. $cmdlevel = $res1['cmdlevel'];
  52. $name = $res1['name'];
  53. $id = $res1['id'];
  54. if ($cmdlevel == '10')
  55. {
  56. $add = "Head Administrator";
  57. }
  58. else if ($cmdlevel == '1')
  59. {
  60. $add = "Company Administrator";
  61. }
  62. else if ($cmdlevel == '2')
  63. {
  64. $add = "Company Operator";
  65. }
  66. if (mysqli_num_rows($result))
  67. {
  68. $_SESSION['pass']=$pass;
  69. $_SESSION['login']=$login;
  70. $_SESSION['name']=$name;
  71. $_SESSION['add']=$add;
  72. $_SESSION['cmdlevel']=$cmdlevel;
  73. $_SESSION['id']=$id;
  74. $logged_me_in_successfully234 = 1;
  75. }
  76. }
  77. else
  78. $logged_me_in_successfully234 = 1;
  79. $query = mysqli_query($link, "update accounts set last_seen_web =NOW() where id=".$id);
  80. $getincl = GetInclude($act, intval($cmdlevel));
  81. $incl = $getincl[0];
  82. $accnum = $getincl[1];
  83. ?>
  84. <!--<div style="min-width: 960px; height: 100%;">-->
  85. <?php
  86. $mycompany = getCompanyByAccount($id);
  87. if (!isset($companyID))
  88. {
  89. // echo "ses com ".$_SESSION['company'];
  90. if ($_SESSION['company'])
  91. $companyID = $_SESSION['company'];
  92. else
  93. {
  94. $companyID = $mycompany[0];
  95. $_SESSION['company'] = $companyID;
  96. }
  97. }
  98. else
  99. {
  100. $_SESSION['company'] = $companyID;
  101. }
  102. $companyname = getCompanyByID($companyID)[1];
  103. $logged_me_in_successfully234 = 1;
  104. if ((int)$_GET['appMykey'] == 123465) {$logged_me_in_successfully234 = 1;}
  105. $companyID = 3;
  106. $action_num = $_POST['action'];
  107. $activeid = $_POST['activeid'];
  108. if(StartProject($action_num, $activeid)) {
  109. TasksAssign('', true, $assign_id);
  110. }
  111. ?>