<?php
<html>
<head>
<title>Flog Interlink Scheme Generator</title>
</head>
<body>
<form method="get">
Number of sites: <input type="text" name="num_sites" value="100" /><br />
Posts per site: <input type="text" name="num_post_min" value="5" /> - <input type="text" name="num_post_max" value="30" /><br />
Inbound links per site: <input type="text" name="num_links_min" value="1" /> - <input type="text" name="num_links_max" value="50" /><br />
<br />
<input type="submit" name="generate" value="Generate" />
</form>
<?php
if(isset($_GET['generate'])) {
$num_sites = $_GET['num_sites'];
$num_post_min = $_GET['num_post_min'];
$num_post_max = $_GET['num_post_max'];
$num_links_min = $_GET['num_links_min'];
$num_links_max = $_GET['num_links_max'];
$sites = array();
$all_posts = array();
$ap = 0;
for($s=0;$s<$num_sites;$s++) {
$sites[$s]['num_posts'] = mt_rand($num_post_min,$num_post_max);
$sites[$s]['num_links'] = mt_rand($num_links_min,$num_links_max);
for($p=0;$p<$sites[$s]['num_posts'];$p++) {
$sites[$s]['posts'][$p] = $p+1;
$all_posts[$ap]['site'] = $s;
$all_posts[$ap]['post'] = $p;
$ap++;
}
}
// choose incoming links
foreach($sites as $skey => $sval) {
$use_posts = $all_posts; // sites to get links from
// we choose random links
for($l=0;$l<$sval['num_links'];$l++) {
$randpost = mt_rand(0,count($use_posts)-1); // where link comes from
$sites[$skey]['links'][$l] = array();
$sites[$skey]['links'][$l]['site'] = $all_posts[$randpost]['site'];
$sites[$skey]['links'][$l]['post'] = $all_posts[$randpost]['post'];
unset($use_posts[$randpost]);
}
}
echo 'Total posts: '.count($all_posts)."<br />\n";
foreach($sites as $skey => $sval) {
echo "site_".($skey+1).": ".$sval['num_posts']." posts, ".$sval['num_links']." links - ";
foreach($sites[$skey]['links'] as $link) {
echo $link['site'].'.'.$link['post'].', ';
}
echo "<br />\n";
}
}//~if submitted
?>
</body>
</html>
[/QUOTE]
guys, can you please help me with the above php code? i just copied it from OP and file named it as random.php but i am really having this error:
[B]Parse error: syntax error, unexpected '<' in [B]/home/******/public_html/******/random.php on line [B]3
[/B][/B][/B]
​Can someone from BHW enlighten me? Thanks.