HEX
Server: Apache
System: Linux msm5694.mjhst.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: camjab_ssh (1000)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: /home/httpd/html/baretube.com.new/admin/add.php
<?php
require "db.php";

if (isset($_POST['formSubmit'])) {
    $_POST = array_map_array('trim', $_POST);

    if ($_POST['title'] == "") {
        setMessage('Video "Title" cannot be empty!', 'error');
    }

    if ($_POST['url'] == "") {
        setMessage('Video "URL" cannot be empty!', 'error');
    }

    if (!getMessages(false, 'error')) {

        if ($_POST['type'] == 'host') {

            $new_filename = end(explode('/', $_POST['url']));
            $a = explode('?', $new_filename);
            $new_filename = $a[0];

            $filename = uniqid() . trim($new_filename);
            if (stripos($filename, '.flv') !== false) {
                $new_filename = substr($filename, 0, -4) . '.flv';
            } else {
                $new_filename = substr($filename, 0, -4) . '.mp4';
            }
            echo exec("$wget_path " . escapeshellarg(str_replace('\r', '', $_POST['url'])) . " -O \"$content_path/$filename\"");
            dbReconnect();

            $_POST['title'] = strip_tags($_POST['title']);
            $_POST['description'] = strip_tags($_POST['description']);

            $getUser = dbRow("SELECT `record_num` FROM `users` WHERE `username` = '" . mysqli_real_escape_string($dblink, $_POST['submitter']) . "'");
            $_POST['submitter'] = is_array($getUser) ? $getUser['record_num'] : 0;

            $filesize = filesize("$content_path/$filename");
            if (file_exists("$content_path/$filename") && $filesize > 0) {
                $insert_id = dbInsert('content', array(
                    'length' => $_POST['length'],
                    'title' => $_POST['title'],
                    'filename' => $new_filename,
                    'orig_filename' => $filename,
                    'thumbnail' => "$filename.jpg",
                    'description' => $_POST['description'],
                    'keywords' => $_POST['keywords'],
                    'scheduled_date' => 'NOW()',
                    'date_added' => 'NOW()',
                    'submitter' => $_POST['submitter'],
                    'ip' => $_SERVER['REMOTE_ADDR'],
                    'approved' => 0,
                    'pornstars' => $_POST['pornstars'],
                    'paysite' => $_POST['paysite'],
                ));
                if (is_numeric($insert_id)) {
                    if (count($_POST['niche']) > 0) {
                        foreach ($_POST['niche'] as $niche_id) {
                            dbQuery("INSERT INTO `content_niches` (`content`, `niche`) VALUES ('$insert_id', '$niche_id')");
                        }
                    }
                    if (count($_POST['pornstar']) > 0) {
                        foreach ($_POST['pornstar'] as $pornstar_id) {
                            dbQuery("INSERT INTO `content_pornstars` (`content`, `pornstar`) VALUES ('$insert_id', '$pornstar_id')");
                        }
                    }
                    setMessage('Content successfully added!');
                    header("Location: $_SERVER[REQUEST_URI]");
                    exit();
                } else {
                    setMessage('Cannot create new content!', 'error');
                }
            } else {
                setMessage('Cannot save content file or file is empty!', 'error');
            }
        } else {

            $new_filename = end(explode('/', $_POST['url']));
            $a = explode('?', $new_filename);
            $new_filename = $a[0];
            $filename = uniqid() . trim($new_filename);

            if (stripos($filename, '.flv') !== false) {
                $new_filename = substr($filename, 0, -4) . '.flv';
            } else {
                $new_filename = substr($filename, 0, -4) . '.mp4';
            }
            echo exec("$wget_path " . escapeshellarg(str_replace('\r', '', $_POST['url'])) . " -O \"$content_path/$filename\"");

            dbReconnect();

            $filesize = filesize("$content_path/$filename");
            if (file_exists("$content_path/$filename") && $filesize > 0) {
                $insert_id = dbInsert('content', array(
                    'length' => $_POST['length'],
                    'title' => $_POST['title'],
                    'filename' => $new_filename,
                    'orig_filename' => $filename,
                    'thumbnail' => "$filename.jpg",
                    'description' => $_POST['description'],
                    'keywords' => $_POST['keywords'],
                    'scheduled_date' => 'NOW()',
                    'date_added' => 'NOW()',
                    'submitter' => $_POST['submitter'],
                    'ip' => $_SERVER['REMOTE_ADDR'],
                    'approved' => 0,
                    'pornstars' => $_POST['pornstars'],
                    'paysite' => $_POST['paysite'],
                    'hotlinked' => $_POST['url'],
                ));
                if (is_numeric($insert_id)) {
                    if (count($_POST['niche']) > 0) {
                        foreach ($_POST['niche'] as $niche_id) {
                            dbQuery("INSERT INTO `content_niches` (`content`, `niche`) VALUES ('$insert_id', '$niche_id')");
                        }
                    }
                    if (count($_POST['pornstar']) > 0) {
                        foreach ($_POST['pornstar'] as $pornstar_id) {
                            dbQuery("INSERT INTO `content_pornstars` (`content`, `pornstar`) VALUES ('$insert_id', '$pornstar_id')");
                        }
                    }
                    setMessage('Content successfully added!');
                    header("Location: $_SERVER[REQUEST_URI]");
                    exit();
                } else {
                    setMessage('Cannot create new content!', 'error');
                }
            } else {
                setMessage('Cannot save content file or file is empty!', 'error');
            }
        }
    }
}

