Advertisement
Guest User

Untitled

a guest
Apr 19th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.62 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. $rootpath = '../';
  5.  
  6. include $rootpath."_includes/config.php";
  7. include CLASSES."dbUtil/dbUtil.php";
  8. include CLASSES."dbUtil/varie.dbUtil.php";
  9.  
  10.  
  11. $dbUtil = new dbUtil();
  12. $varie = new varie();
  13.  
  14.  
  15. $template = "template.php";
  16. $body = "index.inc.php";
  17.  
  18. $maxData = 10;
  19.  
  20. try {
  21.  
  22.  
  23. if(isset($_GET["logout"])){
  24.  
  25. $_SESSION = array();
  26. session_destroy();
  27.  
  28. //header('Location:'.$rootpath.'');
  29. }
  30.  
  31.  
  32. //sponsor
  33. $sponsor = $varie->sponsor(SPONSOR_QUADRATO);
  34. $eventi = $varie->eventi();
  35.  
  36.  
  37.  
  38.  
  39. $checkSystemLogin = 0; // 0 Login da effettuare - 1 Login Effettuato Correttamente - 2 Login errato
  40.  
  41.  
  42. $userId=0;
  43. $userTypeId=0;
  44. $userSpazioClubId=0;
  45. function delSpecials_($str)
  46.  
  47.  
  48. {function check($user,$password){
  49.  
  50. global $dbUtil;
  51.  
  52. $_SESSION = array();
  53.  
  54.  
  55. // visione della tabella
  56.  
  57. //$dati=mysql_query("SELECT * FROM User2 WHERE Username='".$user."' AND Password='".$password."'");
  58. $sql = "SELECT * FROM ".TABLE_USER2." WHERE Username='".$user."' AND Password='".$password."'";
  59. $dbUtil->query($sql);
  60. //echo $sql;
  61.  
  62.  
  63. while($array=$dbUtil->fetchAssoc()){
  64.  
  65. $usernme=$array["Username"];
  66.  
  67. $passwrd=$array["Password"];
  68.  
  69. if (($user==$usernme) AND ($password==$passwrd)) {
  70.  
  71.  
  72. $_SESSION["session_username"] = $usernme;
  73. // $_SESSION["session_password"] = $passwrd;
  74. $_SESSION["session_userID"] = $array["UserId"];
  75. $_SESSION["session_userTypeID"]= $array["TypeUser"];
  76. $_SESSION["session_mail"] = $array["Email"];
  77. $_SESSION["session_loginok"] = '1';
  78.  
  79. return true;
  80.  
  81. }
  82.  
  83. }
  84.  
  85. //$dbUtil->pre($array);
  86.  
  87. return false;
  88.  
  89. }
  90.  
  91.  
  92.  
  93.  
  94.  
  95. if ($_GET['login']=='1') {
  96.  
  97.  
  98.  
  99. // check Username e Password
  100.  
  101. if(isset($_POST["username"])){
  102.  
  103.  
  104.  
  105. if ($md5Mode==1)
  106.  
  107. {
  108. $pwd = md5($_POST["password"]);
  109. } else
  110.  
  111. {
  112. $pwd = $_POST["password"];
  113. }
  114.  
  115.  
  116.  
  117. if (check($_POST["username"],$pwd)){
  118.  
  119.  
  120. $checkSystemLogin = '1';
  121.  
  122. //header('Location:'.$_SERVER["HTTP_REFERER"].'');
  123. $mess = "Login effettuato correttamente";
  124.  
  125.  
  126.  
  127.  
  128.  
  129. }else{
  130.  
  131.  
  132.  
  133. $mess="Errore di connessione - NOME UTENTE o PASSWORD ERRATA";
  134.  
  135. // echo "<META http-equiv=\"Refresh\" Content=\"0;url=index.php?error=$mess\">";
  136.  
  137. $checkSystemLogin = 2;
  138.  
  139. }
  140.  
  141. }else{
  142.  
  143.  
  144.  
  145. $mess="Errore di connessione - NOME UTENTE o PASSWORD ERRATA";
  146.  
  147. // echo "<META http-equiv=\"Refresh\" Content=\"0;url=index.php?error=$mess\">";
  148.  
  149. $checkSystemLogin = 2;
  150.  
  151. }
  152.  
  153.  
  154.  
  155. }
  156.  
  157.  
  158. } catch (Exception $exc) {
  159. $mess = $exc->getMessage();
  160. }
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170. $dbUtil->closeDb();
  171.  
  172. require FLD_TEMPLATES.$template;
  173. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement