Help me Please: problem with random video in php script

administer

Junior Member
Nov 19, 2008
100
2
Hello,
I have a redtube script for adult videos: xkeez.com
would like to have the videos go from: A to Z in loop, no duplicate, when clicked on the link.
videos numbers are in a .txt file
what will be the php code for this. I'm not a php programmer, but have some knowledge of html.
Thank you for your help.
regards,
 
Hello,
here's the code:

$videos = file("videos numbers.txt"); // file with redtube numbers (1 to X)
shuffle($videos);

videos numbers are in a .txt file
- How would you write this so one would have the videos go from: 1 to X in loop, no duplicate, when clicked on a link.
Thank you for your help
 
Lets take a look at your code:

Code:
$videos = file("videos numbers.txt");
This code is reading your text file into a PHP array.

Code:
shuffle($videos);
This code is shuffling the array around.

So to put these in numerical order, you would replace:

Code:
shuffle($videos);

WITH

Code:
sort($videos);

I am not sure what you mean when you say "when clicked on a link." could you explain a little bit more what you are trying to have happen?
 
hello,
thank you for your help.
as videos do not change after one another, i have a javascript under a link so that when i clic on that link it goes from video1 to video 2 but as it's random, it goes to any number.
as for your code, it plays only the first video over and over.
you can see it here: http://xkeez.com
 
I understand now.

Try this:

REPLACE

Code:
$videos = file("videos numbers.txt"); // file with redtube numbers (1 to X)
shuffle($videos);

WITH

Code:
//get the video ids from the txt file
$videos = file("videos numbers.txt");

//sort the video ids
sort($videos);

//lets get a count of the videos
$total_vids = count($videos);

//lets set the counter to 0 if its not already set
if ($_GET['counter'] == '' || !isset($_GET['counter'])){
	$counter = 0;
} else {
	$counter = $_GET['counter'];
}

//lets make sure the counter isn't past the last video, if it is then start over again
if ($counter >= $total_vids){
 $counter = 0;
}

//this is the video id of the current video
$video_id = $videos[$counter];

//this gets the next id in the array
$counter++;

And then replace the link you have at the bottom:

Code:
<a href="http://xkeez.com/amateur.php">Click here for new video-Cliquer ici pour une autre Video</a>

WITH

Code:
<a href="http://xkeez.com/amateur.php?counter=<?=$counter?>">Click here for new video-Cliquer ici pour une autre Video</a>

Pretty much what you would do is use the $video_id variable in the embed for the video on your page. I think this should accomplish what you are attempting.

Hope this helps.
 
Last edited:
hello,
thank you for your help. it does not work
video numbers in .txt file are not consecutive order and are not 1,2,3,4 but in this order and style:
1008
200
576
32
 
Sorry, my mistake, You should make a small change:

REPLACE

Code:
sort($videos);

WITH

Code:
sort($videos, SORT_NUMERIC);

That should make it sort in the correct order.
 
Here is the full page with your html and the player embedded:

amateur.php
Code:
<?php
//get the video ids from the txt file
$videos = array();

$videos = file("videos numbers.txt");

//sort the video ids
sort($videos, SORT_NUMERIC);

//lets get a count of the videos
$total_vids = count($videos);

//lets set the counter to 0 if its not already set
if ($_GET['counter'] == '' || !isset($_GET['counter'])){
	$counter = 0;
} else {
	$counter = $_GET['counter'];
}

//lets make sure the counter isn't past the last video, if it is then start over again
if ($counter >= $total_vids){
 $counter = 0;
}


//this will print the video id
$video_id = $videos[$counter];

//this gest the next video id in the array
$counter++;
?>
<style type="text/css">
<!--
body {
	margin-top: 25px;
	background-color: #000000;
}
.Style3 {font-size: 14px}
body,td,th {
	color: #FFCC00;
}
a:link {
	color: #FF3300;
}
a:visited {
	color: #FFCCFF;
}
.Style4 {font-size: 12}
-->
</style>
<title>Doctissimo - Hentai - doujin - Sex - Sexe - Chiennes en Chaleur - Amateur - Baise - Youtube - Sexy </title><table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
  
  <tr>
    <th width="156" rowspan="2" align="center" valign="middle" scope="row"></th>
    <th height="297" scope="row"><table width="95%" height="344" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>

        <th width="50%" align="center" valign="middle" scope="row"><object height="344" width="434"><param name="movie" value="http://embed.redtube.com/player/"><param name="flashvars" value="id=<?=$video_id?>
&style=redtube"><embed src="http://embed.redtube.com/player/?id=<?=$video_id?>
&style=redtube" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" height="344" width="434"></object></th>
        <td width="50%" align="center" valign="middle">      <!-- Start Code -->
      <iframe src="http://adwords.idoo.com/banner.php?action=b&t=true&ref=25&w=434&h=344&grp=13" width="434" height="344" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" allowtransparency="true" background-color="transparent"></iframe>      <!-- End Code --></td>
      </tr>
    </table>
</th>
  </tr>
  <tr>

    <th height="120" scope="row"><table width="92%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <th width="78%" height="97" align="center" valign="top" scope="row">

<br><br><a href="amateur.php?counter=<?=$counter?>">Click here for new video-Cliquer ici pour une autre Video</a><br />
         </th>
        <td width="22%" align="left" valign="top"><a href="rss.xml" target="_blank"><img src="rss.png" alt="Get Sexy Rss" width="105" height="69" border="0" /></a></td>
      </tr>

    </table></th>
  </tr>
</table>

Lemme know if that works for you.
 
Last edited:
waow, it works. thank you so much.
i've a last question, how can i make this to work in Internet Explorer because it only works with Firefox
 
oops, try this:

REPLACE

Code:
$video_id = $videos[$counter];

WITH

Code:
$video_id = trim($videos[$counter]);
 
hello,
thank you so much for your help.
if you need translation from french to english or vice versa just let me know, i'll do it for free.
can i give you a rep for your great help
 
Back
Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features and essential functions on BlackHatWorld and other forums. These functions are unrelated to ads, such as internal links and images. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock