Author Topic: Video and music upload profil page v 1.0  (Read 2429 times)

csibusz

  • Prime Member
  • ****
  • Posts: 165
  • Karma: +17/-2
Video and music upload profil page v 1.0
« on: August 05, 2014, 02:11:57 AM »


1.
Create music.php root folder: (and database connect settings 13. rows)

Code: [Select]
<?php
/******************************************************************************
Etano
===============================================================================
File:                       home.php
$Revision: 679 $
Software by:                DateMill (http://www.datemill.com)
Copyright by:               DateMill (http://www.datemill.com)
Support at:                 http://www.datemill.com/forum
*******************************************************************************
* See the "docs/licenses/etano.txt" file for license.                         *
******************************************************************************/
$con=mysqli_connect("localhost","etano","111111","etano");
// Check connection
if (mysqli_connect_errno()) {
  echo 
"Failed to connect to MySQL: " mysqli_connect_error();
}
mysqli_query($con,"SET NAMES 'utf8'");

require 
'includes/common.inc.php';
require 
_BASEPATH_.'/includes/user_functions.inc.php';
require 
_BASEPATH_.'/skins_site/'.get_my_skin().'/lang/home.php';
check_login_member('auth');

$tpl=new phemplate(_BASEPATH_.'/skins_site/'.get_my_skin().'/','remove_nonjs');
$output=array();

//video stat begin
$querymysql_query ("SELECT * FROM dsb_user_video WHERE userid={$_SESSION[_LICENSE_KEY_]['user']['user_id']} ");
$videomysql_result($query,0,0);
//video stat end

