<?php header("Content-Type:text/json"); require "src/snapchat.php"; if ($_POST['token'] === "1234567demo") { $username = $_POST['username']; // Your snapchat username $password = $_POST['password']; // Your snapchat password $gEmail = $_POST['gMail']; // Gmail account $gPasswd = $_POST['gPasswd']; // Gmail account password $debug = false; // Set this to true if you want to see all outgoing requests and responses from server $casperKey = "4232cf886ff2d2c1747d40adfab409f0"; // Casper API Key $casperSecret = "b47a666ce0fefb90de058a8a38f01ff2"; // Casper API Secret $snapchat = new Snapchat($username, $gEmail, $gPasswd, $casperKey, $casperSecret, $debug); $snapchat->login($password); $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["Video"]["name"]); if (move_uploaded_file($_FILES["Video"]["tmp_name"], $target_file)) { } $send = $snapchat->send($target_file, $_POST['to'], "", $_POST['time']); echo json_encode(array("SUCCES" => $send)); } else { echo "NOT FOUND"; }
//do not edit if ($db->connect_errno > 0) { die("Database connection error: " . $db->connect_error . "<hr />Please press 'back' on your browser and try again."); } else { $content = file_get_contents("../config/settings.php"); $content = str_replace("DBUSER", $_POST['dbuser'], $content); $content = str_replace("DBHOST", $_POST['dbhost'], $content); $content = str_replace("DBPASS", $_POST['dbpass'], $content); $content = str_replace("DBNAME", $_POST['dbname'], $content); file_put_contents("../config/settings.php", $content); } // *** ------------------- *** // } elseif ($_POST['step'] == 2) { // *** CONNECT TO SNAPCHAT *** // $snapchat = new Snapchat($_POST['snuser'], $_POST['guser'], $_POST['gpass'], false); $snapchat->login($_POST['snpass']); if (!file_exists("../src/authData/auth-" . $_POST['snuser'] . ".dat")) { echo "Incorrect snapchat username!<br />"; $err = true; } if (!file_exists("../src/authData/gAuth-" . $_POST['snuser'] . ".dat")) { echo "Incorrect Google username or password!<br />"; $err = true; } if ($err) { die("Please press 'back' on your browser and try again."); } else { $content = file_get_contents("../config/settings.php"); $content = str_replace("USERNAME", $_POST['snuser'], $content); $content = str_replace("PASSWORD", $_POST['snpass'], $content); $content = str_replace("GUSER-NAME", $_POST['guser'], $content);
//*************************************************************************************************** //VARIABLES //*************************************************************************************************** // *** CONNECT TO DATABASE *** // if ($config['firstsetup'] != true) { $db = new mysqli($config['dbhost'], $config['dbuser'], $config['dbpass'], $config['dbname']); //do not edit if ($db->connect_errno > 0) { die("Database connection error: " . $db->connect_error); } } // *** ------------------- *** // // *** INITIALIZE SNAPCHAT *** // if (!$config['firstsetup']) { $snapchat = new Snapchat($config['username'], $config['gusername'], $config['gpassword'], $debug); $snapchat->login($config['password']); } // *** ------------------- *** // //*************************************************************************************************** //FUNCTIONS //*************************************************************************************************** // *** CHECK FOR BANNED SNAPCHAT USER *** // function is_banned($username) { $sql = "SELECT * FROM `bans` WHERE `bans`.`username` = '" . $username . "'"; if (!($result = $GLOBALS['db']->query($sql))) { die("Database error! (is_banned)"); } while ($row = $result->fetch_assoc()) { if ($row['username'] != "") { return true;
$response->message = !empty($result->message) ? $result->message : "Sorry for the issues when logging in. If you used an email to login, please try your username instead."; } else { $result = $snapchat->getUpdates2(); formatSnaps($result, $snapchat); $response->status = OKAY; $response->message = $result; } } else { $response->status = BAD; $response->message = "Please enter a username and a password."; } } else { if ($action == "login2") { if (isset($_GET['username']) && isset($_GET['password']) && $_GET['username'] != "" && $_GET['password'] != "") { $snapchat = new Snapchat($_GET['username'], $_GET['password']); $result = $snapchat->login($_GET['username'], $_GET['password']); if ($snapchat->username == FALSE || $snapchat->auth_token == FALSE) { $response->status = BAD; $response->message = $result; } else { $result = $snapchat->getUpdates2(); formatSnaps($result, $snapchat); $response->status = OKAY; $response->message = $result; } } else { $response->status = BAD; $response->message = "Please enter a username and a password."; } } else { if ($action == "register") {