Page 1 of 1

bored

Posted: Wed Jul 04, 2007 6:18 am
by phpdevuk
got bored so wrote this

Code: Select all

<html>
<head>
<script>
setTimeout(redirect,70);
function redirect(){
	top.location='tables.php';
}
</script>
</head>
<body>
<?php

function rand_string($len, $chars = 'ABCDEF0123456789')
{
    $string = '';
    for ($i = 0; $i < $len; $i++)
    {
        $pos = rand(0, strlen($chars)-1);
        $string .= $chars{$pos};
    }
    return $string;
}



for($i=0;$i<30;$i++){

	$bg_color = rand_string(6);
	
?><table width="100%" cellpadding="5" cellspacing="5" border="5" bordercolor="#<?php echo $bg_color;?>">
	<tr>
<?
$bg_color = rand_string(6);
?>	
		<td bgcolor="#<?php echo $bg_color;?>">
<?php
}

for($i=0;$i<30;$i++){

?></td>
</tr>
</table><?php

}

?>
</body>
</html>

Posted: Wed Jul 04, 2007 6:23 am
by s.dot
that... would be trippy

Posted: Wed Jul 04, 2007 6:28 am
by Chris Corbyn
Funky 8O My web browser couldn't handle it though so in the end I just had 100% CPU usage and a constantly refreshing white screen ;) Doing it all in JavaScript, avoiding the redirect and just changing colours would work well :)

Posted: Wed Jul 04, 2007 7:07 am
by phpdevuk
yeah I did think of doing it all in page with js, but was just a 10 second thing, originally started off to see how many nested tables I could get.

Posted: Wed Jul 04, 2007 7:34 am
by Chris Corbyn
phpdevuk wrote:originally started off to see how many nested tables I could get.
:lol: You must have been bored. That reminds me of the sort of thing I'd find one of my colleagues sat in a corner doing :lol:

Posted: Wed Jul 04, 2007 9:28 am
by phpdevuk
/me looks at corner