Hi all. could an expert show me how i can generate random non repeated numbers. I want to use those number as file name that i write to. currently the file name is ram.txt but i want it the file name to be like 948450913.txt each time the scripts runs diffrent number .I be happy if an expert show me how to do that here in this code?thanks
Code:
<?php
[B]$url[1] = "[url="http://localhost/flash_mp3_player/mp3/08"]http://localhost/flash_mp3_player/mp3/08[/url] - Track 8.mp3";
$url[2] = "[url="http://localhost/flash_mp3_player/mp3/13"]http://localhost/flash_mp3_player/mp3/13[/url] - Gar Aya.mp3";
$url[3] = "[url="http://localhost/flash_mp3_player/mp3/Soroush"]http://localhost/flash_mp3_player/mp3/Soroush[/url] - Yeh Donya - 02 Shoghe Nafas.mp3";[/B]
$mycontent = "";
if (isset($_GET["sid"]))
{
$allsid = explode (",",$_GET["sid"]);
$mycontent = array();
foreach ($allsid AS $value)
$mycontent[] = $url[$value];
}
echo $mycontent;
[B]$handle = fopen ("ram.txt","w+");[/B]
if ($handle)
{
if (fwrite ( $handle,implode("\r\n",$mycontent)."\r\n") )
{
echo "FILE IS WRITTEN SUCCESSFULLY";
} else
{
echo "ERROR IN WRITING TO FILE";
}
fclose ($handle);
} else
{
echo "ERROR IN OPENING FILE";
}
require 'config.txt';
?>