Premium Media Script

Premium Media Script is a PHP script that allows you to run your own media website.

Documentation on how to set up and use Premium Media Script. You will use understand how to use all of its features including configuration and its API. This guide also cover all of its major features. If you stumble upon an issue or if you need help, please contact us.

Found an issue? Please open an issue at our official GitHub page and we will resolve it as soon as possible

License

Two types of license are available: Regular or Extended. If you are using this script for multiple websites, you must buy a license for each of them.

Items purchased under a Regular or Extended License may NOT be redistributed or resold "as-is" or as part of any other collection of image resources or files. You do not own the software but simply own a license to operate it therefore the author of this item has full rights on this item.

Regular License Examples (from Envato)

Use, by you or one client, in a single end product which end users are not charged for. The total price includes the item price and a buyer fee. The Regular License could be used for the following:

  • Single website (commercial, personal, or non-profit).
  • Single website for a client (commercial, personal, or non-profit).
  • Single intranet site project.

Extended License Examples (from Envato)

Use, by you or one client, in a single end product which end users can be charged for. The total price includes the item price and a buyer fee. The Extended License could be used for any of the following:

  • An online service where the file can be displayed on multiple users' pages.
  • Part of a software package for sale such as SaaS.

Installation

The installation of this script is very trivial. Simply follow the instructions below and you will be ready to launch your new media site in about 5 minutes from now.

  • Upload and extract the compressed file main.zip to the root of your server.
  • Make sure that the folder content and all of its sub-folders are writable (Permission 755)
  • Point your browser to your site and you should be redirected to the installer. If not point your browser to https://yoursite.com/install.php
  • Once on the installer, read and follow instructions as the installer will guide through the installation of this script.

Upgrading

All upgrading instructions are detailed in "upgrade.html" located in the Documentation folder. Simply open that and follow the instructions according to the version of the script. Please note that some update may require you to replace all files while others only a couple of files. In both cases it is strongly recommended that you first backup all your existing files and download it to your computer.

It is strongly recommended to backup your files regularly as in rare occasion an update might not work with your server configuration and you need to roll back.

Migration

To migrate from one server to another, you need to proceed with care to not lose any data or functionality. Please follow the instruction below to letter without skipping anything to prevent loss of data.

  1. Enable maintenance mode in the admin panel > settings.
  2. First backup and download all your files (compress and download)
  3. Go to phpmyadmin > your database > export the shortener database
  4. On your new server, go to phpmyadmin > new database > import the SQL file
  5. If you are changing your domain name, go to the settings table then change it under "url".
  6. Then on your new server, upload and extract the compressed files
  7. Open the file includes/Config.php and change your database info manually.
  8. Finally, login as admin and disable maintenance mode.

If you are having trouble migrating, our team can help you migrate safely! Please contact us.

Features

Here is a glimpse of some of the most awesome features this script has to offer.

Import Media

Import what ever you want and however you want. A lot of effort has went into the import system so you can import anything from some majors sites like Youtube, Vine, Vimeo, Dailymotion, etc. Here is how you can import media.

  1. Import using the URL to the video
  2. Import using the Bookmarklet that is found in the admin panel > Import a Single Video
  3. Mass Import from Youtube using the live admin interface

Add Custom Media

You would rather upload a custom media? No problem. Use the interface to upload video and image files of the following format: mp4, jpg, png and gif. Please note that this script doesn’t convert videos nor does it generate thumbnails from videos!

Featured and NSFW

You can tag a media file as featured and/or NSFW to make them stand from other media. Featuring a video will prioritize that video while tagging it as NSFW will prevent users who have NSFW option disabled to view them. Regarding NSFW, you will have to make sure that you add the minimum age required to register in your TOS because if a user registers they will have access to NSFW content.

Report

Registered users can report any content. Whether it is a media file, user or comment, it can be reported. You will be able to moderate reports via the admin panel.

Categories and Types

One of the most important feature of this script is the ability to assign a type. Assigning a type to media makes a big difference so you have to make sure to properly assign it. For example don't assign a picture the video category or vice versa. The built-in types are video, music, vine and picture. This gives you the ability to run a one-script-multimedia-site with ease. You also have to properly assign a type of the categories.

User Profile and Subscription

User can subscribe to each other and receive notification when there is a new media.

Settings

Once you have successfully installed the script, you will be able to fully customize it before importing/adding media. Login as admin then you will see your own admin bar at the very top of the script. This admin is dynamic meaning that the content will change depending on which page you are. Look at the right side to find Configuration and click that to configure the script.

