Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $rootpath = '../';
- include $rootpath."_includes/config.php";
- include CLASSES."dbUtil/dbUtil.php";
- include CLASSES."dbUtil/varie.dbUtil.php";
- $dbUtil = new dbUtil();
- $varie = new varie();
- $template = "template.php";
- $body = "index.inc.php";
- $maxData = 10;
- try {
- if(isset($_GET["logout"])){
- $_SESSION = array();
- session_destroy();
- //header('Location:'.$rootpath.'');
- }
- //sponsor
- $sponsor = $varie->sponsor(SPONSOR_QUADRATO);
- $eventi = $varie->eventi();
- $checkSystemLogin = 0; // 0 Login da effettuare - 1 Login Effettuato Correttamente - 2 Login errato
- $userId=0;
- $userTypeId=0;
- $userSpazioClubId=0;
- function check($user,$password){
- global $dbUtil;
- $_SESSION = array();
- // visione della tabella
- //$dati=mysql_query("SELECT * FROM User2 WHERE Username='".$user."' AND Password='".$password."'");
- $sql = "SELECT * FROM ".TABLE_USER2." WHERE Username='".$user."' AND Password='".$password."'";
- $dbUtil->query($sql);
- //echo $sql;
- while($array=$dbUtil->fetchAssoc()){
- $usernme=$array["Username"];
- $passwrd=$array["Password"];
- if (($user==$usernme) AND ($password==$passwrd)) {
- $_SESSION["session_username"] = $usernme;
- // $_SESSION["session_password"] = $passwrd;
- $_SESSION["session_userID"] = $array["UserId"];
- $_SESSION["session_userTypeID"]= $array["TypeUser"];
- $_SESSION["session_mail"] = $array["Email"];
- $_SESSION["session_loginok"] = '1';
- return true;
- }
- }
- //$dbUtil->pre($array);
- return false;
- }
- if ($_GET['login']=='1') {
- // check Username e Password
- if(isset($_POST["username"])){
- if ($md5Mode==1)
- {
- $pwd = md5($_POST["password"]);
- } else
- {
- $pwd = $_POST["password"];
- }
- if (check($_POST["username"],$pwd)){
- $checkSystemLogin = '1';
- //header('Location:'.$_SERVER["HTTP_REFERER"].'');
- $mess = "Login effettuato correttamente";
- }else{
- $mess="Errore di connessione - NOME UTENTE o PASSWORD ERRATA";
- // echo "<META http-equiv=\"Refresh\" Content=\"0;url=index.php?error=$mess\">";
- $checkSystemLogin = 2;
- }
- }else{
- $mess="Errore di connessione - NOME UTENTE o PASSWORD ERRATA";
- // echo "<META http-equiv=\"Refresh\" Content=\"0;url=index.php?error=$mess\">";
- $checkSystemLogin = 2;
- }
- }
- } catch (Exception $exc) {
- $mess = $exc->getMessage();
- }
- $dbUtil->closeDb();
- require FLD_TEMPLATES.$template;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement