Go Back   BuyScripts Forums > vShare YouTube Clone > Template Modifications

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-08-2007, 06:47 AM
Senior Member
 
Join Date: Aug 2007
Posts: 334
Default Re: Add a truly random video to any page...

Nice. I like it.
__________________
This member is now known as Sitting Out
Reply With Quote
  #2 (permalink)  
Old 10-09-2007, 09:32 PM
Junior Member
 
Join Date: Sep 2007
Posts: 3
Default Re: Add a truly random video to any page...

Hi i found your code interesting and i did some research and came up with a different way to do it.
all credit to your code as it inspired me to do this:

PS. im a complete PHP novice

Code:
<?
$cnx = mysql_connect("localhost", "username", "password");
mysql_select_db("database", $cnx);
$sql = mysql_query("SELECT VID FROM video") or die (mysql_error());
while($row = mysql_fetch_array($sql)){
    $row_array[] = $row['VID'];
}

$random_row = $row_array[rand(0, count($row_array) - 1)];

$sql2 = mysql_query("SELECT flvdoname FROM video WHERE VID = '$random_row'") or die (mysql_error());

$row = mysql_fetch_object($sql2);

$flv = $row->flvdoname; 

?>

<html>
<head>
<script src="http://www.metahump.com/ajax/cpaint2.inc.js" type="text/javascript"></script>
<script src="http://www.metahump.com/js/myjavascriptfx.js" type="text/javascript"></script>
<script language=JavaScript src=http://www.metahump.com/js/indexonly.js></script>
<script language=JavaScript src=http://www.metahump.com/js/myjavascriptajax.js></script>
<script language=JavaScript src=http://www.metahump.com/js/myjavascript.js></script>
</head>

<body>


<?

echo "<div style=\"PADDING-RIGHT: 10px; PADDING-LEFT: 10px; padding-bottom: 2px; PADDING-TOP: 10px\">\n";

echo "<script type=\"text/javascript\" src=\"http://www.metahump.com/player/swfobject.js\"></script>\n";

echo "<p id=\"vshare_player\"><a href=\"http://www.macromedia.com/go/getflashplayer\">Get Flash</a> to see this player.</p>\n";

echo "<script type=\"text/javascript\" src=\"http://www.metahump.com/player/swfobject.js\"></script>\n";
echo "<script type=\"text/javascript\">\n";
echo "var so = new SWFObject(\"http://www.metahump.com/player/player.swf\",\"vshare_player\",\"425\",\"350\",\"8\");\n";
echo "so.addParam(\"allowfullscreen\",\"true\");\n";
echo "so.addVariable(\"file\",\"http://www.metahump.com/flvideo/", urlencode($flv), "\");\n";
echo "so.addVariable(\"image\",\"http://www.metahump.com/thumb/", urlencode($random_row), ".jpg\");\n";
echo "so.addVariable(\"logo\",\"http://www.metahump.com/templates/images/watermark.gif\");\n";
echo "so.addVariable(\"link\",\"http://www.yourdomain.com\");\n";
echo "so.addVariable(\"linktarget\",\"_blank\");\n";
echo "so.addVariable(\"width\",\"425\");\n";
echo "so.addVariable(\"height\",\"350\");\n";
echo "so.addVariable(\"displayheight\",\"330\");\n";
echo "so.addVariable(\"bufferlength\", \"5\");\n";
echo "so.addVariable(\"overstretch\", \"true\");\n";
echo "so.addVariable(\"autostart\", \"false\");\n";
echo "so.write('vshare_player');\n";
echo "</script>";

echo "</div>";

?>


</body>
</html>
Reply With Quote
  #3 (permalink)  
Old 10-10-2007, 01:14 AM
Junior Member
 
Join Date: Oct 2007
Posts: 8
Default Re: Add a truly random video to any page...

Those are both really good scripts. I'm also tapping into the art of php. I've already got down C# among a few others, so I thought that I might try to nail php.
Reply With Quote
  #4 (permalink)  
Old 10-16-2007, 08:54 AM
Junior Member
 
Join Date: Oct 2007
Posts: 1
Default Re: Add a truly random video to any page...

Hello,

Great work!

Just one thing : the script show and play the private video for everyone... :S
Any solution to avoid that ?

Regards

Pascal
Reply With Quote
  #5 (permalink)  
Old 10-16-2007, 11:18 AM
Senior Member
 
Join Date: Jun 2007
Posts: 210
Default Re: Add a truly random video to any page...

Hi great code!

Hopefully the below will only show public videos and not private videos as requested above:

Code:
<?
$cnx = mysql_connect("localhost", "username", "password");
mysql_select_db("database", $cnx);
$sql = mysql_query("SELECT VID FROM video WERE type = public") or die (mysql_error());
while($row = mysql_fetch_array($sql)){
    $row_array[] = $row['VID'];
}

$random_row = $row_array[rand(0, count($row_array) - 1)];

$sql2 = mysql_query("SELECT flvdoname FROM video WHERE VID = '$random_row'") or die (mysql_error());

