This script will allow you to show your videos random on any site.
Code:
<?php
echo "<?xml version='1.0' encoding='iso-8859-1'?>";
$dbhost = "localhost"; // hostname on which MySQL is (usally localhost)
$dbname = "your db name"; // Database name
$dbuser = "your db user"; // Username
$dbpass = "your db pass"; // Password
$webpath = "your website location";// Domain Location
$picw = "200";//Picture Width
$pich = "180";//Picture Height
$divh = "200"; //This is should always be 20+ from your picture Height example if your pic Width is set to 80 this should be set to 100.
// mysql_connect() fnction
$conn = mysql_connect($dbhost,$dbuser,$dbpass)
or die("Unable to connect to MySQL.");
// mysql_select_db() function
mysql_select_db($dbname,$conn)
or die("Unable to connect to Database $dbname");
$sql = "Select video_id, video_title, video_description, video_add_date, video_flv_name, video_duration from videos where video_approve=1 and video_active=1 ORDER BY RAND() LIMIT 0,9";
// execute SQL Command
$res = mysql_query($sql,$conn)
or die( "Error: " . mysql_error() );
// Retrieve Results
while ($info = mysql_fetch_row($res)) {
$SefUrl=strtolower(preg_replace("/[^a-zA-Z0-9]+/","-", $info[1]));
$title=str_replace("&","e", $info[1]);
$title=str_replace("\"","", $title);
$desc=str_replace("&","e", $info[2]);
$desc=str_replace("\"","'", $desc);
$desc=str_replace("<","", $desc);
$desc=str_replace(">","", $desc);
echo('<div style="width:' .$picw. ';' . 'overflow:hidden;'. 'height:' .$divh. ';' .'text-align:center;'. 'align:center;'. 'background-color:#480024;'.'link:#ffffff;'.'margin: 9px;'.'padding: 2px;'.'font-size: 15px;'.'">');
echo('<a target ="_top" href="' . $webpath . '/view/' .$info[0]."/".$SefUrl. "/". '">');
echo('<IMG SRC="' . $webpath . '/thumb/' . '1_' .$info[0]. '.jpg' . '" alt=' .$title. ' '. 'border=0 width=' .$picw. ' height=' .$pich. '>');
echo(''.$title.'' . '</a>' );
echo('</div>');
//outputs path from /userspics
echo "<url>
</url>";
}
echo "</urlset>";
// mysql_close() function
mysql_close($conn);
?>
im still working on this code but you can see it working here http://videos.colombiascortvip.com:81/ranvid.php
Bookmarks