Advertisement
Happy_Hippy

Untitled

May 11th, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. <?php
  2. session_start();
  3. ?>
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  5. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  6. <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
  9. </head>
  10. <body bgcolor="turquoise" link="#00FF00" alink="#43FF00" vlink="#0033FF" background="141.jpg" style="
  11. background-color: rgb(64, 224, 208);
  12. background-image: (D:\home\diplom\www\Biogaz.jpg);
  13. background-repeat: no-repeat;
  14. background-size: cover;
  15. ">
  16. <?
  17.  
  18. mysql_connect("127.0.0.1", "root") or die;
  19. mysql_select_db("Diplom");
  20. if (!mysql_select_db("Diplom"))
  21. {
  22. mysql_error();
  23. }
  24. mysql_query("SET NAMES UTF8");
  25.  
  26.  
  27.  
  28. if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["login"] )){
  29. $sqltext = "SELECT * FROM sotrudniki WHERE login='".$_POST["login"]."' AND parol='".$_POST["password"]."'";
  30. $rs=mysql_query($sqltext);
  31. echo $sqltext;
  32. if (!mysql_query($sqltext))
  33. {
  34. mysql_error();
  35. }
  36. if (mysql_num_rows($rs)){
  37. $ar = mysql_fetch_array($rs);
  38. $_SESSION["kod_sotrudnika"] = $ar["kod_sotrudnika"];
  39. }else
  40. $_SESSION["kod_sotrudnika"] = "";
  41. }
  42.  
  43. if (!$_SESSION["kod_sotrudnika"]){
  44. echo '<form method="POST">
  45. <input type="edit" name="login"/><br/>
  46. <input type="password" name="password"/><br/>
  47. <input type="submit" value="sent"/><br/>
  48. </form>';
  49. exit();
  50. }
  51. else
  52. echo 'You authorized as: '.$_SESSION["kod_sotrudnika"];
  53. error_reporting(-1);
  54.  
  55. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement