Example #1
0
 function translate($from, $to, $text)
 {
     $header = array('Authorization: Bearer ' . $this->access_token);
     $res = cURL_HTTP_Request('http://api.microsofttranslator.com/v2/Http.svc/Translate?text=' . urlencode($text) . '&from=' . $from . '&to=' . $to, false, $header)->html;
     $xmlObj = simplexml_load_string($res);
     foreach ((array) $xmlObj[0] as $val) {
         $return = $val;
     }
     return $return;
 }
Example #2
0
     $server_message .= "[Server Message][Error] Only supports text.\n";
 }
 if (preg_match("/\n/", $input)) {
     $server_message .= "[Server Message][Notice] Wrap will be ignored.\n";
 }
 $input = str_replace("\n", "", $input);
 if (!preg_match("/[A-Za-z0-9]/", $input)) {
     $error = true;
     $server_message .= "[Server Message][Error] Your message must include any alphanumeric character.\n";
 }
 if (!preg_match("/^[ -~]*\$/", $input)) {
     $error = true;
     $server_message .= "[Server Message][Error] Only supports ASCII printable code (alphanumeric characters and some English punctuations).\n";
 }
 if (!$error) {
     $html = cURL_HTTP_Request('http://sheepridge.pandorabots.com/pandora/talk?botid=' . $botid . '&skin=custom_input', array('input' => $input), false, 'cookie/' . $conversation_id . '.txt');
     if ($html == false) {
         $server_message .= "[Server Message][Error] AI server is down.\n";
     } else {
         $html = $html->html;
         $html = str_replace(array("\t", "\r\n", "\r", "\n"), "", $html);
         preg_match('/<b>You said:<\\/b>.+?<br\\/><b>A.L.I.C.E.:<\\/b> (.+?)<br\\/>/', $html, $match);
         $response = $match[1];
         $response = str_replace("<br> ", "\n", $response);
         $response = str_replace("<p></p> ", "\n\n", $response);
         $response = strip_tags($response);
         $response = str_replace("  ", " ", $response);
         if (strpos($response, "he is the author") === false && strpos($response, "He is a famous computer scientist") === false) {
             $response = str_replace("ALICE", "Eve", $response);
             $response = str_replace("Artificial Linguistic Internet Computer Entity", "Every day and night, I will be with you", $response);
             $response = str_replace("Dr. Richard S. Wallace", "K.R.T.GIRLS xiplus", $response);
Example #3
0
session_start();
?>
<html>
<head>
<title>Third-Party Verification</title>
<meta charset="UTF-8">
</head>
<body>
<center>
<h2>Third-Party Verification</h2>
<hr>
<a href="/">Home Page</a><br><br>
<?php 
require __DIR__ . "/config/config.php";
require __DIR__ . "/function/cURL-HTTP-function/curl.php";
$response = cURL_HTTP_Request('https://www.google.com/recaptcha/api/siteverify', array('secret' => $config['reCAPTCHA']['secret_key'], 'response' => $_POST['g-recaptcha-response']));
if (json_decode($response->html)->success) {
    require __DIR__ . "/function/facebook-php-sdk-v4/src/Facebook/autoload.php";
    require __DIR__ . "/function/SQL-function/sql.php";
    require __DIR__ . "/function/fblogin.php";
    if ($response = checklogin()) {
        $fbid = $response['id'];
        $fbname = $response['name'];
        $datetime = time();
        $token = substr(md5($fbid . $datetime . $config['hash']), 0, 8);
        $query = new query();
        $query->dbname = $config['database']['dbname'];
        $query->table = $config['database']['table'];
        $query->value = array(array('fbid', $fbid), array('fbname', $fbname), array('datetime', date("Y-m-d H:i:s", $datetime)), array('token', $token));
        INSERT($query);
        $url = $config['url'] . '?token=' . $token;