entities_walk($_POST);
?>

<? require "header.php"; ?>

<div class="content-page">

    <div class="header-area">
        <div class="breadcrumbs">  
            <a href="index.php">Admin Home</a>          
            <span><a href="add.php">Add Hosted/Hotlinked</a></span>  
        </div>
    </div>

    <div class="content-outer">  

        <h2>Add<strong>Hosted/Hotlinked</strong></h2>

        <div class="notification info">You can use this page to add a single video hosted on another server. Please be sure to put the media file url in the URL box rather then a gallery or player page url. Depending on the size of the file and the speed of the source server, it may take a few moments to download. This is neccesary even if you intend to hotlink the video on the source server, as the file is required locally to create thumbnails.</div>

        <div class="content-inner">

            <? echo getMessages(); ?>

            <form method="POST" action="" enctype="multipart/form-data" class="form" novalidate autocomplete="off">
                <table class="pagetable">
                    <thead>
                        <tr>
                            <th colspan="2">Add New Hosted/Hotlinked</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>Title</td>
                            <td><input name="title" type="text" required value="<? echo $_POST['title']; ?>" /></td>
                        </tr>
                        <tr>
                            <td>Description</td>
                            <td><textarea name="description" cols="45" rows="8"><? echo $_POST['description']; ?></textarea></td>
                        </tr>
                        <tr>
                            <td>Keywords</td>
                            <td><input name="keywords" type="text" value="<? echo $_POST['keywords']; ?>" /></td>
                        </tr>
                        <tr>
                            <td>Categories</td>
                            <td>
                                <select name="niche[]" multiple="multiple">
                                    <?php $results = dbQuery("SELECT `record_num`, `name` FROM `niches` ORDER BY `name`", false); ?>
                                    <?php foreach ($results as $_row) { ?>
                                        <option value="<?php echo $_row['record_num']; ?>"<? echo in_array($_row['record_num'], (array) $_POST['niche']) ? ' selected' : ''; ?>><?php echo $_row['name']; ?></option>
                                    <?php } ?>
                                </select>
                                <p class="hint">(Hold CTRL to make multiple selections)</p>
                            </td>
                        </tr>
                        <tr>
                            <td>Models</td>
                            <td>
                                <select name="pornstar[]" multiple="multiple">
                                    <?php $results = dbQuery("SELECT `record_num`, `name` FROM `pornstars` ORDER BY `name`", false); ?>
                                    <?php foreach ($results as $_row) { ?>
                                        <option value="<?php echo $_row['record_num']; ?>"<? echo in_array($_row['record_num'], (array) $_POST['pornstar']) ? ' selected' : ''; ?>><?php echo $_row['name']; ?></option>
                                    <?php } ?>
                                </select>
                                <p class="hint">(Hold CTRL to make multiple selections)</p>
                            </td>
                        </tr>
                        <tr>
                            <td>Paysite</td>
                            <td>
                                <select name="paysite">
                                    <?php $results = dbQuery("SELECT `record_num`, `name` FROM `paysites` ORDER BY `name`", false); ?>
                                    <?php foreach ($results as $_row) { ?>
                                        <option value="<?php echo $_row['record_num']; ?>"<? echo $_row['record_num'] == $_POST['paysite'] ? ' selected' : ''; ?>><?php echo $_row['name']; ?></option>
                                    <?php } ?>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td>User</td>
                            <td>
                                <input type="text" name="submitter" id="contentAutocomplete" value="<? echo $_POST['submitter']; ?>" placeholder="Start typing username..." />
                                <script type="text/javascript">
                                    $(document).ready(function () {
                                        $("#contentAutocomplete").autocomplete({
                                            source: "search_content.php?type=2",
                                            minLength: 2
                                        });
                                    });
                                </script>
                            </td>
                        </tr>
                        <tr>
                            <td>Video File URL</td>
                            <td><input name="url" type="text" value="<? echo $_POST['url']; ?>" required /></td>
                        </tr>
                        <tr>
                            <td>Add Type</td>
                            <td>
                                <select name="type">
                                    <option value="host"<? echo $_POST['type'] == 'host' ? ' selected' : ''; ?>>Host</option>
                                    <option value="hotlink"<? echo $_POST['type'] == 'hotlink' ? ' selected' : ''; ?>>Hotlink</option>
                                </select>
                            </td>
                        </tr>
                        <tr class="item submit">
                            <td colspan="2">
                                <input type="hidden" name="formSubmit" value="1" />
                                <button type="submit" class="btn action-save">Save</button>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <div class="notification info">Please hit submit only once! Depending on the size of the file and the speed of the source server, it may take a few moments to download. This is neccesary even if you intend to hotlink the video on the source server, as the file is required locally to create thumbnails.</div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </form>
        </div>
    </div>
</div>
<?php require "footer.php"; ?>