General Settings

Under this tab you will find all of the important settings you will need for your site. Fill these as you wish. Notice the email field is used for many things. It first of all used as the sender when the script sends an email. So you will want to make sure you provide a good email. Also filling the social links will activate sidebar widgets. Please make sure that the link you provide is working and is of the proper format.

Application Settings

This tab groups the main settings you will need to customize your site. Their function is very easy to understand so there is not much to say more. Notice the “Blacklist Words” field as this is used to filter bad words and replace them by an asterisk *. You will need to separate words with a comma. Example badword1,badword2,badword3

Security Settings

You can enabled catpha to prevent bots from creating accounts or submitting forms. To do so you have options: reCaptcha or Solvemedia. reCaptcha is a very popular captcha system provided by Google. It is free and you can use you Google account to create keys. Solvemedia is another alternative however this system allows you to monetize on captchas. Once you create your account they will give three keys. You will need to add those keys in the file includes/library/Solvemedia.php.

Media Settings

These settings allows you to change how media looks and upload settings. The display mode setting will switch the script from being a more Youtube-style to a 9gag-style.

Local Thumbnails

This a very important setting so you will want to clear your mind on whether you want to store them locally or link to them. You must not change this after your have upload/imorted your first media! All thumbnail are stored in the /content/thumbs folder.

Maximum Upload Size

This is another important setting. The maximum upload size is determined by your server configuration. Look under this field to determine what is your maximum upload limit. Note that if you set a size higher than this, the script will set the lower limit as the size limit. Example if you set 100MB and your server’s limit is 10 MB then the script will set it as 10 MB.

Advertisement Configuration

This script allows you to add any advertisement code you wish and it will display it wherever it fits. You can also enable or disable ads with a single click. The three main sizes are 728×90, 468×60 and 300×250. However there are also two other slots. One that is reserved for video pre-roll and the other one should be a responsive ad because it will be shown on mobile platforms. Notice if you empty the preroll ad then it will not show up otherwise it will show before the viewer is able to click play. You can also change the time the viewer has to wait before being able to play a video.

You can easily display any of the ads anywhere you want to by using the following php code, where SIZE can be any of the following: 728, 468, 300, rep

<?php echo $this->ads('SIZE'); ?>

Social Login

The script includes authentication methods from 3 major social networks such as Google, Twitter and Facebook. Before you can use any of these, they will need to be setup. Follow the instructions below to the letter otherwise it might not work.

oAuth logins are very strict with the Callback URL. Make sure to respect the oAuth callback mentioned under each of the social network below.

Facebook Connect Video Tutorial

Users can login with their Facebook and bookmark their favorite sites. To set up your app, first go to https://developers.facebook.com and set up a new app by clicking "Apps". Then click "Create New App"; Facebook will ask you to configure your app. The most important fields you must fill out are App Domains and Site URL. For the oAuth Callback, add https://yoursite.com/user/login/facebook. Following that Facebook will generate two keys for you. Go to the admin settings and paste those keys. That's it. If you did everything correctly Facebook connect should work.

Callback URL

https://yoursite.com/user/login/facebook

Twitter Connect Video Tutorial

Users can login using twitter the same way they use facebook. You must enable twitter connect for it to appear and function. You can do that on the admin panel. You must register your website on Twitter.com

  1. Go to https://dev.twitter.com/apps and login.
  2. Then click "Create a new application" on top right
  3. Fill the required fields, add this to the callback field: https://yoursite.com/user/login/twitter, accept the terms and conditions and click "Create your Twitter application".
  4. You will then be redirected to a page with your OAuth Settings
  5. Search & Find two keys: Consumer Key and Consumer Secret. Copy these keys and paste them in the admin settings
  6. Finally, under "settings" of your application on twitter you will see "Allow this application to be used to Sign in with Twitter". Check that and click "Update this twitter application's settings".

If you did everything correctly, Twitter OAuth should work. If it doesn't, send us an email and we will help you.

Callback URL

https://yoursite.com/user/login/twitter

Google Connect Video Tutorial

Google connect protocol has been changed due to restrictions from Google. For this reason you will need to set up Google connect again. Simply follow the instructions below and it should be fairly simple.

  1. Go https://code.google.com/apis/console and login using your Google Account
  2. On the left side click "Credentials"
  3. Then click "Create new Client ID" to open the popup
  4. Select "Web Application"
  5. Add your domain name as "https://yoursite.com" under Authorized Javascript Origins
  6. Add the URI to Google Connect under Authorized Redirect URI as https://yoursite.com/user/login/google
  7. Generate a public key and client secret and add those in the admin panel

