If you save your AdSense code into a file named "adsense.php", then in your webpages you'd write <?php include("adsense.php"); ?> to insert the contents of the file.
As for switching link color:
adsense.php
PHP Code:
<?php
//whatever colors you want
$colors = array("000000", "0000ff", "ff0000", "00ff00");
//generate a random number from 0 to 3 (4 values)
$randval = rand(0,3);
//get the color from the array by the random key
$linkcolor = $colors[$randval];
?>
<script type="text/javascript"><!--
google_ad_client = "pub-9095657276960731";
google_ad_width = 160;
google_ad_height = 600;
google_ad_format = "160x600_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "<?php echo $linkcolor; ?>";
google_color_url = "008000";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
Bookmarks