<?
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
//***************************************************
// http://www.niadesain.com
// Solusi Hemat Script Bisnis Online Anda
// Menerima Jasa Pembuatan Website & Template Website
// awrev18
//***************************************************
?>
<?
session_start();
include "config/koneksi.php";

function anti_injection($data){
  $filter = mysql_real_escape_string(stripslashes(strip_tags(htmlspecialchars($data,ENT_QUOTES))));
  return $filter;
}

//$username     = anti_injection($_POST['username']);
//$email        = anti_injection($_POST['email']);
  $username     = anti_injection(isset($_POST['username'])) ? $_POST['username'] : null;
  $email        = anti_injection(isset($_POST['email'])) ? $_POST['email'] : null;
  $password     = anti_injection($_POST['password']);
  $idhide       = anti_injection($_POST['idhide']);
  $cs_domain    = anti_injection($_POST['cs_domain']);
  $cs_nm        = anti_injection($_POST['cs_nm']);
  $cs_email     = anti_injection($_POST['cs_email']);
  $cs_bank      = anti_injection($_POST['cs_bank']);
  $cs_bank1     = anti_injection($_POST['cs_bank1']);
  $cs_bank3     = anti_injection($_POST['cs_bank3']);
  $cs_bank4     = anti_injection($_POST['cs_bank4']);
  $cs_hp        = anti_injection($_POST['cs_hp']);
  $cs_ym        = anti_injection($_POST['cs_ym']);
  $cs_potpph    = anti_injection($_POST['cs_potpph']);
  $cs_potadmin  = anti_injection($_POST['cs_potadmin']);
  $cs_minwd     = anti_injection($_POST['cs_minwd']);
  $set_bisnis   = anti_injection($_POST['set_bisnis']);
  $set_weblogin = anti_injection($_POST['set_weblogin']);
  $set_title1   = anti_injection($_POST['set_title1']);
  $set_title2   = anti_injection($_POST['set_title2']);
  $set_caption  = anti_injection($_POST['set_caption']);
  $set_pt       = anti_injection($_POST['set_pt']);
//$set_histat   = anti_injection($_POST['set_histat']);

//$data       = anti_injection(md5($_POST['$password']));
//$pass       = hash("Bismillah",$data);


  $login = mysql_query("SELECT username, email, pass, nama, status, blokir, paket, id, sponsor, adminrp  from banner_kanan WHERE (email='$email' or username='$username') and pass='$password'");
  $ketemu = mysql_num_rows($login);
  $r = mysql_fetch_array($login);
  
// Apabila username dan password ditemukan
if ($ketemu > 0){
//  session_start();

  $_SESSION['user_session'] = $r['username'];
  $_SESSION['user_email']   = $r['email'];
  $_SESSION['user_password']= $r['pass'];
  $_SESSION['user_nama']    = $r['nama'];
  $_SESSION['user_status']  = $r['status'];
  $_SESSION['user_blokir']  = $r['blokir'];
  $_SESSION['user_paket']   = $r['paket'];
  $_SESSION['user_id']      = $r['id'];
  $_SESSION['user_sponsor'] = $r['sponsor'];
  $_SESSION['user_adminrp'] = $r['adminrp'];

//------------------------------------------------------------------------------------------------------------------
//$domainku                 = mysql_query("SELECT name,email,bank,bank1,bank2,hpsms,ym from configuration limit 1");
//$awweb                    = mysql_fetch_array($domainku);
//$_SESSION[user_domain]    = $awweb[bank2];
  $_SESSION['user_domain']  = $cs_domain;
  $_SESSION['user_bisnis']  = $set_bisnis;
  $_SESSION['user_weblogin']= $set_weblogin;
  $_SESSION['user_title1']  = $set_title1;
  $_SESSION['user_title2']  = $set_title2;
  $_SESSION['user_caption'] = $set_caption;
  $_SESSION['user_pt']      = $set_pt;
//$_SESSION[user_histat]    = $set_histat;

  $_SESSION['admin_nm']     = $cs_nm;
  $_SESSION['admin_email']  = $cs_email;
  $_SESSION['admin_bank']   = $cs_bank;
  $_SESSION['admin_bank1']  = $cs_bank1;
  $_SESSION['admin_bank3']  = $cs_bank3;
  $_SESSION['admin_bank4']  = $cs_bank4;
  $_SESSION['admin_hp']     = $cs_hp;
  $_SESSION['admin_ym']     = $cs_ym;
  $_SESSION['admin_potpph'] = $cs_potpph;
  $_SESSION['admin_potadmin'] = $cs_potadmin;
  $_SESSION['admin_minwd']  = $cs_minwd;
//------------------------------------------------------------------------------------------------------------------

        //echo "ok";
	header("Location: member/");
        mysql_query("UPDATE banner_kanan SET counter='$_SESSION[user_nama]'+1 WHERE email='$_SESSION[user_email]' ");
  } else {
        //echo "salah";
        header("location:./?scrindo=loginsalah&id=$idhide");
}
?>