if (empty ($video)) {

if(isset(
$_POST['submit'])) { //upload buttom
$target"uploads/"//target map
$file_name $_FILES['file']['name']; //target file $_FILES superglobal 
$tmp_dir $_FILES['file']['tmp_name'];
 
if(!
preg_match('/(mp3|waw|mp4)$/i'$file_name) ) //if file name ($file_name) no mp3,waw,mp4 else...
{
echo 
"Error!"
}
else
{
//file name upload database
$valami $target.$_FILES['file']['name'];
$valamike $_SESSION[_LICENSE_KEY_]['user']['user_id'];
$valamikek $_SESSION[_LICENSE_KEY_]['user']['user'];
$date date("Y-m-d H:i:s");

$username mysqli_real_escape_string($con$valami);
$pic mysqli_real_escape_string($con$valamike);
$user mysqli_real_escape_string($con$valamikek);
$dat mysqli_real_escape_string($con$date);

$sql="INSERT INTO dsb_user_video (pic, userid, username, date)
VALUES ('
$username', '$pic', '$user', '$dat')";
//file upload database end

//file upload start
move_uploaded_file($tmp_dir$target $file_name); 
$feltoltve true
//file upload end




if (!mysqli_query($con,$sql)) {
  die(
'Error: ' mysqli_error($con));
}
$my_stats['complet'] =  "Upload Complet";

mysqli_close($con); //database connect close
}
}
}
else
{
if(isset(
$_POST['submit'])) { //upload buttom
$target"uploads/"//target map
$file_name $_FILES['file']['name']; //target file $_FILES superglobal 
$tmp_dir $_FILES['file']['tmp_name'];
 
if(!
preg_match('/(mp3|waw|mp4)$/i'$file_name) ) //if file name ($file_name) no mp3,waw,mp4 else...
{
echo 
"Error!"
}
else
{
//file name upload database
$valami $target.$_FILES['file']['name'];
$valamike $_SESSION[_LICENSE_KEY_]['user']['user_id'];
$valamikek $_SESSION[_LICENSE_KEY_]['user']['user'];
$date date("Y-m-d H:i:s");

$username mysqli_real_escape_string($con$valami);
$pic mysqli_real_escape_string($con$valamike);
$user mysqli_real_escape_string($con$valamikek);
$dat mysqli_real_escape_string($con$date);



mysqli_query($con,"UPDATE dsb_user_video SET pic='$username', userid='$pic', username='$user', date='$dat'  WHERE id='$video'"); 

//file upload database end

//file upload start
move_uploaded_file($tmp_dir$target $file_name); 
$feltoltve true
//file upload end




if (mysqli_query($con,$sql)) {
  die(
'Error: ' mysqli_error($con));
}
$my_stats['complet'] =  "Upload Complet";

mysqli_close($con); //database connect close
}
}
}
$tpl->set_file('content','music.html');
$tpl->set_var('output',$output);
$tpl->set_var('my_stats',$my_stats);
$tpl->process('content','content');

$tplvars['title']="Music upload";
$tplvars['page_title']="Music upload";

unset(
$page_last_modified_time); // we want everything fresh on this page.
include 'frame.php';

2. home php copy and paste code:

Code: [Select]
// video player begin
$query= mysql_query ("SELECT * FROM dsb_user_video WHERE userid={$_SESSION[_LICENSE_KEY_]['user']['user_id']} ");
while($row = mysql_fetch_array($query))
$my_stats['shoutbox']=  $row['pic'];
//video player end

3. create music.html (skins_site/def) folder:

Code: [Select]
<font color="red" size="8">{my_stats.complet}</font>
</br>

<form enctype="multipart/form-data" action="" method="post" />
<input type="hidden" name="MAX_FILE_SIZE" value="30000000" /> <!--file size max 30mb-->
<label for="file"> Chose music!</label><input id="file" type="file" name="file" />
<input type="submit" name="submit" value="Upload!" />

4.home.html copy and paste player :

Code: [Select]
<embed height="100" width="200" src="{my_stats.shoutbox}">
5.frame.html copy and paste menu:

Code: [Select]
<li><a class="menu1" href="{tplvars.relative_url}music.php" title="Chat"><span>Music upload</span></a></li>
6. import database table :

Code: [Select]
CREATE TABLE IF NOT EXISTS `dsb_user_video` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `pic` varchar(100) COLLATE utf8_hungarian_ci NOT NULL,
  `userid` varchar(255) COLLATE utf8_hungarian_ci NOT NULL,
  `username` varchar(255) COLLATE utf8_hungarian_ci NOT NULL,
  `date` varchar(100) COLLATE utf8_hungarian_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_hungarian_ci AUTO_INCREMENT=28 ;

h4a

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
Re: Video and music upload profil page v 1.0
« Reply #1 on: July 07, 2015, 02:17:57 PM »
It may sounds like a noob question. But its because i am a noob!
But always where will the latest Videos displayed? the Upload works great but i cant see them anywhere. Is there any other file i have to Change ?

Btw thanks for the script so far.

rexxx

  • Confirmed Member
  • **
  • Posts: 22
  • Karma: +0/-1
Re: Video and music upload profil page v 1.0
« Reply #2 on: August 04, 2015, 01:46:15 PM »
Where do the files get uploaded too???
Richard

rexxx

  • Confirmed Member
  • **
  • Posts: 22
  • Karma: +0/-1
Re: Video and music upload profil page v 1.0
« Reply #3 on: August 08, 2015, 10:05:12 AM »
Oh Boy another site with very few answers, guess it is time to keep searching for help on another script 4 days and nothing. I added this script and see nothing anywhere other then the upload button for music and then nothing else. I guess I should remove this video and music addon as it doesn't seem to work. Or I am just not getting it!! I have 30 years working with scripts many fail because they just don't explain them correctly. I was a sysop in the early 90's running wildcat bbs on 2 OS/2 Servers with 5 phone lines created my own network card scripts and hundreds of addons and still have 30 websites with many addons SO I know when there is something not explained correctly wish programmers would understand not everyone is one.
Richard

KHDev

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 509
  • Karma: +43/-2
  • Etano Contributor (Skins & Mods)
    • KH Web Development
Re: Video and music upload profil page v 1.0
« Reply #4 on: August 08, 2015, 12:09:39 PM »
Oh Boy another site with very few answers, guess it is time to keep searching for help on another script 4 days and nothing. I added this script and see nothing anywhere other then the upload button for music and then nothing else. I guess I should remove this video and music addon as it doesn't seem to work. Or I am just not getting it!! I have 30 years working with scripts many fail because they just don't explain them correctly. I was a sysop in the early 90's running wildcat bbs on 2 OS/2 Servers with 5 phone lines created my own network card scripts and hundreds of addons and still have 30 websites with many addons SO I know when there is something not explained correctly wish programmers would understand not everyone is one.

Unfortunately this happens with contributions wide and far. From what I can see it looks more like a 'half baked' contribution which could probably be adapted from a simple media upload/playback tutorial.





maverick

  • Administrator
  • Veteran Member
  • *****
  • Posts: 3005
  • Karma: +210/-7
    • Maverick Webworks
Re: Video and music upload profil page v 1.0
« Reply #5 on: August 08, 2015, 06:02:43 PM »
KHDev is right, this appears to be a half-baked attempt at creating a mod. Although I think csibusz had good intentions in trying to contribute, but unfortunately many of his mods found in the forums are pretty much the same, they have poor instructions and/or don't function very well. Also, many contributors don't stick around long and often abandon the forums and/or their mods, which means you won't get a reply in regards to help with it, unless it's a popular mod that quite a few others are already using, then one of them may be willing to step in and provide some help.

A good indication that mod or feature probably isn't any good is by the amount of posts made, such as this one where there wasn't any posts made for year after the author posted the mod.

Having a feature where members can upload their videos to your server may sound appealing to some, but most users are on low-end shared hosting which have polices in regards to uploading and streaming of large video files, and doing so can lead to your account and/or site being shut down without prior notice.

Being an open source project, the forum relies on contributors for many of it's features as well as fixes, some of which are very good and will sometimes even land up implemented in a future version release. However, just because someone posts a mod doesn't mean the rest of the community are going leap on the band wagon and provide support for it. It's mainly the responsibility of the contributor who posted it.

Fusion Responsive Template & Free Mods
http://www.maverickwebworks.com
DO NOT PM me asking for personal help. Post your problem or request in the forums so the entire community can contribute and benefit.

Hornyflings

  • Prime Member
  • ****
  • Posts: 194
  • Karma: +3/-0
    • AsiasHeart
Re: Video and music upload profil page v 1.0
« Reply #6 on: December 25, 2015, 02:06:00 PM »
Quote
Having a feature where members can upload their videos to your server may sound appealing to some, but most users are on low-end shared hosting which have polices in regards to uploading and streaming of large video files, and doing so can lead to your account and/or site being shut down without prior notice.

There are options too, upload videos to third party solution, for instance VideoMega.tv, which offer hosting and streaming for free, even when it comes to adult content. If there would be a video addon which will work similar to the photo function including private video option am willing to pay for such an addon.