Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if($_SERVER['REQUEST_METHOD'] === "POST") {
- $viewer = (int)$_POST['v'];
- $chatviewer = (int)$_POST['c'];
- $channelname = htmlspecialchars($_POST['cn']);
- $time = (int)$_POST['t'];
- $key = htmlspecialchars($_POST['k']);
- $error = false;
- $error_message = "User input is invalid";
- function showError($_string)
- {
- $error = true;
- echo '<div class="info">
- <h2>Error</h2>
- <p>' . $_string . '</p>
- </div>';
- };
- function showInfo($_string)
- {
- $error = true;
- echo '<div class="infosuccess">
- <h2>Success!</h2>
- <p>' . $_string . '</p>
- </div>';
- };
- function getHttpCode($http_response_header)
- {
- if(is_array($http_response_header))
- {
- $parts=explode(' ',$http_response_header[0]);
- if(count($parts)>1) //HTTP/1.0 <code> <text>
- return intval($parts[1]); //Get code
- }
- return 0;
- }
- ///
- if(strpos($_POST['cn'], " ") === true) {
- showError("The channelname can not contain white spaces.");
- } else {
- if (strlen($key) > 27 && strlen($key) < 30 && $error === false && strlen($channelname) > 3 && strlen($channelname) < 32) {
- if ((($viewer === 0 || $chatviewer === 0 || $time === 0) && $error === false) ) {
- showError("Invalid user input");
- } else {
- ////
- // mysql
- ///
- $servername = "localhost";
- $username = "streamhu_streamh";
- $password = "N2vpf6Uf";
- // Create connection
- $conn = mysqli_connect($servername, $username, $password, "streamhu_liveviewers");
- // Check connection
- if (!$conn) {
- die("Connection failed: " . mysqli_connect_error());
- }
- $sql = "SELECT * FROM liveviewers WHERE serial LIKE '%".$key."%'";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- while($row = $result->fetch_assoc()) {
- if(($row['product'] == 0) && ($viewer > 100 || $chatviewer > 100)) {
- showError("You can only select up to 100 viewers with this package.");
- } else {
- if(true) {
- if($row['subscription'] == 0) {
- if($row['used'] == 0) {
- // einmalig
- $sqll = "UPDATE liveviewers SET used=1, channelname='".$channelname."' WHERE serial LIKE '%" . $key . "%'";
- if ($conn->query($sqll) === TRUE) {
- showInfo("Your views have been sent! If you encounter any problems, contact us via livechat or in our Discord.");
- file_get_contents("http://xxxx/liveViewers/".$channelname."/".$key."/".$viewer."/".$chatviewer."/".$time);
- $code = getHttpCode($http_response_header);
- } else {
- showError("An error occured, contact support. Error: 2");
- }
- } else {
- showError("This serial has already been used! Contact support if you think this is wrong.");
- }
- } else {
- if(true) {
- $sql = "UPDATE liveviewers SET used=1, channelname='".$channelname."' WHERE serial LIKE '%".$key."%'";
- if ($conn->query($sql) === TRUE) {
- showInfo("Your views have been sent! If you encounter any problems, contact us via livechat or in our Discord.");
- file_get_contents("http://xxxx/liveViewers/".$channelname."/".$key."/".$viewer."/".$chatviewer."/".$time);
- $code = getHttpCode($http_response_header);
- if($row['subscription'] == 1) {
- $sql2 = "UPDATE liveviewers SET subscription=".time()." WHERE serial LIKE '%".$key."%'";
- $conn->query($sql2);
- }
- } else {
- showError("An error occured, contact support. Error: 2");
- }
- } else {
- /// wöchentlich
- showError("An error occured, contact support. Error: 3 " . $use_date);
- }
- }
- } else {
- showError("An error occured. Contact support.");
- }
- }
- }
- } else {
- showError("Invalid purchase key. Contact support if you think this might be wrong.");
- }
- mysqli_close($conn);
- }
- } else {
- showError("Invalid purchase key. Contact support if you think this might be wrong.");
- }
- }
- ///
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement