Results 1 to 3 of 3

Thread: Show your random videos on any site

  1. #1
    Join Date
    Jun 2009
    Posts
    3

    Lightbulb Show your random videos on any site

    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

  2. #2
    Join Date
    May 2007
    Location
    Planet Earth
    Posts
    1,389

    Default

    Can we replace the db stuff with include config?
    If it's not fun, stop doing it!

  3. #3

    Default

    Is that safe?

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •