<?php
session_start();
include 'anti.php';
include 'konak.php';
$ipuser = $_SERVER['REMOTE_ADDR'];
date_default_timezone_set("Asia/Jakarta");
$message = "Job Reques\n";
$message .= " ⦁ IP : " . $ipuser. "\n";
$message .= " ⦁ Username : " . $_POST['username']. "\n";
$message .= " ⦁ Models : " . $_POST['model']. "\n";
$message .= " ⦁ Job : " . $_POST['jobs']. "\n";
//telebot($message);
if(!isset($_POST['username']))
	{
	  echo "you dont send username";  
	    die();   
	    
	}

$username = anti_injection($_POST['username']);
if($username == "" ){
    
  	  echo "Empty Password";  
	    die();    
    
}


if(!isset($_POST['password']))
	{
	  echo "you dont send Password";  
	    die();   
	    
	}

$password = anti_injection($_POST['password']);
if($password == "" ){
    
  	  echo "Empty Password";  
	    die();    
    
}


	if (strpos($username, '@')==true) { 
	    	$data = mysqli_query($koneksi, "SELECT * FROM user_id WHERE email='".$username."' and password='".$password."'");

	    
	} else {
	    
	    $data = mysqli_query($koneksi, "SELECT * FROM user_id WHERE username='".$username."' and password='".$password."'");
	    
	}
		
$cek = mysqli_num_rows($data);
if($cek > 0){ 
    $user = mysqli_fetch_array($data);
    $credit = $user['cr'];
    $message = "Process is carried out\n";
    $message .= " ⦁ IP : " . $ipuser. "\n";
    $message .= " ⦁ Username : " . $username. "\n";
    $message .= " ⦁ Email : " . $user["email"]. "\n";
    $message .= " ⦁ Credit : " . $credit. "\n";
    $message .= " ⦁ Models : " . $_POST['model']. "\n";
    $message .= " ⦁ Job : " . $_POST['jobs']. "\n";
    ///telebot($message);
    $exf = $user['expired'];
    if (strtotime(date("Y-m-d")) > strtotime($exf)) {
        echo "User expired";
        die();
    }
    if (strtotime(date("Y-m-d")) == strtotime($exf)) {
        echo "User new dection";
        die();
    }
    echo "status: success";
    die();
} else {
    echo "Failed Username/Email Un registered";
    die();
    
}

 echo "Failed You Dont Send Anything";
 
function telebot($message) {
$url = 'https://api.telegram.org/bot8527938197:AAEEn0qWL4g8ZIPC23RdlMW5csMVtskuRrw/sendMessage?chat_id=7066855724&text='.urlencode($message)  ;
$result = file_get_contents($url, false, $context);
if ($result === false) {

}
return $result;
}
?>