Callback URL

https://yoursite.com/user/login/google

API

The script now comes with custom API system that enables only the admin to develop app. First you need to enable the API system via the admin panel under "Social & API Settings". Then you will be able to define a custom API key which you can use to grab media. For all requests, you need to send the key parameter which includes your API key.

Media EndPoint

This endpoint allows you to retrieve information regarding a particular media. The endpoint is

GET /api/view/UNIQUEID

Parameter Description
key (required) Your API key.
GET http://yoursite.com/api/view/abcd5?key=YOURAPIKEY
{
"status" : "ok",
"data" : {
   "id" : "jezQH",
   "url" : "http:\/\/mysite.com/view\/don-omar-taboo\/jezQH",
   "title" : "Don Omar - Taboo",
   "description" : "Download now on:\niTunes: http:\/\/bit.ly\/1emlRdS \nAmazon:  http:\/\/amzn.to\/17xXn96\n\nVisit http:\/\/universalmusica.com\/donomar for more music and news from Don Omar.",
   "duration" : 293,
   "votes" : 1,
   "views" : 11,
   "likes" : 1,
   "comments" : 2,
   "embed" : "<iframe src='http:\/\/mysite.com\/embed\/jezQH' frameborder='0' width='550' height='350' scrolling='no' allowfullscreen><\/iframe><p><a style='color: #000; text-decoration: none;' href='http:\/\/mysite.com\/view\/don-omar-taboo\/jezQH' title='Don Omar - Taboo'>Don Omar - Taboo<\/a><\/p>",
   "author" : {
      "name" : "Admin",
      "link" : "http:\/\/mysite.com\/user\/admin"
   }
 }
}

Search EndPoint

This endpoint allows you to search media. The endpoint is

GET /api/search/KEYWORD

Parameter Description
key (required) Your API key.
limit (required) Number of media to show per page
order (optional) Filter results by "views", "date" or "votes"
page (optional) Current page
GET http://yoursite.com/api/search/KEYWORD?key=YOURAPIKEY&limit=10&order=views&page=1
{
"status" : "ok",
"results" : 10,
"prev" : 1,
"next" : null,
"data" : [
   {
      "id" : "8UDm4",
      "url" : "http:\/\/yoursite.com\/view\/mcdonalds-excorcism-prank-ownage-pranks\/8UDm4",
      "title" : "McDonalds Excorcism Prank - Ownage Pranks",
      "description" : "This is a second call I did to a McDonalds manager who used to be a crack head. The last time I spoke to him he said he could remove the devil from my soul.. so this time I called back and took him up on his offer.. lmao\n\n\nBecome my facebook fan! I pre-release my videos on facebook, so you'll see them before they appear on my YouTube profile (The facebook version is uncensored)  http:\/\/www.facebook.com\/OwnagePranks\n\nRegister and join the community @ http:\/\/www.ownagepranks.com\n\nFollow me on twitter! http:\/\/twitter.com\/OwnagePranks\n\nIf you do all this you'll definitely catch my next live show!\n\nComment and subscribe!",
      "duration" : "325",
      "votes" : "0",
      "views" : "0",
      "likes" : "0",
      "comments" : "0",
      "embed" : "<iframe src='http:\/\/yoursite.com\/embed\/8UDm4' frameborder='0' width='100%' height='450' scrolling='no' allowfullscreen><\/iframe>"
   },
   {
      "id" : "PwRoR",
      "url" : "http:\/\/yoursite.com\/view\/insane-cheating-girlfriend-prank-animated-ownage-pranks\/PwRoR",
      "title" : "Insane Cheating Girlfriend Prank (animated) - Ownage Pranks",
      "description" : "I called a black guy as Tyrone and pretended like I've been cheating with his long-term girlfriend. His reaction is amazing. Help support these animations by sharing the video with a friend! :) Subscribe for free to catch my future videos - http:\/\/own.ag\/youtube\n\nSecond Channel Reveal (Part 2) - http:\/\/own.ag\/eN\n\nIndian Windows Scammer Prank - http:\/\/own.ag\/cJ\nRidiculous Home Buying Prank - http:\/\/own.ag\/dD\n\nFacebook--------------------- http:\/\/facebook.com\/OwnagePranks\nTwitter ------------------------ http:\/\/twitter.com\/OwnagePranks\n2nd channel \/ Extras ---- http:\/\/youtube.com\/MrOwnagePranks\nMerchandise ---------------- http:\/\/ownagepranks.spreadshirt.com\n\nAnimated by Sam T - http:\/\/youtube.com\/EbolaWorld",
      "duration" : "264",
      "votes" : "0",
      "views" : "0",
      "likes" : "0",
      "comments" : "0",
      "embed" : "<iframe src='http:\/\/yoursite.com\/embed\/PwRoR' frameborder='0' width='100%' height='450' scrolling='no' allowfullscreen><\/iframe>"
   }
 ]
}            

