assign('cust_post_login', "YES"); $errors = 0; $error = array(); if(!valid_email($email)) { $errors++; $error[] = $lang['49']; } if(!valid_password($password)) { $errors++; $error[] = $lang['50']; } if ($errors == 0) { $crypt_password = md5($password); $sql = "SELECT customer_email FROM diffshop_customers WHERE customer_email = '$email' AND customer_password = '$crypt_password' ORDER BY customer_id ASC"; $result= mysql_query($sql); if(mysql_num_rows($result) == 1) { $user_exist = "YES"; } else { $user_exist = "NO"; } } if ($user_exist == "NO") { $errors++; $error[] = $lang['76']; } $smarty->assign('errors', $errors); if ($errors > 0) { $error = array_unique($error); foreach ($error as $key => $value) { $login_errors .= $value."
"; } $smarty->assign('login_errors', $login_errors); $get_ip = $_SERVER['REMOTE_ADDR']; $sql = "INSERT INTO diffshop_login_history (login, date_time, status, ip) VALUES ('$email', ".time().", 'failure', '$get_ip')"; $result = mysql_query($sql) or die("error in query - $sql - ".mysql_error()); } if ($errors == 0) { $get_ip = $_SERVER['REMOTE_ADDR']; $sql = "INSERT INTO diffshop_login_history (login, date_time, status, ip) VALUES ('$email', ".time().", 'success', '$get_ip')"; $result = mysql_query($sql) or die("error in query - $sql - ".mysql_error()); $sql = "UPDATE diffshop_customers SET last_login = '".time()."' WHERE customer_email = '$email'"; $result = mysql_query($sql) or die("error in query - $sql - ".mysql_error()); if (!session_is_registered('email')) { session_register('email'); } else { session_unregister('email'); session_register('email'); } if (!isset($_SESSION['email'])) { $_SESSION['email'] = $email; } else { $_SESSION['email'] = $email; } //echo $_SESSION['basket_page']; if (!isset($_SESSION['basket_page'])) { header ("Location: http://www.artizanat-online.ro/index.php"); exit; } else { header ("Location: http://www.artizanat-online.ro/".$_SESSION['basket_page'].""); exit; } } } } //////////////////////////////////////////////////////////////////////////////////////////////////////*\ $smarty->display('login.tpl'); include ("close_mysql.php"); ?>