Nice. I like it.
Nice. I like it.
This member is now known as Sitting Out
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 :D
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>
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.
Hello,
Great work!
Just one thing : the script show and play the private video for everyone... :S
Any solution to avoid that ?
Regards
Pascal
Hi great code!
Hopefully the below will only show public videos and not private videos as requested above:
Regards,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>"; ?>
Mat.
------------------------------------
Make an arse of yourself:
http://www.youtwatonline.com
------------------------------------
Very nice, I like it! However is anyone else having problems with iframe in IE? The bottom of the video is cut off.
:S
dev
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?
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.
If it's not fun, stop doing it!
Well, I know *I'm* definately going to give this a try! THANKS!!!
If it's not fun, stop doing it!
Bookmarks