PageRenderTime 53ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/system_admin/edv-datenbank-pass.php

https://bitbucket.org/vincentbii/amurt
PHP | 242 lines | 227 code | 14 blank | 1 comment | 14 complexity | e34be7c05a332ca2a1f22bd8ca0a6e87 MD5 | raw file
Possible License(s): GPL-2.0, Apache-2.0, LGPL-2.1, MPL-2.0-no-copyleft-exception, MIT, BSD-3-Clause, LGPL-2.0, GPL-3.0
  1. <?php
  2. if(($sid==NULL)||($sid!=$$ck_sid_buffer)) { header("location:invalid-access-warning.php"); exit;}
  3. require_once($root_path.'include/inc_config_color.php');
  4. srand(time()*1000);
  5. $r=rand(1,1000);
  6. $dbname="maho";
  7. $allowedarea="System_Admin";
  8. $fileforward="edv-datenbank.php";
  9. $thisfile="edv-datenbank-pass.php";
  10. $breakfile="edv.php";
  11. if($_COOKIE['ck_login_logged'.$sid]&&$_COOKIE['ck_login_userid'.$sid])
  12. {
  13. header("location: passcheck-intern.php?sid=$sid&lang=$lang&allowedarea=$allowedarea&fileforward=$fileforward&retfilepath=$thisfile");
  14. exit;
  15. }
  16. //setcookie(ck_edv_db_user,"");
  17. function validarea($area,$zeile2,$range)
  18. {
  19. for ($i=0;$i<$range;$i++)
  20. if(($zeile2[$i]==$area)or($zeile2[$i]=="alle")) return 1;
  21. return 0;
  22. }
  23. function logentry($userid,$key,$report,$remark1,$remark2)
  24. {
  25. $logpath="logs/access/".date(Y)."/";
  26. if (file_exists($logpath))
  27. {
  28. $logpath=$logpath.date("Y_m_d").".log";
  29. $file=fopen($logpath,"a");
  30. if ($file)
  31. { if ($userid=="") $userid="blank";
  32. $line=date("d.m.Y").' '.date("H.i").' '.$report.' Username='.$userid.' Password='.$key.' Fileaccess='.$remark1.' Fileforward='.$remark2;
  33. fputs($file,$line);fputs($file,"\r\n");
  34. fclose($file);
  35. }
  36. }
  37. }
  38. if ($versand=="Abschicken")
  39. {
  40. $link=mysql_connect("localhost","httpd","");
  41. if ($link)
  42. { if(mysql_select_db($dbname,$link))
  43. { $sql='SELECT * FROM mahopass WHERE mahopass_id="'.$userid.'"';
  44. $ergebnis=$db->Execute($sql);
  45. if($ergebnis)
  46. {$zeile=$ergebnis->FetchRow();
  47. if (($zeile[mahopass_password]==$keyword)&&($zeile[mahopass_id]==$userid))
  48. {
  49. if (!($zeile[mahopass_lockflag]))
  50. {
  51. if (validarea($allowedarea,$zeile,mysql_num_fields($ergebnis)))
  52. {
  53. setcookie(ck_edv_db_user,$zeile[mahopass_name]);
  54. logentry($zeile[mahopass_name],"*","IP:".$REMOTE_ADDR."EDV DB verwalten Access OK'd",$thisfile,$fileforward);
  55. header("location: $fileforward?sid=$$ck_sid_buffer");
  56. exit;
  57. }else {$passtag=2;};
  58. }else $passtag=3;
  59. }else {$passtag=1;};
  60. }
  61. else {$passtag=1;};
  62. };
  63. }
  64. else
  65. { echo "Verbindung zur Datenbank konnte nicht hergestellt werden.<br>"; $passtag=5;}
  66. }
  67. ?>
  68. <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN" "html.dtd">
  69. <HTML>
  70. <HEAD>
  71. <?php echo setCharSet(); ?>
  72. <TITLE>EDV - Datenbank Verwalten</TITLE>
  73. <?php if($cfg['dhtml'])
  74. { echo'
  75. <script language="javascript" src="../js/hilitebu.js">
  76. </script>
  77. <STYLE TYPE="text/css">
  78. A:link {text-decoration: none; color: '.$cfg['body_txtcolor'].';}
  79. A:hover {text-decoration: underline; color: '.$cfg['body_hover'].';}
  80. A:active {text-decoration: none; color: '.$cfg['body_alink'].';}
  81. A:visited {text-decoration: none; color: '.$cfg['body_txtcolor'].';}
  82. A:visited:active {text-decoration: none; color: '.$cfg['body_alink'].';}
  83. A:visited:hover {text-decoration: underline; color: '.$cfg['body_hover'].';}
  84. </style>';
  85. }
  86. ?>
  87. </HEAD>
  88. <BODY <?php if (!$nofocus) echo 'onLoad="document.passwindow.userid.focus()"'; echo ' bgcolor='.$cfg['body_bgcolor'];
  89. if (!$cfg['dhtml']){ echo ' link='.$cfg['body_txtcolor'].' alink='.$cfg['body_alink'].' vlink='.$cfg['body_txtcolor']; }
  90. ?>>
  91. <p>
  92. <FONT SIZE=-1 FACE="Arial">
  93. <P>
  94. <FONT COLOR=#cc6600 SIZE=5 FACE="verdana"> <b>Datenbank Verwalten</b></font>
  95. <p>
  96. <table width=100% border=0 cellpadding="0" cellspacing="0">
  97. <tr>
  98. <td colspan=3><img src=../img/einga-b.gif border=0 width=130 height=25><!-- <a href="op-pflege-logbuch-such-pass.php?sid=<?php echo $$ck_sid_buffer;?>"><img src="../img/such-gray.gif" border=0 width=130 height=25 <?php if($cfg['dhtml'])echo'style=filter:alpha(opacity=70) onMouseover=hilite(this,1) onMouseOut=hilite(this,0)>';?></a><a href="op-pflege-logbuch-arch-pass.php?sid=<?php echo $$ck_sid_buffer;?>"><img src="../img/arch-gray.gif" border=0 width=130 height=25 <?php if($cfg['dhtml'])echo'style=filter:alpha(opacity=70) onMouseover=hilite(this,1) onMouseOut=hilite(this,0)>';?></a> --></td>
  99. </tr>
  100. <tr>
  101. <td bgcolor=#333399 colspan=3>
  102. <FONT SIZE=1 FACE="Arial"><STRONG>&nbsp;</STRONG></FONT>
  103. </td>
  104. </tr>
  105. <tr bgcolor="#DDE1EC">
  106. <td bgcolor=#333399><font size=1>&nbsp;</td>
  107. <td>
  108. <p><br>
  109. <center>
  110. <?php if ((($userid!=NULL)||($keyword!=NULL))&&($passtag!=NULL))
  111. {
  112. echo '<FONT COLOR="red" SIZE=+2 FACE="Arial"><STRONG>';
  113. $errbuf="EDV - DB verwalten ";
  114. switch($passtag)
  115. {
  116. case 1:$errbuf=$errbuf."Falsche Eingabe"; echo '<img src=../img/cat-fe.gif align=left>';break;
  117. case 2:$errbuf=$errbuf."Keine Berechtigung"; echo '<img src=../img/cat-noacc.gif align=left>';break;
  118. default:$errbuf=$errbuf."Zugang gesperrt"; echo '<img src=../img/warn.gif align=left>';
  119. }
  120. logentry($userid,$keyword,$errbuf,$thisfile,$fileforward);
  121. echo '</STRONG></FONT><P>';
  122. }
  123. ?>
  124. <table border=0 cellpadding=0 cellspacing=0>
  125. <tr>
  126. <?php if(!$passtag) echo'
  127. <td>
  128. <img src="../img/ned2r.gif" border=0 width=100 height=138 >
  129. </td>
  130. ';
  131. ?>
  132. <td bgcolor="#999999" valign=top>
  133. <table cellpadding=1 bgcolor=#999999 cellspacing=0>
  134. <tr>
  135. <td>
  136. <table cellpadding=20 bgcolor=#eeeeee >
  137. <tr>
  138. <td>
  139. <p>
  140. <FORM action="<?php echo $thisfile; ?>" method="post" name="passwindow">
  141. <font color=maroon size=3>
  142. <b>Passwort ist erforderlich!</b></font><p>
  143. <font face="Arial,Verdana" color="#000000" size=-1>
  144. Benutzername eingeben:<br></font>
  145. <INPUT type="text" name="userid" size="14" maxlength="25"> <p>
  146. <font face="Arial,Verdana" color="#000000" size=-1>Passwort eingeben:</font><br>
  147. <INPUT type="password" name="keyword" size="14" maxlength="25">
  148. <input type="hidden" name="versand" value="Abschicken">
  149. <input type="hidden" name="sid" value="<?php echo $sid; ?>">
  150. <input type="image" src="../img/abschic.gif" border=0 width=110 height=24>
  151. </font>
  152. </FORM>
  153. <FORM action="<?php echo $breakfile;?>" name=cancelbut>
  154. <input type="hidden" name="sid" value="<?php echo $sid; ?>">
  155. <input type="image" src="../img/abbrech.gif" border=0 width=103 height=24>
  156. </font></FORM>
  157. </td>
  158. </tr>
  159. </table>
  160. </td>
  161. </tr>
  162. </table>
  163. </td>
  164. </tr>
  165. </table>
  166. <p><br>
  167. </center>
  168. </td>
  169. <td bgcolor=#333399><font size=1>&nbsp;</td>
  170. </tr>
  171. <tr >
  172. <td bgcolor="#333399" colspan=3><font size=1>
  173. &nbsp;
  174. </td>
  175. </tr>
  176. </table>
  177. <p>
  178. <img src="../img/small_help.gif"> <a href="<?php echo $root_path; ?>main/ucons.php<?php echo URL_APPEND; ?>">Einfhrung in die SQL Datenbank.</a><br>
  179. <img src="../img/small_help.gif"> <a href="<?php echo $root_path; ?>main/ucons.php<?php echo URL_APPEND; ?>">Wie mache ich was hier?</a><br>
  180. <HR>
  181. <p>
  182. <?php
  183. require($root_path.'include/inc_load_copyrite.php');
  184. ?>
  185. </FONT>
  186. </BODY>
  187. </HTML>