<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1001133" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1001133</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/need-cgi-script#comment-1004944</link>
    <description> &lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Well, I thought I&#039;d try my hand at this. Perhaps it can help?&lt;/p&gt;
&lt;p&gt;It should be called as a server side include from the html page. Simply remove the print &quot;content-type:text/html\n\n&quot; first.&lt;/p&gt;
&lt;p&gt;Configure %img, %link and $total_imgs.&lt;/p&gt;
&lt;p&gt;Create an empty file counter.dat and chmod 777. chmod 755 the cgi script.&lt;/p&gt;
&lt;p&gt;Change &quot;monday&quot; in this statement:&lt;br /&gt;
&lt;BLOCKQUOTE&gt;code:&lt;/blockquote&gt;&lt;/p&gt;
&lt;pre&gt;if (($date_saved ne $date) &amp;amp;&amp;amp; ($dater = &quot;monday&quot;)) {[/code]

to today&#039;s day. It will create the counter.dat file. Then change it back to &quot;monday&quot;.

It will basically use a new image every monday, or print the same one any other day.

Does it help?

&lt;BLOCKQUOTE&gt;code:&lt;pre&gt;
#!/usr/bin/perl

$img{&#039;1&#039;} = &quot;http://myplace.com/pic1.jpg&quot;;
$img{&#039;2&#039;} = &quot;http://myplace.com/pic2.jpg&quot;;
$img{&#039;3&#039;} = &quot;http://myplace.com/pic3.jpg&quot;;
$img{&#039;4&#039;} = &quot;http://myplace.com/pic4.jpg&quot;;
$img{&#039;5&#039;} = &quot;http://myplace.com/pic5.jpg&quot;;
$img{&#039;6&#039;} = &quot;http://myplace.com/pic6.jpg&quot;;

$link{&#039;1&#039;} = &quot;http://myplace.com/pic1/&quot;;
$link{&#039;2&#039;} = &quot;http://myplace.com/pic2/&quot;;
$link{&#039;3&#039;} = &quot;http://myplace.com/pic3/&quot;;
$link{&#039;4&#039;} = &quot;http://myplace.com/pic4/&quot;;
$link{&#039;5&#039;} = &quot;http://myplace.com/pic5/&quot;;
$link{&#039;6&#039;} = &quot;http://myplace.com/pic6/&quot;;

$total_imgs = 6;

    srand(time);
    open (COUNTER, &quot;&amp;lt;counter.dat&quot;);
        flock COUNTER, 2;
        $date_saved = &amp;lt;COUNTER&amp;gt;;
        chomp($date_saved);
        $id = &amp;lt;COUNTER&amp;gt;;
    close (COUNTER);

@days   = (&#039;sunday&#039;,&#039;monday&#039;,&#039;tuesday&#039;,&#039;wednesday&#039;,
               &#039;thursday&#039;,&#039;friday&#039;,&#039;saturday&#039;);

($sec,$min,$hour,$mday,$mon,$year,$year2,$wday) = (localtime(time))[0,1,2,3,4,5,5,6];
$mon++;
$year2 += 1900;
$date = &quot;$mon/$mday/$year2&quot;;
$dater = &quot;$days[$wday]&quot;;

if (($date_saved ne $date) &amp;amp;&amp;amp; ($dater = &quot;monday&quot;)) {
    $rand = int(rand($total_imgs)) + 1;
    while ($rand == $id) {
        $rand = int(rand($total_imgs)) + 1;
    }

    open (COUNTER, &quot;&amp;gt;counter.dat&quot;);
        flock COUNTER, 2;
        print COUNTER $date . &quot;\n&quot;;
        print COUNTER $rand;
    close (FILE);
    $id=$rand;
}

print &quot;Context-type:text/html\n\n&quot;;
print &quot;&amp;lt;a href=&#039;$link{$id}&#039;&amp;gt;&amp;lt;img src=&#039;$img{$id}&#039; border=0&amp;gt;&amp;lt;/a&amp;gt;&quot;;
exit;
[/code]

Regards
Arpith


------------------
&lt;a href=&quot;http://www.arpith.com&quot; class=&quot;bb-url&quot;&gt;Arpith.com&lt;/a&gt; &lt;/pre&gt;&lt;/blockquote&gt;&lt;/pre&gt;</description>
     <pubDate>Mon, 05 Jun 2000 02:57:00 +0000</pubDate>
 <dc:creator>arpith</dc:creator>
 <guid isPermaLink="false">comment 1004944 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/need-cgi-script#comment-1004943</link>
    <description> &lt;p&gt;Javascript makes terrible security too.&lt;/p&gt;
 </description>
     <pubDate>Sun, 04 Jun 2000 21:07:00 +0000</pubDate>
 <dc:creator>Orpheus</dc:creator>
 <guid isPermaLink="false">comment 1004943 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/need-cgi-script#comment-1004942</link>
    <description> &lt;blockquote&gt;&lt;p&gt;quote:Originally posted by Arielladog:&lt;br /&gt;
&lt;strong&gt;couldn&#039;t you do this with JavaScript?&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I suppose, but I would like to avoid using javascript because I know there are still people out there that use netscape and IE 3.0&lt;/p&gt;
 </description>
     <pubDate>Sun, 04 Jun 2000 20:20:00 +0000</pubDate>
 <dc:creator>clueless</dc:creator>
 <guid isPermaLink="false">comment 1004942 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/need-cgi-script#comment-1004941</link>
    <description> &lt;p&gt;couldn&#039;t you do this with JavaScript?&lt;/p&gt;
 </description>
     <pubDate>Thu, 01 Jun 2000 04:41:00 +0000</pubDate>
 <dc:creator>Arielladog</dc:creator>
 <guid isPermaLink="false">comment 1004941 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/need-cgi-script#comment-1004940</link>
    <description> &lt;blockquote&gt;&lt;p&gt;quote:Originally posted by Suzanne:&lt;br /&gt;
&lt;strong&gt;I don&#039;t have the answer, but a clarification?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I would think that a script that would change the image based on the date is really what you are looking for/want to build, as opposed to saying it&#039;s a random change.&lt;br /&gt;
&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I guess I didn&#039;t make it clear enough. I want to be able to change the image on a certain date, like every monday, with a premade database with the images and the links.&lt;/p&gt;
 </description>
     <pubDate>Fri, 26 May 2000 00:05:00 +0000</pubDate>
 <dc:creator>clueless</dc:creator>
 <guid isPermaLink="false">comment 1004940 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/need-cgi-script#comment-1004939</link>
    <description> &lt;p&gt;I don&#039;t have the answer, but a clarification?&lt;/p&gt;
&lt;p&gt;I would think that a script that would change the image based on the date is really what you are looking for/want to build, as opposed to saying it&#039;s a random change.  I think you are looking to not update the image yourself weekly, but perhaps just a small text database?&lt;/p&gt;
&lt;p&gt;Suzanne&lt;/p&gt;
&lt;p&gt;------------------&lt;br /&gt;
&lt;a href=&quot;http://www.zerocattle.com&quot; class=&quot;bb-url&quot;&gt;Zero Cattle&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.inforamp.net/~suzanne/&quot; class=&quot;bb-url&quot;&gt;Suzanne&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.inforamp.net/~suzanne/index/celtic.html&quot; class=&quot;bb-url&quot;&gt;Tables DeMystified&lt;/a&gt;&lt;/p&gt;
 </description>
     <pubDate>Thu, 25 May 2000 23:44:00 +0000</pubDate>
 <dc:creator>Suzanne</dc:creator>
 <guid isPermaLink="false">comment 1004939 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/need-cgi-script#comment-1004938</link>
    <description> &lt;p&gt;Wouldn&#039;t a random book every week defeit the purpose of having it as the &quot;book of the week?&quot;&lt;/p&gt;
&lt;p&gt;Richard&lt;/p&gt;
&lt;p&gt;------------------&lt;br /&gt;
     &lt;a href=&quot;mailto:richard@brevig.com&quot; class=&quot;bb-email&quot;&gt;richard@brevig.com&lt;/a&gt;      &lt;/p&gt;
&lt;p&gt;&quot;I&#039;m so wracked with guilt. I don&#039;t want to stop therapy&lt;br /&gt;
because I&#039;m afraid to take the income away from my therapist.&lt;br /&gt;
He&#039;s got kids in college.&quot;&lt;br /&gt;
-- Tim Halpern&lt;/p&gt;
 </description>
     <pubDate>Thu, 25 May 2000 18:06:00 +0000</pubDate>
 <dc:creator>richjb</dc:creator>
 <guid isPermaLink="false">comment 1004938 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
