Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //die('ALREADY GENERATED');
- set_time_limit(0);
- define('_PATH', 'links/');
- $links_gerados = array();
- $num_to_generate = 2000;
- $gerados = 0;
- $to_repeat = array();
- while($gerados <= $num_to_generate)
- {
- if(count($links_gerados) == 10)
- {
- $string = implode("\r\n", $links_gerados);
- write_file($string);
- $string = '';
- $links_gerados = array();
- }
- $link = generate_link();
- $links_gerados[] = $link;
- $gerados++;
- if($gerados % 5)
- {
- $to_repeat[] = $link;
- }
- }
- if(count($to_repeat) > 0)
- {
- $repeated = array();
- $generated = 0;
- foreach($to_repeat as $_link)
- {
- if(count($repeated) == 30)
- {
- $string = implode("\r\n", $repeated);
- write_file($string);
- $string = '';
- $repeated = array();
- }
- $repeated[] = $_link;
- }
- }
- echo 'Links gerador: ' . $gerados;
- function get_total_links()
- {
- return mt_rand(5, 10);
- }
- function generate_link()
- {
- $get = array('h=', 's=', 'f=', 'hg=', 'source=');
- $get_value = array('hg', mt_rand(0,127), 's', 'valid', mt_rand(128,256));
- $link = 'http://www.google.com/?';
- $link .= $get[mt_rand(0, count($get)-1)];
- $link .= $get_value[mt_rand(0, count($get_value)-1)];
- $link .= '&';
- $link .= $get[mt_rand(0, count($get)-1)];
- $link .= $get_value[mt_rand(0, count($get_value)-1)];
- $link .= '&';
- $link .= $get[mt_rand(0, count($get)-1)];
- $link .= $get_value[mt_rand(0, count($get_value)-1)];
- return $link;
- }
- function write_file($string)
- {
- $h = fopen(_PATH . generate_file_name(), 'w+');
- $f = fwrite($h,$string);
- fclose($h);
- return $f;
- }
- function generate_file_name()
- {
- return 'Link' . mt_rand(0,255) . mt_rand(0,128) . '.txt';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement