require_once('inc/setup.php'); /* $flb->rules = array ( 1=>1 ); // sec => request $res = $flb->CheckFlood ( ); if ( $res ){ $c1=$flb->CheckCron(); $c2=$flb->CronJob(); }else{ die ( 'Prea multe accesari! Asteapta 2 secunde.' ); } */ if(isset($_COOKIE['NQRRO'])) { $pass=$_COOKIE['NQRRO']; $check_query = cbn_db_query("SELECT idusr, username FROM users WHERE passwd_cookie = '" . cbn_db_input($pass) . "' LIMIT 1"); if (!cbn_db_num_rows($check_query)) { setcookie("NQRRO","",time() - 3600,"/"); } else { $check = cbn_db_fetch_array($check_query); $ss = new SecureSession(); $ss->Open(); $_SESSION['logged_in'] = true; $_SESSION['nqrid'] = $check['idusr']; $_SESSION['username'] = $check['username']; header("Location: cont.php"); } }//eof cookie if (isset($_GET['do']) && ($_GET['do'] == 'process')) { $msg_err=''; $email = cbn_db_input($_POST['emailInput']); $password = $_POST['parolaInput']; $ip_address = cbn_get_ip_address(); $check_query = cbn_db_query("SELECT * FROM users WHERE email = '" . $email . "' LIMIT 1"); if (!cbn_db_num_rows($check_query)) { // nu exista email facem cont $cook=md5($email.$ip_address.date('YmdHis')); setcookie("NQRRO",$cook,time()+(3600*24*30),"/"); $username=explode('@',$email); $sql_rez_array = array( 'oauth_provider'=>'nq', 'email'=>cbn_db_input($email), 'username'=>cbn_db_input($username[0]), 'passwd'=>cbn_encrypt_password($password), 'passwd_cookie'=>$cook ); cbn_db_perform('users', $sql_rez_array); $id_usr=cbn_db_insert_id(); $ss = new SecureSession(); $ss->Open(); $_SESSION['logged_in'] = true; $_SESSION['nqrid'] = $id_usr; $_SESSION['username'] = $username[0]; header("Location: cont.php"); } else { // exista email verificam parola $check = cbn_db_fetch_array($check_query); if (!cbn_validate_password($password, $check['passwd'])) { $error = true; $msg_err .= 'Parola nu este corecta'; }else{ // logare $ss = new SecureSession(); $ss->Open(); $_SESSION['logged_in'] = true; $_SESSION['nqrid'] = $check['idusr']; $_SESSION['username'] = $check['username']; $ip_address = cbn_get_ip_address(); $cook=md5($uid.$ip_address.date('YmdHis')); setcookie("NQRRO",$cook,time()+(3600*24*30),"/"); cbn_db_query("UPDATE users SET passwd_cookie='".$cook."' WHERE idusr='".$check['idusr']."' LIMIT 1"); header("Location: cont.php"); } } }//eof do ?>
include('subfooter.php'); ?>
include('footer.php'); ?>