$row = mysql_fetch_object($sql2);

$flv = $row->flvdoname; 

?>

<html>
<head>
<script src="http://www.metahump.com/ajax/cpaint2.inc.js" type="text/javascript"></script>
<script src="http://www.metahump.com/js/myjavascriptfx.js" type="text/javascript"></script>
<script language=JavaScript src=http://www.metahump.com/js/indexonly.js></script>
<script language=JavaScript src=http://www.metahump.com/js/myjavascriptajax.js></script>
<script language=JavaScript src=http://www.metahump.com/js/myjavascript.js></script>
</head>

<body>


<?

echo "<div style=\"PADDING-RIGHT: 10px; PADDING-LEFT: 10px; padding-bottom: 2px; PADDING-TOP: 10px\">\n";

echo "<script type=\"text/javascript\" src=\"http://www.metahump.com/player/swfobject.js\"></script>\n";

echo "<p id=\"vshare_player\"><a href=\"http://www.macromedia.com/go/getflashplayer\">Get Flash</a> to see this player.</p>\n";

echo "<script type=\"text/javascript\" src=\"http://www.metahump.com/player/swfobject.js\"></script>\n";
echo "<script type=\"text/javascript\">\n";
echo "var so = new SWFObject(\"http://www.metahump.com/player/player.swf\",\"vshare_player\",\"425\",\"350\",\"8\");\n";
echo "so.addParam(\"allowfullscreen\",\"true\");\n";
echo "so.addVariable(\"file\",\"http://www.metahump.com/flvideo/", urlencode($flv), "\");\n";
echo "so.addVariable(\"image\",\"http://www.metahump.com/thumb/", urlencode($random_row), ".jpg\");\n";
echo "so.addVariable(\"logo\",\"http://www.metahump.com/templates/images/watermark.gif\");\n";
echo "so.addVariable(\"link\",\"http://www.yourdomain.com\");\n";
echo "so.addVariable(\"linktarget\",\"_blank\");\n";
echo "so.addVariable(\"width\",\"425\");\n";
echo "so.addVariable(\"height\",\"350\");\n";
echo "so.addVariable(\"displayheight\",\"330\");\n";
echo "so.addVariable(\"bufferlength\", \"5\");\n";
echo "so.addVariable(\"overstretch\", \"true\");\n";
echo "so.addVariable(\"autostart\", \"false\");\n";
echo "so.write('vshare_player');\n";
echo "</script>";

echo "</div>";

?>
Regards,
Mat.
__________________
------------------------------------
Make an arse of yourself:
http://www.youtwatonline.com
------------------------------------
Reply With Quote
  #6 (permalink)  
Old 10-25-2007, 11:42 PM
Junior Member
 
Join Date: Oct 2007
Posts: 2
Default Re: Add a truly random video to any page...

Very nice, I like it! However is anyone else having problems with iframe in IE? The bottom of the video is cut off.
Reply With Quote
  #7 (permalink)  
Old 02-09-2008, 02:31 AM
Junior Member
 
Join Date: Feb 2008
Posts: 3
Default Re: Add a truly random video to any page...

:S
__________________
dev
Reply With Quote
  #8 (permalink)  
Old 02-10-2008, 07:03 PM
Member
 
Join Date: Aug 2007
Posts: 64
Default Re: Add a truly random video to any page...

Hello

Nice...what if i wanted to play one of the new videos or recently viewed videos from the main page using this script? Is it possible and if so, what is the coding adjustment?
Reply With Quote
  #9 (permalink)  
Old 02-21-2008, 10:50 PM
Senior Member
 
Join Date: May 2007
Location: Planet Earth
Posts: 1,449
Default Re: Add a truly random video to any page...

I would LOVE to have a random video too but not if it's going to show private videos.

There's got to be a way to do this....I'm thinking the answer lies somewhere in the code that makes private videos private....if we know how that works, then it's probably got something to do with how that part's coded as it stands. Does it have something to do with sessions? Like, depending on who the user is that's online? Joe Blow can't view Betty Boop's videos 'cos he's not on her friends list....that same thing would have to be done to the random video display...yes?

Private videos also do not show up in search results....another place to look for an answer?

Just throwing out ideas.
__________________

Reply With Quote
  #10 (permalink)  
Old 03-03-2008, 05:56 AM
Senior Member
 
Join Date: May 2007
Location: Planet Earth
Posts: 1,449
Default Re: Add a truly random video to any page...

Well, I know *I'm* definately going to give this a try! THANKS!!!
__________________

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Feature Request: Random Video grynmoors Feature Requests 0 07-16-2008 10:50 PM
make other page with new video like in index page cmedia Template Modifications 4 05-29-2008 10:23 PM
Random Video Image KnoPPerS Template Modifications 1 05-01-2008 01:58 PM
Carousel Random Viewer - OUT NOW!! galnet Template Modifications 23 11-29-2007 01:06 AM
Activate Random Featured Videos ofir General Discussions 6 06-13-2007 06:38 PM


All times are GMT. The time now is 02:20 PM.


Powered by vBulletin. Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO