Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /** J.A.R.V.I.S Artificial Intelligence | php CODE
- * 30 - Januari - 2017
- * Author by muhammad fahriansyah X - RPL 1
- */
- class jarvis
- {
- var $host = "localhost";
- var $user = "root";
- var $db = "jarvis";
- var $pass = "123456";
- var $data_ac = "";
- var $data_con = "";
- var $data_tar = "";
- function action()
- {
- $connect = mysqli_connect($this->host,$this->user,$this->pass,$this->db);
- $cmd = $_GET['cmd'];
- $sql_action = "select * from action";
- $query_action = mysqli_query($connect,$sql_action);
- while ($data_action = mysqli_fetch_array($query_action)) {
- $action = $data_action['action'];
- if (preg_match("/$action/", $cmd)) {
- $this->data_ac = $action;
- }
- }
- }
- function conv()
- {
- $connect = mysqli_connect($this->host,$this->user,$this->pass,$this->db);
- $cmd = $_GET['cmd'];
- $sql_conversation = "select * from conversation";
- $query_conversation = mysqli_query($connect,$sql_conversation);
- while ($data_conversation = mysqli_fetch_array($query_conversation)) {
- $conversation = $data_conversation['conversation'];
- if (preg_match("/$conversation/", $cmd)) {
- $this->data_con = $conversation;
- }
- }
- }
- function target()
- {
- $connect = mysqli_connect($this->host,$this->user,$this->pass,$this->db);
- $cmd = $_GET['cmd'];
- $sql_target = "select * from target";
- $query_target = mysqli_query($connect,$sql_target);
- while ($data_target = mysqli_fetch_array($query_target)) {
- $target = $data_target['target'];
- if (preg_match("/$target/", $cmd)) {
- $this->data_tar = $target;
- }
- }
- }
- function command()
- {
- $connect = mysqli_connect($this->host,$this->user,$this->pass,$this->db);
- $cmd = $_GET['cmd'];
- $sql_command = "select * from command";
- $query_command = mysqli_query($connect,$sql_command);
- while ($data_command = mysqli_fetch_array($query_command)) {
- $command = $data_command['query'];
- $yes = $data_command['yes'];
- $actions = $data_command['action'];
- $suggest_a = $this->data_ac." ".$this->data_con." ".$this->data_tar;
- $suggest_b = $this->data_con." ".$this->data_ac." ".$this->data_tar;
- $suggest_c = $this->data_tar." ".$this->data_con." ".$this->data_ac;
- $suggest_d = $this->data_con." ".$this->data_tar." ".$this->data_ac;
- $suggest_e = $this->data_tar." ".$this->data_ac." ".$this->data_con;
- $suggest_f = $this->data_ac." ".$this->data_tar." ".$this->data_con;
- if ($suggest_a == $command || $suggest_b == $command || $suggest_c == $command || $suggest_d == $command || $suggest_e == $command || $suggest_f == $command || $cmd == $command) {
- echo $yes;
- }
- }
- }
- }
- $jarvis = new jarvis();
- $jarvis->action();
- $jarvis->conv();
- $jarvis->target();
- $jarvis->command();
- echo "<br>action : ".$jarvis->data_ac."<br>";
- echo "conversation : ".$jarvis->data_con."<br>";
- echo "target : ".$jarvis->data_tar."<br>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement