PageRenderTime 24ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/branches/assicurazioniesinistri/gui/_Login.php

http://antilophpe.googlecode.com/
PHP | 146 lines | 131 code | 13 blank | 2 comment | 23 complexity | d0f931df39bcd09173cf86550593abc4 MD5 | raw file
Possible License(s): LGPL-2.1, LGPL-3.0, GPL-3.0
  1. <?php
  2. include_once("../config/config.inc.php");
  3. include_once("../include/Design/Design.class.php");
  4. include_once("../include/Date/Date.class.php");
  5. if (isset($_SESSION['User'])){
  6. header('Location:_LoginOperations.php?operation=logout');
  7. exit;
  8. }
  9. $Design = new Design();
  10. $Design->addJs(array('../js/jquery/jquery.min.js'));
  11. $Design->setBodyTag('
  12. <body style="background-image:none;">');
  13. $Design->privateHtmlOpen();
  14. if (stristr($_SERVER['HTTP_USER_AGENT'], "Mozilla") && stristr($_SERVER['HTTP_USER_AGENT'], "compatible")){
  15. // do nothing
  16. }
  17. else {
  18. echo '
  19. <script type="text/javascript">
  20. <!--
  21. function submitLoginForm(formId){
  22. if ($(\'#User__userName\').val()==\'\')
  23. alert(\'Attenzione! Inserire uno username valido.\');
  24. else
  25. $(\'#\'+formId).submit();
  26. return false;
  27. }
  28. function submitByEnter(formId, e) {
  29. var keycode;
  30. if (window.event) keycode = window.event.keyCode;
  31. else if (e) keycode = e.which;
  32. else return true;
  33. if (keycode == 13){
  34. submitLoginForm(formId);
  35. return false;
  36. }
  37. else
  38. return true;
  39. }
  40. //-->
  41. </script>';
  42. }
  43. echo '
  44. <br/><br/><br/><br/>
  45. <div id="login_div" class="form_div">';
  46. if (stristr($_SERVER['HTTP_USER_AGENT'], "Mozilla") && stristr($_SERVER['HTTP_USER_AGENT'], "compatible")){
  47. echo '
  48. <form action="_LoginOperations.php" method="post" name="form" id="form_Login">';
  49. }
  50. else
  51. echo '
  52. <form action="_LoginOperations.php" method="post" name="form" id="form_Login" onkeypress="submitByEnter(\'form_Login\', event)">';
  53. echo '
  54. <input type="hidden" name="operation" value="login">
  55. <div id="login_label">
  56. Login
  57. </div>
  58. <div class="align_right">
  59. <label for="User__userName">Username</label>&nbsp;
  60. <input class="input_text" type="text" name="User__userName" id="User__userName" maxlength="50" size="15"/>
  61. </div>
  62. <div class="align_right">
  63. <label id="User__password_label" for="User__userPassword">Password&nbsp;</label>&nbsp;
  64. <input class="input_text" type="password" name="User__userPassword" id="User__userPassword" maxlength="50" size="15"/>
  65. </div>
  66. <div class="align_right margin_top_5">';
  67. if (stristr($_SERVER['HTTP_USER_AGENT'], "Mozilla") && stristr($_SERVER['HTTP_USER_AGENT'], "compatible")){
  68. echo '
  69. <button type="submit">
  70. <img src="../img/icons/nuvola/16x16/actions/button_ok.png" alt="OK" width="16" height="16" />
  71. <span>Entra</span>
  72. </button>';
  73. }
  74. else
  75. echo '
  76. <a href="#" onclick="submitLoginForm(\'form_Login\');" title="Entra." class="button">
  77. <img src="../img/icons/nuvola/16x16/actions/button_ok.png" alt="OK" width="16" height="16" />
  78. <span>Entra</span>
  79. </a>';
  80. echo '
  81. </div>
  82. </form>
  83. </div>
  84. <br/>';
  85. $handle = fopen("../.svn/entries", "rb");
  86. $counter=0;
  87. while (($buffer = fgets($handle, 4096)) !== false) {
  88. $counter++;
  89. if ($counter==10){
  90. $Date = new Date();
  91. $Date->data_timestamp(substr($buffer, 0, 10));
  92. $svnVersionDate=$Date->trasformaData('d/m/Y');
  93. $svnVersionTime=substr($buffer, 11, 8);
  94. }
  95. if ($counter==11){
  96. $svnVersionNumber=$buffer;
  97. break;
  98. }
  99. }
  100. fclose($handle);
  101. echo '<div class="font10 align_center margin3">Version <b>'.$svnVersionNumber.'</b><br/><i class="colorgray">'.$svnVersionDate.' '.$svnVersionTime.'</i></div>';
  102. echo '
  103. <br/>
  104. ';
  105. // echo $_SERVER['HTTP_USER_AGENT'];
  106. if (stristr($_SERVER['HTTP_USER_AGENT'], "Mozilla") && stristr($_SERVER['HTTP_USER_AGENT'], "compatible")){
  107. echo '
  108. <div style="width:500px;border:1px solid red;color:red;background-color:#FFFBAD;margin:auto;padding:5px;font-size:12px;">
  109. Per l\'utilizzo di questa web application consigliamo caldamente il <b>Browser Mozilla Firefox</b> pi&ugrave; affidabile e sicuro di Microsoft Internet Explorer.
  110. Mozilla Firefox &egrave; scaricabile gratuitamente da qui &#187 <b><a target="_blank" href="http://www.mozilla-europe.org/it/firefox/" title="Scarica ora Firefox &egrave; gratuito e facile da installare">Browser Firefox</a></b>
  111. <br/>
  112. Per stampare i moduli e i documenti &egrave; necessario <b>Adobe Reader</b> scaricabile gratuitamente da qui &#187 <b><a target="_blank" href="http://www.adobe.com/it/products/acrobat/readstep2.html" title="Scarica ora Adobe Reader &egrave; gratuito e facile da installare">Adobe Reader</a></b>
  113. </div>';
  114. }
  115. if ($_REQUEST['message']=='loginError'){
  116. echo "<script>alert('Attenzione! Utente o password errati.');</script>";
  117. }
  118. if ($_REQUEST['message']=='userNotPresent'){
  119. echo "<script>alert('Attenzione! Utente o password errati.');</script>";
  120. }
  121. else if ($_REQUEST['message']=='intrusion'){
  122. echo "<script>alert('Attenzione! Non si hanno le autorizzazioni necessarie per accedere al modulo selezionato. Rieseguire il login.');</script>";
  123. }
  124. else if ($_REQUEST['message']=='timeout'){
  125. echo "<script>alert('Attenzione! Sessione scaduta per prolungata inattivita\'. Rieseguire il login.');</script>";
  126. }
  127. else if (isset($_REQUEST['message'])){
  128. echo "<script>alert(unescape('$_REQUEST[message]'));</script>";
  129. }
  130. $Design->privateHtmlClose($noswitch=1);
  131. ?>