User EndPoint

This endpoint allows you to get a user's media. The endpoint is

GET /api/user/USERNAME

Parameter Description
key (required) Your API key.
limit (required) Number of media to show per page
order (optional) Filter results by "views", "date" or "votes"
page (optional) Current page
GET http://yoursite.com/api/search/KEYWORD?key=YOURAPIKEY&limit=10&order=views&page=1
{
"status" : "ok",
"results" : 142,
"prev" : 0,
"next" : 2,
"author" : {
   "name" : "",
   "description" : "We have the best videos every! Sit back and enjoy our videos!",
   "cover" : "http:\/\/yoursite.com\/static\/covers\/cover-1.jpg",
   "avatar" : "http:\/\/yoursite.com\/content\/users\/JOjSxejI_avatar.jpg"
},
"data" : [
   {
      "id" : "jezQH",
      "url" : "http:\/\/yoursite.com\/view\/don-omar-taboo\/jezQH",
      "title" : "Don Omar - Taboo",
      "description" : "Download now on:\niTunes: http:\/\/bit.ly\/1emlRdS \nAmazon:  http:\/\/amzn.to\/17xXn96\n\nVisit http:\/\/universalmusica.com\/donomar for more music and news from Don Omar.",
      "duration" : "293",
      "votes" : "1",
      "views" : "11",
      "likes" : "1",
      "comments" : "2",
      "embed" : "<iframe src='http:\/\/yoursite.com\/embed\/jezQH' frameborder='0' width='100%' height='450' scrolling='no' allowfullscreen><\/iframe>"
   }      
 ]
}            

Frequently Asked Questions

The installer is stuck at step 3 and I am seeing a blank page.

Although this can be caused by many reasons, a common cause is that the script was not able to open and write in the file includes/Config.sample.php. Open this file and check if your DB info has been saved. If not manually replace the placeholders (like RHOST,RUSER) by the actual info. Another reason you may see a blank page at step 3 is that the script wasn’t able to rename the file includes/Config.sample.php to includes/Config.php. You will need to do this manually.

The time is showing as a negative or huge value.

If the time is shown correctly then that means your server’s timezone was not set correctly. You will need set the correct timezone to fix this. To set the timezone, open the file includes/Config.php and add your timezone on right side of arrow. You can get your timezone from https://php.net/manual/en/timezones.php.

I keep getting a 404 page whenever I click on something.

If you get a 404 page (the one generated by your server) then that means you did not upload the file .htaccess or your server doesn’t support the mod rewrite module. If you did not upload the file .htaccess then you will need to upload to the root of your server. If for some reason you cannot see that file in the package, you will need to create that file using cpanel’s editor (or equivalent) to create a new file named .htaccess and put the following code in it.


AddType video/mp4 .mp4
#Options -MultiViews 
#Options -Indexes

<IfModule mod_rewrite.c>
  ## Uncomment (remove # ONLY NOT ##) line below if installed in folder and add folder name after /
  ## Example: Script is installed in /public_html/folder/ then it should be: Rewritebase /folder/
  ## Then the files below should be (add slash to all): /index.php?action=$1
  ## Uncomment the code below to Use PHP 5.4
  # AddHandler application/x-httpd-php54 .php

  RewriteEngine On

  ## Uncomment the following line to use the multi-domain feature
  # RewriteCond %{HTTP_HOST} ^yourseconddomain\.com$ [NC]
  # RewriteRule ^(.*)$ http://yourfirstdomain.com/$1 [R=301,L]

  #Rewritebase /
  ## Admin Panel
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^admin/(.*)?$ admin/index.php?a=$1 [QSA,NC,L]

  ## Application Handler
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)?$ index.php?a=$1  [QSA,NC,L]
</IfModule>

## Error 404 ##
ErrorDocument 404 /index.php?a=404